| 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/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 5039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5050 | 5050 |
| 5051 LocalVariable* Parser::LookupPhaseParameter() { | 5051 LocalVariable* Parser::LookupPhaseParameter() { |
| 5052 const bool kTestOnly = false; | 5052 const bool kTestOnly = false; |
| 5053 return current_block_->scope->LookupVariable(Symbols::PhaseParameter(), | 5053 return current_block_->scope->LookupVariable(Symbols::PhaseParameter(), |
| 5054 kTestOnly); | 5054 kTestOnly); |
| 5055 } | 5055 } |
| 5056 | 5056 |
| 5057 | 5057 |
| 5058 void Parser::CaptureInstantiator() { | 5058 void Parser::CaptureInstantiator() { |
| 5059 ASSERT(current_block_->scope->function_level() > 0); | 5059 ASSERT(current_block_->scope->function_level() > 0); |
| 5060 const bool kTestOnly = false; | |
| 5061 // Side effect of lookup captures the instantiator variable. | |
| 5062 LocalVariable* instantiator = NULL; | |
| 5063 if (current_function().IsInFactoryScope()) { | 5060 if (current_function().IsInFactoryScope()) { |
| 5064 instantiator = LookupTypeArgumentsParameter(current_block_->scope, | 5061 current_block_->scope->CaptureVariable(Symbols::TypeArgumentsParameter()); |
| 5065 kTestOnly); | |
| 5066 } else { | 5062 } else { |
| 5067 instantiator = LookupReceiver(current_block_->scope, kTestOnly); | 5063 current_block_->scope->CaptureVariable(Symbols::This()); |
| 5068 } | 5064 } |
| 5069 ASSERT(instantiator != NULL); | |
| 5070 } | 5065 } |
| 5071 | 5066 |
| 5072 | 5067 |
| 5073 AstNode* Parser::LoadReceiver(intptr_t token_pos) { | 5068 AstNode* Parser::LoadReceiver(intptr_t token_pos) { |
| 5074 // A nested function may access 'this', referring to the receiver of the | 5069 // A nested function may access 'this', referring to the receiver of the |
| 5075 // outermost enclosing function. | 5070 // outermost enclosing function. |
| 5076 const bool kTestOnly = false; | 5071 const bool kTestOnly = false; |
| 5077 LocalVariable* receiver = LookupReceiver(current_block_->scope, kTestOnly); | 5072 LocalVariable* receiver = LookupReceiver(current_block_->scope, kTestOnly); |
| 5078 if (receiver == NULL) { | 5073 if (receiver == NULL) { |
| 5079 ErrorMsg(token_pos, "illegal implicit access to receiver 'this'"); | 5074 ErrorMsg(token_pos, "illegal implicit access to receiver 'this'"); |
| (...skipping 5193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10273 void Parser::SkipQualIdent() { | 10268 void Parser::SkipQualIdent() { |
| 10274 ASSERT(IsIdentifier()); | 10269 ASSERT(IsIdentifier()); |
| 10275 ConsumeToken(); | 10270 ConsumeToken(); |
| 10276 if (CurrentToken() == Token::kPERIOD) { | 10271 if (CurrentToken() == Token::kPERIOD) { |
| 10277 ConsumeToken(); // Consume the kPERIOD token. | 10272 ConsumeToken(); // Consume the kPERIOD token. |
| 10278 ExpectIdentifier("identifier expected after '.'"); | 10273 ExpectIdentifier("identifier expected after '.'"); |
| 10279 } | 10274 } |
| 10280 } | 10275 } |
| 10281 | 10276 |
| 10282 } // namespace dart | 10277 } // namespace dart |
| OLD | NEW |