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

Side by Side Diff: runtime/vm/parser.cc

Issue 390003002: Fix crash bug with noSuchMethod invocation and argument count mismatch. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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 | « no previous file | tests/language/regress_12561_test.dart » ('j') | 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 "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/bootstrap.h" 9 #include "vm/bootstrap.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 Array::ZoneHandle(I, Array::New(desc.NamedCount())); 1370 Array::ZoneHandle(I, Array::New(desc.NamedCount()));
1371 for (intptr_t i = 0; i < arg_names.Length(); ++i) { 1371 for (intptr_t i = 0; i < arg_names.Length(); ++i) {
1372 arg_names.SetAt(i, String::Handle(I, desc.NameAt(i))); 1372 arg_names.SetAt(i, String::Handle(I, desc.NameAt(i)));
1373 } 1373 }
1374 func_args->set_names(arg_names); 1374 func_args->set_names(arg_names);
1375 } 1375 }
1376 1376
1377 const String& func_name = String::ZoneHandle(I, func.name()); 1377 const String& func_name = String::ZoneHandle(I, func.name());
1378 ArgumentListNode* arguments = BuildNoSuchMethodArguments( 1378 ArgumentListNode* arguments = BuildNoSuchMethodArguments(
1379 token_pos, func_name, *func_args, NULL, false); 1379 token_pos, func_name, *func_args, NULL, false);
1380 const Function& no_such_method = Function::ZoneHandle(I, 1380 const intptr_t kNumArguments = 2; // Receiver, InvocationMirror.
1381 Resolver::ResolveDynamicAnyArgs(Class::Handle( 1381 ArgumentsDescriptor args_desc(
1382 I, func.Owner()), Symbols::NoSuchMethod())); 1382 Array::Handle(I, ArgumentsDescriptor::New(kNumArguments)));
1383 Function& no_such_method = Function::ZoneHandle(I,
1384 Resolver::ResolveDynamicForReceiverClass(Class::Handle(I, func.Owner()),
1385 Symbols::NoSuchMethod(),
1386 args_desc));
1387 if (no_such_method.IsNull()) {
1388 // If noSuchMethod(i) is not found, call Object:noSuchMethod.
1389 no_such_method ^= Resolver::ResolveDynamicForReceiverClass(
Ivan Posva 2014/07/14 10:03:19 Indentation.
Florian Schneider 2014/07/14 10:06:20 Done.
1390 Class::Handle(I, I->object_store()->object_class()),
1391 Symbols::NoSuchMethod(),
1392 args_desc);
1393 }
1383 StaticCallNode* call = 1394 StaticCallNode* call =
1384 new StaticCallNode(token_pos, no_such_method, arguments); 1395 new StaticCallNode(token_pos, no_such_method, arguments);
1385 1396
1386 ReturnNode* return_node = new ReturnNode(token_pos, call); 1397 ReturnNode* return_node = new ReturnNode(token_pos, call);
1387 current_block_->statements->Add(return_node); 1398 current_block_->statements->Add(return_node);
1388 return CloseBlock(); 1399 return CloseBlock();
1389 } 1400 }
1390 1401
1391 1402
1392 SequenceNode* Parser::ParseInvokeFieldDispatcher(const Function& func, 1403 SequenceNode* Parser::ParseInvokeFieldDispatcher(const Function& func,
(...skipping 9666 matching lines...) Expand 10 before | Expand all | Expand 10 after
11059 void Parser::SkipQualIdent() { 11070 void Parser::SkipQualIdent() {
11060 ASSERT(IsIdentifier()); 11071 ASSERT(IsIdentifier());
11061 ConsumeToken(); 11072 ConsumeToken();
11062 if (CurrentToken() == Token::kPERIOD) { 11073 if (CurrentToken() == Token::kPERIOD) {
11063 ConsumeToken(); // Consume the kPERIOD token. 11074 ConsumeToken(); // Consume the kPERIOD token.
11064 ExpectIdentifier("identifier expected after '.'"); 11075 ExpectIdentifier("identifier expected after '.'");
11065 } 11076 }
11066 } 11077 }
11067 11078
11068 } // namespace dart 11079 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/regress_12561_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698