| Index: runtime/lib/errors_patch.dart
|
| ===================================================================
|
| --- runtime/lib/errors_patch.dart (revision 18612)
|
| +++ runtime/lib/errors_patch.dart (working copy)
|
| @@ -37,4 +37,59 @@
|
| namedArguments,
|
| existingArgumentNames);
|
| }
|
| +
|
| + const NoSuchMethodError(Object this._receiver,
|
| + String this._memberName,
|
| + List this._arguments,
|
| + Map<String,dynamic> this._namedArguments,
|
| + [List existingArgumentNames = null])
|
| + : this._existingArgumentNames = existingArgumentNames;
|
| +
|
| + /* patch */ String toString() {
|
| + StringBuffer actual_buf = new StringBuffer();
|
| + int i = 0;
|
| + if (_arguments != null) {
|
| + for (; i < _arguments.length; i++) {
|
| + if (i > 0) {
|
| + actual_buf.add(", ");
|
| + }
|
| + actual_buf.add(Error.safeToString(_arguments[i]));
|
| + }
|
| + }
|
| + if (_namedArguments != null) {
|
| + _namedArguments.forEach((String key, var value) {
|
| + if (i > 0) {
|
| + actual_buf.add(", ");
|
| + }
|
| + actual_buf.add(key);
|
| + actual_buf.add(": ");
|
| + actual_buf.add(Error.safeToString(value));
|
| + i++;
|
| + });
|
| + }
|
| + StringBuffer msg_buf = new StringBuffer();
|
| + if (_existingArgumentNames == null) {
|
| + msg_buf.add(
|
| + "NoSuchMethodError : method not found: '$_memberName'\n"
|
| + "Receiver: ${Error.safeToString(_receiver)}\n"
|
| + "Arguments: [$actual_buf]");
|
| + } else {
|
| + String actualParameters = actual_buf.toString();
|
| + StringBuffer formal_buf = new StringBuffer();
|
| + for (int i = 0; i < _existingArgumentNames.length; i++) {
|
| + if (i > 0) {
|
| + formal_buf.add(", ");
|
| + }
|
| + formal_buf.add(_existingArgumentNames[i]);
|
| + }
|
| + String formalParameters = formal_buf.toString();
|
| + msg_buf.add(
|
| + "NoSuchMethodError: incorrect number of arguments passed to "
|
| + "method named '$_memberName'\n"
|
| + "Receiver: ${Error.safeToString(_receiver)}\n"
|
| + "Tried calling: $_memberName($actualParameters)\n"
|
| + "Found: $_memberName($formalParameters)");
|
| + }
|
| + return msg_buf.toString();
|
| + }
|
| }
|
|
|