| 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 "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 8997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9008 const String &ident, | 9008 const String &ident, |
| 9009 AstNode** node) { | 9009 AstNode** node) { |
| 9010 TRACE_PARSER("ResolveIdentInLocalScope"); | 9010 TRACE_PARSER("ResolveIdentInLocalScope"); |
| 9011 // First try to find the identifier in the nested local scopes. | 9011 // First try to find the identifier in the nested local scopes. |
| 9012 LocalVariable* local = LookupLocalScope(ident); | 9012 LocalVariable* local = LookupLocalScope(ident); |
| 9013 if (current_block_ != NULL) { | 9013 if (current_block_ != NULL) { |
| 9014 current_block_->scope->AddReferencedName(ident_pos, ident); | 9014 current_block_->scope->AddReferencedName(ident_pos, ident); |
| 9015 } | 9015 } |
| 9016 if (local != NULL) { | 9016 if (local != NULL) { |
| 9017 if (node != NULL) { | 9017 if (node != NULL) { |
| 9018 if (local->IsConst()) { | 9018 *node = new LoadLocalNode(ident_pos, local); |
| 9019 *node = new LiteralNode(ident_pos, *local->ConstValue()); | |
| 9020 } else { | |
| 9021 *node = new LoadLocalNode(ident_pos, local); | |
| 9022 } | |
| 9023 } | 9019 } |
| 9024 return true; | 9020 return true; |
| 9025 } | 9021 } |
| 9026 | 9022 |
| 9027 // Try to find the identifier in the class scope of the current class. | 9023 // Try to find the identifier in the class scope of the current class. |
| 9028 // If the current class is the result of a mixin application, we must | 9024 // If the current class is the result of a mixin application, we must |
| 9029 // use the class scope of the class from which the function originates. | 9025 // use the class scope of the class from which the function originates. |
| 9030 Class& cls = Class::Handle(isolate()); | 9026 Class& cls = Class::Handle(isolate()); |
| 9031 if (!current_class().IsMixinApplication()) { | 9027 if (!current_class().IsMixinApplication()) { |
| 9032 cls = current_class().raw(); | 9028 cls = current_class().raw(); |
| (...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10789 void Parser::SkipQualIdent() { | 10785 void Parser::SkipQualIdent() { |
| 10790 ASSERT(IsIdentifier()); | 10786 ASSERT(IsIdentifier()); |
| 10791 ConsumeToken(); | 10787 ConsumeToken(); |
| 10792 if (CurrentToken() == Token::kPERIOD) { | 10788 if (CurrentToken() == Token::kPERIOD) { |
| 10793 ConsumeToken(); // Consume the kPERIOD token. | 10789 ConsumeToken(); // Consume the kPERIOD token. |
| 10794 ExpectIdentifier("identifier expected after '.'"); | 10790 ExpectIdentifier("identifier expected after '.'"); |
| 10795 } | 10791 } |
| 10796 } | 10792 } |
| 10797 | 10793 |
| 10798 } // namespace dart | 10794 } // namespace dart |
| OLD | NEW |