Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: runtime/vm/ast_transformer.cc

Issue 1017753003: Fix issue 22875 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/language/await_postfix_expr_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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/ast_transformer.h" 5 #include "vm/ast_transformer.h"
6 6
7 #include "vm/object_store.h" 7 #include "vm/object_store.h"
8 #include "vm/parser.h" 8 #include "vm/parser.h"
9 #include "vm/thread.h" 9 #include "vm/thread.h"
10 10
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 LocalVariable* result = AddToPreambleNewTempVar( 594 LocalVariable* result = AddToPreambleNewTempVar(
595 new(Z) AssignableNode(node->token_pos(), 595 new(Z) AssignableNode(node->token_pos(),
596 new_expr, 596 new_expr,
597 node->type(), 597 node->type(),
598 node->dst_name())); 598 node->dst_name()));
599 result_ = new(Z) LoadLocalNode(Scanner::kNoSourcePos, result); 599 result_ = new(Z) LoadLocalNode(Scanner::kNoSourcePos, result);
600 } 600 }
601 601
602 602
603 void AwaitTransformer::VisitLetNode(LetNode* node) { 603 void AwaitTransformer::VisitLetNode(LetNode* node) {
604 // Add all the initializer nodes and their temporary variables 604 // Add all the initializer nodes to the preamble and the
605 // to the preamble. The temporary variables will be captured 605 // temporary variables to the scope for async temporary variables.
606 // as a side effect of being added to a scope, and the subsequent 606 // The temporary variables will be captured as a side effect of being
607 // nodes that are added to the preample can access them. 607 // added to a scope, and the subsequent nodes that are added to the
608 // preample can access them.
608 for (intptr_t i = 0; i < node->num_temps(); i++) { 609 for (intptr_t i = 0; i < node->num_temps(); i++) {
609 preamble_->scope()->AddVariable(node->TempAt(i)); 610 function_top_->AddVariable(node->TempAt(i));
610 AstNode* new_init_val = Transform(node->InitializerAt(i)); 611 AstNode* new_init_val = Transform(node->InitializerAt(i));
611 preamble_->Add(new(Z) StoreLocalNode(node->token_pos(), 612 preamble_->Add(new(Z) StoreLocalNode(node->token_pos(),
612 node->TempAt(i), 613 node->TempAt(i),
613 new_init_val)); 614 new_init_val));
614 } 615 }
615 // The transformed LetNode does not have any temporary variables. 616 // The transformed LetNode does not have any temporary variables.
616 LetNode* result = new(Z) LetNode(node->token_pos()); 617 LetNode* result = new(Z) LetNode(node->token_pos());
617 for (intptr_t i = 0; i < node->nodes().length(); i++) { 618 for (intptr_t i = 0; i < node->nodes().length(); i++) {
618 result->AddNode(Transform(node->nodes()[i])); 619 result->AddNode(Transform(node->nodes()[i]));
619 } 620 }
620 result_ = result; 621 result_ = result;
621 } 622 }
622 623
623 624
624 void AwaitTransformer::VisitThrowNode(ThrowNode* node) { 625 void AwaitTransformer::VisitThrowNode(ThrowNode* node) {
625 AstNode* new_exception = Transform(node->exception()); 626 AstNode* new_exception = Transform(node->exception());
626 result_ = new(Z) ThrowNode(node->token_pos(), 627 result_ = new(Z) ThrowNode(node->token_pos(),
627 new_exception, 628 new_exception,
628 node->stacktrace()); 629 node->stacktrace());
629 } 630 }
630 631
631 } // namespace dart 632 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/await_postfix_expr_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698