Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: lib/core/errors.dart

Issue 11231074: Change signature of noSuchMethod to take an InvocationMirror. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/core/errors.dart
diff --git a/lib/core/errors.dart b/lib/core/errors.dart
index 20a277eb83f05ee6cb7a646effe2c710ac774149..5d08def130bf5a64c1f2206f133fc91df519ef64 100644
--- a/lib/core/errors.dart
+++ b/lib/core/errors.dart
@@ -65,6 +65,7 @@ class NoSuchMethodError implements Error {
final Object _receiver;
final String _functionName;
final List _arguments;
+ final Map<String,Dynamic> _namedArguments;
floitsch 2012/10/23 13:04:35 String, Dynamic (space)
regis 2012/10/25 02:27:56 dynamic is now lower case.
Lasse Reichstein Nielsen 2012/10/25 06:17:35 I actually have come to prefer it without spaces.
final List _existingArgumentNames;
/**
@@ -83,16 +84,31 @@ class NoSuchMethodError implements Error {
const NoSuchMethodError(Object this._receiver,
String this._functionName,
List this._arguments,
+ Map<String,Dynamic> this._namedArguments,
floitsch 2012/10/23 13:04:35 no need to type. the type comes from the field.
Lasse Reichstein Nielsen 2012/10/25 06:17:35 True. And dynamic is lower-case now.
[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"

Powered by Google App Engine
This is Rietveld 408576698