| 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/ast_transformer.h" | 9 #include "vm/ast_transformer.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 7926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7937 // It is better to leave the iterator untyped and postpone the type error | 7937 // It is better to leave the iterator untyped and postpone the type error |
| 7938 // until the loop variable is assigned to. | 7938 // until the loop variable is assigned to. |
| 7939 const AbstractType& iterator_type = Type::ZoneHandle(Z, Type::DynamicType()); | 7939 const AbstractType& iterator_type = Type::ZoneHandle(Z, Type::DynamicType()); |
| 7940 LocalVariable* iterator_var = new(Z) LocalVariable( | 7940 LocalVariable* iterator_var = new(Z) LocalVariable( |
| 7941 collection_pos, Symbols::ForInIter(), iterator_type); | 7941 collection_pos, Symbols::ForInIter(), iterator_type); |
| 7942 current_block_->scope->AddVariable(iterator_var); | 7942 current_block_->scope->AddVariable(iterator_var); |
| 7943 | 7943 |
| 7944 // Generate initialization of iterator variable. | 7944 // Generate initialization of iterator variable. |
| 7945 ArgumentListNode* no_args = new(Z) ArgumentListNode(collection_pos); | 7945 ArgumentListNode* no_args = new(Z) ArgumentListNode(collection_pos); |
| 7946 AstNode* get_iterator = new(Z) InstanceGetterNode( | 7946 AstNode* get_iterator = new(Z) InstanceGetterNode( |
| 7947 collection_pos, collection_expr, Symbols::iterator()); | 7947 collection_pos, collection_expr, Symbols::Iterator()); |
| 7948 AstNode* iterator_init = | 7948 AstNode* iterator_init = |
| 7949 new(Z) StoreLocalNode(collection_pos, iterator_var, get_iterator); | 7949 new(Z) StoreLocalNode(collection_pos, iterator_var, get_iterator); |
| 7950 current_block_->statements->Add(iterator_init); | 7950 current_block_->statements->Add(iterator_init); |
| 7951 | 7951 |
| 7952 // Generate while loop condition. | 7952 // Generate while loop condition. |
| 7953 AstNode* iterator_moveNext = new(Z) InstanceCallNode( | 7953 AstNode* iterator_moveNext = new(Z) InstanceCallNode( |
| 7954 collection_pos, | 7954 collection_pos, |
| 7955 new(Z) LoadLocalNode(collection_pos, iterator_var), | 7955 new(Z) LoadLocalNode(collection_pos, iterator_var), |
| 7956 Symbols::MoveNext(), | 7956 Symbols::MoveNext(), |
| 7957 no_args); | 7957 no_args); |
| (...skipping 4566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12524 void Parser::SkipQualIdent() { | 12524 void Parser::SkipQualIdent() { |
| 12525 ASSERT(IsIdentifier()); | 12525 ASSERT(IsIdentifier()); |
| 12526 ConsumeToken(); | 12526 ConsumeToken(); |
| 12527 if (CurrentToken() == Token::kPERIOD) { | 12527 if (CurrentToken() == Token::kPERIOD) { |
| 12528 ConsumeToken(); // Consume the kPERIOD token. | 12528 ConsumeToken(); // Consume the kPERIOD token. |
| 12529 ExpectIdentifier("identifier expected after '.'"); | 12529 ExpectIdentifier("identifier expected after '.'"); |
| 12530 } | 12530 } |
| 12531 } | 12531 } |
| 12532 | 12532 |
| 12533 } // namespace dart | 12533 } // namespace dart |
| OLD | NEW |