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

Unified Diff: sdk/lib/_internal/compiler/implementation/lib/core_patch.dart

Issue 12297010: - Split the implementation of NoSuchMethodError in preparation for (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 | « runtime/lib/errors_patch.dart ('k') | sdk/lib/core/errors.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/lib/core_patch.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/lib/core_patch.dart (revision 18612)
+++ sdk/lib/_internal/compiler/implementation/lib/core_patch.dart (working copy)
@@ -248,3 +248,50 @@
return new JsStringBuffer(content);
}
}
+
+patch class NoSuchMethodError {
+ patch String toString() {
+ StringBuffer sb = new StringBuffer();
+ int i = 0;
+ if (_arguments != null) {
+ for (; i < _arguments.length; i++) {
+ if (i > 0) {
+ sb.add(", ");
+ }
+ sb.add(Error.safeToString(_arguments[i]));
+ }
+ }
+ if (_namedArguments != null) {
+ _namedArguments.forEach((String key, var value) {
+ if (i > 0) {
+ sb.add(", ");
+ }
+ sb.add(key);
+ sb.add(": ");
+ sb.add(Error.safeToString(value));
+ i++;
+ });
+ }
+ if (_existingArgumentNames == null) {
+ return "NoSuchMethodError : method not found: '$_memberName'\n"
+ "Receiver: ${Error.safeToString(_receiver)}\n"
+ "Arguments: [$sb]";
+ } else {
+ String actualParameters = sb.toString();
+ sb = new StringBuffer();
+ for (int i = 0; i < _existingArgumentNames.length; i++) {
+ if (i > 0) {
+ sb.add(", ");
+ }
+ sb.add(_existingArgumentNames[i]);
+ }
+ String formalParameters = sb.toString();
+ return "NoSuchMethodError: incorrect number of arguments passed to "
+ "method named '$_memberName'\n"
+ "Receiver: ${Error.safeToString(_receiver)}\n"
+ "Tried calling: $_memberName($actualParameters)\n"
+ "Found: $_memberName($formalParameters)";
+ }
+ }
+}
+
« no previous file with comments | « runtime/lib/errors_patch.dart ('k') | sdk/lib/core/errors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698