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

Side by Side 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, 7 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 unified diff | Download patch | Annotate | Revision Log
« runtime/vm/object.cc ('K') | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 6738 matching lines...) Expand 10 before | Expand all | Expand 10 after
6749 im_call == InvocationMirror::kTopLevel); 6749 im_call == InvocationMirror::kTopLevel);
6750 im_call = InvocationMirror::kTopLevel; 6750 im_call = InvocationMirror::kTopLevel;
6751 } 6751 }
6752 arguments->Add(new LiteralNode(call_pos, Smi::ZoneHandle( 6752 arguments->Add(new LiteralNode(call_pos, Smi::ZoneHandle(
6753 Smi::New(InvocationMirror::EncodeType(im_call, im_type))))); 6753 Smi::New(InvocationMirror::EncodeType(im_call, im_type)))));
6754 // List arguments. 6754 // List arguments.
6755 arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle())); 6755 arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
6756 // List argumentNames. 6756 // List argumentNames.
6757 arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle())); 6757 arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
6758 // List existingArgumentNames. 6758 // List existingArgumentNames.
6759 arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle())); 6759 // Check if there exists a function with the same name.
6760 Function& function =
6761 Function::Handle(cls.LookupStaticFunction(function_name));
6762 if (function.IsNull()) {
6763 arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
6764 } else {
6765 const int total_num_parameters = function.NumParameters();
6766 Array& array = Array::ZoneHandle(Array::New(total_num_parameters));
6767 array ^= array.Canonicalize();
6768 // Skip receiver.
6769 for (int i = 0; i < total_num_parameters; i++) {
6770 array.SetAt(i, String::Handle(function.ParameterNameAt(i)));
6771 }
6772 arguments->Add(new LiteralNode(call_pos, array));
6773 }
6760 return MakeStaticCall(Symbols::NoSuchMethodError(), 6774 return MakeStaticCall(Symbols::NoSuchMethodError(),
6761 PrivateCoreLibName(Symbols::ThrowNew()), 6775 PrivateCoreLibName(Symbols::ThrowNew()),
6762 arguments); 6776 arguments);
6763 } 6777 }
6764 6778
6765 6779
6766 AstNode* Parser::ParseBinaryExpr(int min_preced) { 6780 AstNode* Parser::ParseBinaryExpr(int min_preced) {
6767 TRACE_PARSER("ParseBinaryExpr"); 6781 TRACE_PARSER("ParseBinaryExpr");
6768 ASSERT(min_preced >= 4); 6782 ASSERT(min_preced >= 4);
6769 AstNode* left_operand = ParseUnaryExpr(); 6783 AstNode* left_operand = ParseUnaryExpr();
(...skipping 3173 matching lines...) Expand 10 before | Expand all | Expand 10 after
9943 void Parser::SkipQualIdent() { 9957 void Parser::SkipQualIdent() {
9944 ASSERT(IsIdentifier()); 9958 ASSERT(IsIdentifier());
9945 ConsumeToken(); 9959 ConsumeToken();
9946 if (CurrentToken() == Token::kPERIOD) { 9960 if (CurrentToken() == Token::kPERIOD) {
9947 ConsumeToken(); // Consume the kPERIOD token. 9961 ConsumeToken(); // Consume the kPERIOD token.
9948 ExpectIdentifier("identifier expected after '.'"); 9962 ExpectIdentifier("identifier expected after '.'");
9949 } 9963 }
9950 } 9964 }
9951 9965
9952 } // namespace dart 9966 } // namespace dart
OLDNEW
« 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