| Index: corelib/src/exceptions.dart
|
| ===================================================================
|
| --- corelib/src/exceptions.dart (revision 3959)
|
| +++ corelib/src/exceptions.dart (working copy)
|
| @@ -38,7 +38,7 @@
|
| const NoSuchMethodException(Object this._receiver,
|
| String this._functionName,
|
| List this._arguments,
|
| - [String this._extraMessage = ""]);
|
| + [List this._existingArgumentNames = null]);
|
|
|
| String toString() {
|
| StringBuffer sb = new StringBuffer();
|
| @@ -48,16 +48,30 @@
|
| }
|
| sb.add(_arguments[i]);
|
| }
|
| - sb.add("]");
|
| - var x = _extraMessage;
|
| - return "NoSuchMethodException - receiver: '$_receiver' " +
|
| - "function name: '$_functionName' arguments: [$sb]$x";
|
| + if (_existingArgumentNames === null) {
|
| + return "NoSuchMethodException : method not found: '$_functionName'\n" +
|
| + "Receiver: $_receiver\n" + "Arguments: [$sb]";
|
| + } else {
|
| + String actualParameters = sb.toString();
|
| + sb = new StringBuffer();
|
| + for (int i = 0; i < _existingArgumentNames.length; i++) {
|
| + if (i > 0) {
|
| + sb.add(", ");
|
| + }
|
| + sb.add(_existingArgumentNames[i]);
|
| + }
|
| + String formalParameters = sb.toString();
|
| + return "NoSuchMethodException: incorrect number of arguments passed to " +
|
| + "method named '$_functionName'\nReceiver: $_receiver\n" +
|
| + "Tried calling: $_functionName($actualParameters)\n" +
|
| + "Found: $_functionName($formalParameters)";
|
| + }
|
| }
|
|
|
| final Object _receiver;
|
| final String _functionName;
|
| final List _arguments;
|
| - final String _extraMessage;
|
| + final List _existingArgumentNames;
|
| }
|
|
|
|
|
|
|