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

Unified Diff: runtime/lib/errors_patch.dart

Issue 14652008: Fix error reporting when calling static methods and closures withh mismatched arguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 | « no previous file | runtime/lib/object.cc » ('j') | runtime/vm/code_generator.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/errors_patch.dart
===================================================================
--- runtime/lib/errors_patch.dart (revision 22181)
+++ runtime/lib/errors_patch.dart (working copy)
@@ -23,7 +23,8 @@
numPositionalArguments -= numNamedArguments;
List positionalArguments;
if (numPositionalArguments == 0) {
- positionalArguments = [];
+ // Differ between no arguments specified and 0 arguments.
regis 2013/04/30 19:07:10 When is _throwNew called with unspecified argument
srdjan 2013/04/30 21:46:52 Adding comments: TODO(srdjan): This can currently
+ positionalArguments = argumentNames == null ? null : [];
} else {
positionalArguments = arguments.sublist(0, numPositionalArguments);
}
@@ -79,8 +80,13 @@
msg = "The null object does not have a $type_str '$_memberName'"
"$args_message.";
} else {
- msg = "Class '${_receiver.runtimeType}' has no instance $type_str "
- "'$_memberName'$args_message.";
+ if (_receiver is Function) {
+ msg = "Closure call with mismatched arguments: "
+ "function '$_memberName'";
+ } else {
+ msg = "Class '${_receiver.runtimeType}' has no instance $type_str "
+ "'$_memberName'$args_message.";
+ }
}
break;
}
@@ -94,7 +100,7 @@
break;
}
case _InvocationMirror._TOP_LEVEL: {
- msg = "No top-level $type_str '$_memberName' declared.";
+ msg = "No top-level $type_str '$_memberName'$args_message declared.";
break;
}
}
@@ -104,7 +110,10 @@
/* patch */ String toString() {
StringBuffer actual_buf = new StringBuffer();
int i = 0;
- if (_arguments != null) {
+ if (_arguments == null) {
+ // Actual arguments unknown.
regis 2013/04/30 19:07:10 ditto
srdjan 2013/04/30 21:46:52 Adding TODO(regis): Remove once arguments are pass
+ actual_buf.write("...");
regis 2013/04/30 19:07:10 Same question.
srdjan 2013/04/30 21:46:52 Answered above.
+ } else {
for (; i < _arguments.length; i++) {
if (i > 0) {
actual_buf.write(", ");
« no previous file with comments | « no previous file | runtime/lib/object.cc » ('j') | runtime/vm/code_generator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698