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

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

Issue 295803003: Fix issue 18435. (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 | « no previous file | 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 5369 matching lines...) Expand 10 before | Expand all | Expand 10 after
5380 } 5380 }
5381 } 5381 }
5382 5382
5383 5383
5384 // Populate local scope with the formal parameters. 5384 // Populate local scope with the formal parameters.
5385 void Parser::AddFormalParamsToScope(const ParamList* params, 5385 void Parser::AddFormalParamsToScope(const ParamList* params,
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 // Formal parameters should always be the first variables of the scope.
5391 if (scope->num_variables() > 0) {
5392 // Any local variables already present in the scope were entered as a side
5393 // effect of parsing formal parameter default values. They are aliases of
5394 // variables in outer scopes.
5395 scope->Clear();
5396 }
5390 for (int i = 0; i < num_parameters; i++) { 5397 for (int i = 0; i < num_parameters; i++) {
5391 ParamDesc& param_desc = (*params->parameters)[i]; 5398 ParamDesc& param_desc = (*params->parameters)[i];
5392 ASSERT(!is_top_level_ || param_desc.type->IsResolved()); 5399 ASSERT(!is_top_level_ || param_desc.type->IsResolved());
5393 const String* name = param_desc.name; 5400 const String* name = param_desc.name;
5394 LocalVariable* parameter = new LocalVariable( 5401 LocalVariable* parameter = new LocalVariable(
5395 param_desc.name_pos, *name, *param_desc.type); 5402 param_desc.name_pos, *name, *param_desc.type);
5396 if (!scope->AddVariable(parameter)) { 5403 if (!scope->AddVariable(parameter)) {
5397 ErrorMsg(param_desc.name_pos, 5404 ErrorMsg(param_desc.name_pos,
5398 "name '%s' already exists in scope", 5405 "name '%s' already exists in scope",
5399 param_desc.name->ToCString()); 5406 param_desc.name->ToCString());
(...skipping 5549 matching lines...) Expand 10 before | Expand all | Expand 10 after
10949 void Parser::SkipQualIdent() { 10956 void Parser::SkipQualIdent() {
10950 ASSERT(IsIdentifier()); 10957 ASSERT(IsIdentifier());
10951 ConsumeToken(); 10958 ConsumeToken();
10952 if (CurrentToken() == Token::kPERIOD) { 10959 if (CurrentToken() == Token::kPERIOD) {
10953 ConsumeToken(); // Consume the kPERIOD token. 10960 ConsumeToken(); // Consume the kPERIOD token.
10954 ExpectIdentifier("identifier expected after '.'"); 10961 ExpectIdentifier("identifier expected after '.'");
10955 } 10962 }
10956 } 10963 }
10957 10964
10958 } // namespace dart 10965 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698