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

Unified Diff: runtime/vm/parser.cc

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
« runtime/vm/object.cc ('K') | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 22181)
+++ runtime/vm/parser.cc (working copy)
@@ -6756,7 +6756,21 @@
// List argumentNames.
arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
// List existingArgumentNames.
- arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
+ // Check if there exists a function with the same name.
+ Function& function =
+ Function::Handle(cls.LookupStaticFunction(function_name));
+ if (function.IsNull()) {
+ arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
+ } else {
+ const int total_num_parameters = function.NumParameters();
+ Array& array = Array::ZoneHandle(Array::New(total_num_parameters));
+ array ^= array.Canonicalize();
+ // Skip receiver.
+ for (int i = 0; i < total_num_parameters; i++) {
+ array.SetAt(i, String::Handle(function.ParameterNameAt(i)));
+ }
+ arguments->Add(new LiteralNode(call_pos, array));
+ }
return MakeStaticCall(Symbols::NoSuchMethodError(),
PrivateCoreLibName(Symbols::ThrowNew()),
arguments);
« runtime/vm/object.cc ('K') | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698