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

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
« no previous file with comments | « runtime/vm/object_test.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 // TODO(srdjan): Store argument values into the argument list.
6764 arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
6765 } else {
6766 const int total_num_parameters = function.NumParameters();
6767 Array& array = Array::ZoneHandle(Array::New(total_num_parameters));
6768 array ^= array.Canonicalize();
6769 // Skip receiver.
6770 for (int i = 0; i < total_num_parameters; i++) {
6771 array.SetAt(i, String::Handle(function.ParameterNameAt(i)));
6772 }
6773 arguments->Add(new LiteralNode(call_pos, array));
6774 }
6760 return MakeStaticCall(Symbols::NoSuchMethodError(), 6775 return MakeStaticCall(Symbols::NoSuchMethodError(),
6761 PrivateCoreLibName(Symbols::ThrowNew()), 6776 PrivateCoreLibName(Symbols::ThrowNew()),
6762 arguments); 6777 arguments);
6763 } 6778 }
6764 6779
6765 6780
6766 AstNode* Parser::ParseBinaryExpr(int min_preced) { 6781 AstNode* Parser::ParseBinaryExpr(int min_preced) {
6767 TRACE_PARSER("ParseBinaryExpr"); 6782 TRACE_PARSER("ParseBinaryExpr");
6768 ASSERT(min_preced >= 4); 6783 ASSERT(min_preced >= 4);
6769 AstNode* left_operand = ParseUnaryExpr(); 6784 AstNode* left_operand = ParseUnaryExpr();
(...skipping 3173 matching lines...) Expand 10 before | Expand all | Expand 10 after
9943 void Parser::SkipQualIdent() { 9958 void Parser::SkipQualIdent() {
9944 ASSERT(IsIdentifier()); 9959 ASSERT(IsIdentifier());
9945 ConsumeToken(); 9960 ConsumeToken();
9946 if (CurrentToken() == Token::kPERIOD) { 9961 if (CurrentToken() == Token::kPERIOD) {
9947 ConsumeToken(); // Consume the kPERIOD token. 9962 ConsumeToken(); // Consume the kPERIOD token.
9948 ExpectIdentifier("identifier expected after '.'"); 9963 ExpectIdentifier("identifier expected after '.'");
9949 } 9964 }
9950 } 9965 }
9951 9966
9952 } // namespace dart 9967 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698