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

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

Issue 293013005: Fix issue 18435 (2nd attempt). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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/code_generator_test.cc ('k') | runtime/vm/scopes.h » ('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 2458 matching lines...) Expand 10 before | Expand all | Expand 10 after
2469 2469
2470 2470
2471 SequenceNode* Parser::MakeImplicitConstructor(const Function& func) { 2471 SequenceNode* Parser::MakeImplicitConstructor(const Function& func) {
2472 ASSERT(func.IsConstructor()); 2472 ASSERT(func.IsConstructor());
2473 ASSERT(func.Owner() == current_class().raw()); 2473 ASSERT(func.Owner() == current_class().raw());
2474 const intptr_t ctor_pos = TokenPos(); 2474 const intptr_t ctor_pos = TokenPos();
2475 OpenFunctionBlock(func); 2475 OpenFunctionBlock(func);
2476 2476
2477 LocalVariable* receiver = new LocalVariable( 2477 LocalVariable* receiver = new LocalVariable(
2478 Scanner::kNoSourcePos, Symbols::This(), *ReceiverType(current_class())); 2478 Scanner::kNoSourcePos, Symbols::This(), *ReceiverType(current_class()));
2479 current_block_->scope->AddVariable(receiver); 2479 current_block_->scope->InsertParameterAt(0, receiver);
2480 2480
2481 LocalVariable* phase_parameter = 2481 LocalVariable* phase_parameter =
2482 new LocalVariable(Scanner::kNoSourcePos, 2482 new LocalVariable(Scanner::kNoSourcePos,
2483 Symbols::PhaseParameter(), 2483 Symbols::PhaseParameter(),
2484 Type::ZoneHandle(Type::SmiType())); 2484 Type::ZoneHandle(Type::SmiType()));
2485 current_block_->scope->AddVariable(phase_parameter); 2485 current_block_->scope->InsertParameterAt(1, phase_parameter);
2486 2486
2487 // Parse expressions of instance fields that have an explicit 2487 // Parse expressions of instance fields that have an explicit
2488 // initializer expression. 2488 // initializer expression.
2489 // The receiver must not be visible to field initializer expressions. 2489 // The receiver must not be visible to field initializer expressions.
2490 receiver->set_invisible(true); 2490 receiver->set_invisible(true);
2491 GrowableArray<Field*> initialized_fields; 2491 GrowableArray<Field*> initialized_fields;
2492 ParseInitializedInstanceFields( 2492 ParseInitializedInstanceFields(
2493 current_class(), receiver, &initialized_fields); 2493 current_class(), receiver, &initialized_fields);
2494 receiver->set_invisible(false); 2494 receiver->set_invisible(false);
2495 2495
(...skipping 20 matching lines...) Expand all
2516 } 2516 }
2517 2517
2518 // Prepare user-defined arguments to be forwarded to super call. 2518 // Prepare user-defined arguments to be forwarded to super call.
2519 // The first user-defined argument is at position 2. 2519 // The first user-defined argument is at position 2.
2520 forwarding_args = new ArgumentListNode(Scanner::kNoSourcePos); 2520 forwarding_args = new ArgumentListNode(Scanner::kNoSourcePos);
2521 for (int i = 2; i < func.NumParameters(); i++) { 2521 for (int i = 2; i < func.NumParameters(); i++) {
2522 LocalVariable* param = new LocalVariable( 2522 LocalVariable* param = new LocalVariable(
2523 Scanner::kNoSourcePos, 2523 Scanner::kNoSourcePos,
2524 String::ZoneHandle(func.ParameterNameAt(i)), 2524 String::ZoneHandle(func.ParameterNameAt(i)),
2525 Type::ZoneHandle(Type::DynamicType())); 2525 Type::ZoneHandle(Type::DynamicType()));
2526 current_block_->scope->AddVariable(param); 2526 current_block_->scope->InsertParameterAt(i, param);
2527 forwarding_args->Add(new LoadLocalNode(Scanner::kNoSourcePos, param)); 2527 forwarding_args->Add(new LoadLocalNode(Scanner::kNoSourcePos, param));
2528 } 2528 }
2529 } 2529 }
2530 2530
2531 GenerateSuperConstructorCall(current_class(), 2531 GenerateSuperConstructorCall(current_class(),
2532 Scanner::kNoSourcePos, 2532 Scanner::kNoSourcePos,
2533 receiver, 2533 receiver,
2534 forwarding_args); 2534 forwarding_args);
2535 CheckFieldsInitialized(current_class()); 2535 CheckFieldsInitialized(current_class());
2536 2536
(...skipping 2849 matching lines...) Expand 10 before | Expand all | Expand 10 after
5386 LocalScope* scope) { 5386 LocalScope* scope) {
5387 ASSERT((params != NULL) && (params->parameters != NULL)); 5387 ASSERT((params != NULL) && (params->parameters != NULL));
5388 ASSERT(scope != NULL); 5388 ASSERT(scope != NULL);
5389 const int num_parameters = params->parameters->length(); 5389 const int num_parameters = params->parameters->length();
5390 for (int i = 0; i < num_parameters; i++) { 5390 for (int i = 0; i < num_parameters; i++) {
5391 ParamDesc& param_desc = (*params->parameters)[i]; 5391 ParamDesc& param_desc = (*params->parameters)[i];
5392 ASSERT(!is_top_level_ || param_desc.type->IsResolved()); 5392 ASSERT(!is_top_level_ || param_desc.type->IsResolved());
5393 const String* name = param_desc.name; 5393 const String* name = param_desc.name;
5394 LocalVariable* parameter = new LocalVariable( 5394 LocalVariable* parameter = new LocalVariable(
5395 param_desc.name_pos, *name, *param_desc.type); 5395 param_desc.name_pos, *name, *param_desc.type);
5396 if (!scope->AddVariable(parameter)) { 5396 if (!scope->InsertParameterAt(i, parameter)) {
5397 ErrorMsg(param_desc.name_pos, 5397 ErrorMsg(param_desc.name_pos,
5398 "name '%s' already exists in scope", 5398 "name '%s' already exists in scope",
5399 param_desc.name->ToCString()); 5399 param_desc.name->ToCString());
5400 } 5400 }
5401 param_desc.var = parameter; 5401 param_desc.var = parameter;
5402 if (param_desc.is_final) { 5402 if (param_desc.is_final) {
5403 parameter->set_is_final(); 5403 parameter->set_is_final();
5404 } 5404 }
5405 if (param_desc.is_field_initializer) { 5405 if (param_desc.is_field_initializer) {
5406 parameter->set_invisible(true); 5406 parameter->set_invisible(true);
(...skipping 5542 matching lines...) Expand 10 before | Expand all | Expand 10 after
10949 void Parser::SkipQualIdent() { 10949 void Parser::SkipQualIdent() {
10950 ASSERT(IsIdentifier()); 10950 ASSERT(IsIdentifier());
10951 ConsumeToken(); 10951 ConsumeToken();
10952 if (CurrentToken() == Token::kPERIOD) { 10952 if (CurrentToken() == Token::kPERIOD) {
10953 ConsumeToken(); // Consume the kPERIOD token. 10953 ConsumeToken(); // Consume the kPERIOD token.
10954 ExpectIdentifier("identifier expected after '.'"); 10954 ExpectIdentifier("identifier expected after '.'");
10955 } 10955 }
10956 } 10956 }
10957 10957
10958 } // namespace dart 10958 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/code_generator_test.cc ('k') | runtime/vm/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698