Chromium Code Reviews| Index: lib/core/errors.dart |
| diff --git a/lib/core/errors.dart b/lib/core/errors.dart |
| index 9a16d83d2d2bd23964cd7fb7b1480f2619e0f74b..06e5eec0853036b06f79b2c86f388e40e68b55a4 100644 |
| --- a/lib/core/errors.dart |
| +++ b/lib/core/errors.dart |
| @@ -75,6 +75,7 @@ class NoSuchMethodError implements Error { |
| final Object _receiver; |
| final String _functionName; |
| final List _arguments; |
| + final Map<String, dynamic> _namedArguments; |
|
regis
2012/10/26 23:27:08
Why not an InvocationMirror, instead of _functionN
Lasse Reichstein Nielsen
2012/10/27 21:52:45
Two reasons.
The first is that you might want to o
|
| final List _existingArgumentNames; |
| /** |
| @@ -93,16 +94,31 @@ class NoSuchMethodError implements Error { |
| const NoSuchMethodError(Object this._receiver, |
| String this._functionName, |
| List this._arguments, |
| + this._namedArguments, |
|
regis
2012/10/26 23:27:08
We could pass the receiver and invocation mirror i
|
| [List existingArgumentNames = null]) |
| : this._existingArgumentNames = existingArgumentNames; |
| String toString() { |
| StringBuffer sb = new StringBuffer(); |
| - for (int i = 0; i < _arguments.length; i++) { |
| - if (i > 0) { |
| - sb.add(", "); |
| + int i = 0; |
| + if (_arguments != null) { |
| + for (; i < _arguments.length; i++) { |
| + if (i > 0) { |
| + sb.add(", "); |
| + } |
| + sb.add(safeToString(_arguments[i])); |
| } |
| - sb.add(safeToString(_arguments[i])); |
| + } |
| + if (_namedArguments != null) { |
| + _namedArguments.forEach((String key, var value) { |
| + if (i > 0) { |
| + sb.add(", "); |
| + } |
| + sb.add(key); |
| + sb.add(": "); |
| + sb.add(safeToString(value)); |
| + i++; |
| + }); |
| } |
| if (_existingArgumentNames === null) { |
| return "NoSuchMethodError : method not found: '$_functionName'\n" |