| 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 "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
| (...skipping 5670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5681 const String& iterator_method_name = | 5681 const String& iterator_method_name = |
| 5682 String::ZoneHandle(Symbols::GetIterator()); | 5682 String::ZoneHandle(Symbols::GetIterator()); |
| 5683 ArgumentListNode* no_args = new ArgumentListNode(collection_pos); | 5683 ArgumentListNode* no_args = new ArgumentListNode(collection_pos); |
| 5684 AstNode* get_iterator = new InstanceCallNode( | 5684 AstNode* get_iterator = new InstanceCallNode( |
| 5685 collection_pos, collection_expr, iterator_method_name, no_args); | 5685 collection_pos, collection_expr, iterator_method_name, no_args); |
| 5686 AstNode* iterator_init = | 5686 AstNode* iterator_init = |
| 5687 new StoreLocalNode(collection_pos, iterator_var, get_iterator); | 5687 new StoreLocalNode(collection_pos, iterator_var, get_iterator); |
| 5688 current_block_->statements->Add(iterator_init); | 5688 current_block_->statements->Add(iterator_init); |
| 5689 | 5689 |
| 5690 // Generate while loop condition. | 5690 // Generate while loop condition. |
| 5691 AstNode* iterator_has_next = new InstanceCallNode( | 5691 AstNode* iterator_has_next = new InstanceGetterNode( |
| 5692 collection_pos, | 5692 collection_pos, |
| 5693 new LoadLocalNode(collection_pos, iterator_var), | 5693 new LoadLocalNode(collection_pos, iterator_var), |
| 5694 String::ZoneHandle(Symbols::HasNext()), | 5694 String::ZoneHandle(Symbols::HasNext())); |
| 5695 no_args); | |
| 5696 | 5695 |
| 5697 // Parse the for loop body. Ideally, we would use ParseNestedStatement() | 5696 // Parse the for loop body. Ideally, we would use ParseNestedStatement() |
| 5698 // here, but that does not work well because we have to insert an implicit | 5697 // here, but that does not work well because we have to insert an implicit |
| 5699 // variable assignment and potentially a variable declaration in the | 5698 // variable assignment and potentially a variable declaration in the |
| 5700 // loop body. | 5699 // loop body. |
| 5701 OpenLoopBlock(); | 5700 OpenLoopBlock(); |
| 5702 current_block_->scope->AddLabel(label); | 5701 current_block_->scope->AddLabel(label); |
| 5703 | 5702 |
| 5704 AstNode* iterator_next = new InstanceCallNode( | 5703 AstNode* iterator_next = new InstanceCallNode( |
| 5705 collection_pos, | 5704 collection_pos, |
| (...skipping 4035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9741 void Parser::SkipQualIdent() { | 9740 void Parser::SkipQualIdent() { |
| 9742 ASSERT(IsIdentifier()); | 9741 ASSERT(IsIdentifier()); |
| 9743 ConsumeToken(); | 9742 ConsumeToken(); |
| 9744 if (CurrentToken() == Token::kPERIOD) { | 9743 if (CurrentToken() == Token::kPERIOD) { |
| 9745 ConsumeToken(); // Consume the kPERIOD token. | 9744 ConsumeToken(); // Consume the kPERIOD token. |
| 9746 ExpectIdentifier("identifier expected after '.'"); | 9745 ExpectIdentifier("identifier expected after '.'"); |
| 9747 } | 9746 } |
| 9748 } | 9747 } |
| 9749 | 9748 |
| 9750 } // namespace dart | 9749 } // namespace dart |
| OLD | NEW |