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

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: Merged dart2js changes into this CL. 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
« no previous file with comments | « lib/compiler/implementation/universe/universe.dart ('k') | lib/core/invocation_mirror.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
« no previous file with comments | « lib/compiler/implementation/universe/universe.dart ('k') | lib/core/invocation_mirror.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698