OLD | NEW |
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/bootstrap.h" | 9 #include "vm/bootstrap.h" |
10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 5044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5055 | 5055 |
5056 LocalVariable* Parser::LookupPhaseParameter() { | 5056 LocalVariable* Parser::LookupPhaseParameter() { |
5057 const bool kTestOnly = false; | 5057 const bool kTestOnly = false; |
5058 return current_block_->scope->LookupVariable(Symbols::PhaseParameter(), | 5058 return current_block_->scope->LookupVariable(Symbols::PhaseParameter(), |
5059 kTestOnly); | 5059 kTestOnly); |
5060 } | 5060 } |
5061 | 5061 |
5062 | 5062 |
5063 void Parser::CaptureInstantiator() { | 5063 void Parser::CaptureInstantiator() { |
5064 ASSERT(current_block_->scope->function_level() > 0); | 5064 ASSERT(current_block_->scope->function_level() > 0); |
| 5065 bool found = false; |
5065 if (current_function().IsInFactoryScope()) { | 5066 if (current_function().IsInFactoryScope()) { |
5066 current_block_->scope->CaptureVariable(Symbols::TypeArgumentsParameter()); | 5067 found = current_block_->scope->CaptureVariable( |
| 5068 Symbols::TypeArgumentsParameter()); |
5067 } else { | 5069 } else { |
5068 current_block_->scope->CaptureVariable(Symbols::This()); | 5070 found = current_block_->scope->CaptureVariable(Symbols::This()); |
5069 } | 5071 } |
| 5072 ASSERT(found); |
5070 } | 5073 } |
5071 | 5074 |
5072 | 5075 |
5073 AstNode* Parser::LoadReceiver(intptr_t token_pos) { | 5076 AstNode* Parser::LoadReceiver(intptr_t token_pos) { |
5074 // A nested function may access 'this', referring to the receiver of the | 5077 // A nested function may access 'this', referring to the receiver of the |
5075 // outermost enclosing function. | 5078 // outermost enclosing function. |
5076 const bool kTestOnly = false; | 5079 const bool kTestOnly = false; |
5077 LocalVariable* receiver = LookupReceiver(current_block_->scope, kTestOnly); | 5080 LocalVariable* receiver = LookupReceiver(current_block_->scope, kTestOnly); |
5078 if (receiver == NULL) { | 5081 if (receiver == NULL) { |
5079 ErrorMsg(token_pos, "illegal implicit access to receiver 'this'"); | 5082 ErrorMsg(token_pos, "illegal implicit access to receiver 'this'"); |
(...skipping 5211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10291 void Parser::SkipQualIdent() { | 10294 void Parser::SkipQualIdent() { |
10292 ASSERT(IsIdentifier()); | 10295 ASSERT(IsIdentifier()); |
10293 ConsumeToken(); | 10296 ConsumeToken(); |
10294 if (CurrentToken() == Token::kPERIOD) { | 10297 if (CurrentToken() == Token::kPERIOD) { |
10295 ConsumeToken(); // Consume the kPERIOD token. | 10298 ConsumeToken(); // Consume the kPERIOD token. |
10296 ExpectIdentifier("identifier expected after '.'"); | 10299 ExpectIdentifier("identifier expected after '.'"); |
10297 } | 10300 } |
10298 } | 10301 } |
10299 | 10302 |
10300 } // namespace dart | 10303 } // namespace dart |
OLD | NEW |