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

Unified Diff: dart/lib/core/errors.dart

Issue 10939020: Don't invoke user-defined code in NoSuchMethodError.toString. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments. Created 8 years, 3 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 | « dart/lib/compiler/implementation/lib/core_patch.dart ('k') | dart/runtime/lib/errors_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/lib/core/errors.dart
diff --git a/dart/lib/core/errors.dart b/dart/lib/core/errors.dart
index 357a930c5e5a2b58e363ac7712b7457a5009f27c..2c904587e225ccc233eccfeadb2c8597e19c2cf5 100644
--- a/dart/lib/core/errors.dart
+++ b/dart/lib/core/errors.dart
@@ -57,11 +57,11 @@ class NoSuchMethodError implements Error {
if (i > 0) {
sb.add(", ");
}
- sb.add(_arguments[i]);
+ sb.add(safeToString(_arguments[i]));
}
if (_existingArgumentNames === null) {
return "NoSuchMethodError : method not found: '$_functionName'\n"
- "Receiver: $_receiver\n"
+ "Receiver: ${safeToString(_receiver)}\n"
"Arguments: [$sb]";
} else {
String actualParameters = sb.toString();
@@ -74,9 +74,12 @@ class NoSuchMethodError implements Error {
}
String formalParameters = sb.toString();
return "NoSuchMethodError: incorrect number of arguments passed to "
- "method named '$_functionName'\nReceiver: $_receiver\n"
+ "method named '$_functionName'\n"
+ "Receiver: ${safeToString(_receiver)}\n"
"Tried calling: $_functionName($actualParameters)\n"
"Found: $_functionName($formalParameters)";
}
}
+
+ external static String safeToString(Object object);
}
« no previous file with comments | « dart/lib/compiler/implementation/lib/core_patch.dart ('k') | dart/runtime/lib/errors_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698