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

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

Issue 2683973002: Handle type literals correctly with deferred loading and await. (Closed)
Patch Set: add comment Created 3 years, 10 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
« no previous file with comments | « runtime/vm/ast.h ('k') | runtime/vm/parser.cc » ('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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 return new (Z) LoadLocalNode(ST(node->token_pos()), temp); 112 return new (Z) LoadLocalNode(ST(node->token_pos()), temp);
113 } 113 }
114 114
115 115
116 void AwaitTransformer::VisitLiteralNode(LiteralNode* node) { 116 void AwaitTransformer::VisitLiteralNode(LiteralNode* node) {
117 result_ = node; 117 result_ = node;
118 } 118 }
119 119
120 120
121 void AwaitTransformer::VisitTypeNode(TypeNode* node) { 121 void AwaitTransformer::VisitTypeNode(TypeNode* node) {
122 result_ = new (Z) TypeNode(node->token_pos(), node->type()); 122 if (node->is_deferred_reference()) {
123 // Deferred references must use a temporary even after loading
124 // happened, so that the number of await temps is the same as
125 // before the loading.
126 result_ = MakeName(node);
127 } else {
128 result_ = node;
129 }
123 } 130 }
124 131
125 132
126 void AwaitTransformer::VisitAwaitNode(AwaitNode* node) { 133 void AwaitTransformer::VisitAwaitNode(AwaitNode* node) {
127 // Await transformation: 134 // Await transformation:
128 // 135 //
129 // :await_temp_var_X = <expr>; 136 // :await_temp_var_X = <expr>;
130 // AwaitMarker(kNewContinuationState); 137 // AwaitMarker(kNewContinuationState);
131 // :result_param = _awaitHelper( 138 // :result_param = _awaitHelper(
132 // :await_temp_var_X, :async_then_callback, :async_catch_error_callback); 139 // :await_temp_var_X, :async_then_callback, :async_catch_error_callback);
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 } 514 }
508 515
509 516
510 void AwaitTransformer::VisitThrowNode(ThrowNode* node) { 517 void AwaitTransformer::VisitThrowNode(ThrowNode* node) {
511 AstNode* new_exception = Transform(node->exception()); 518 AstNode* new_exception = Transform(node->exception());
512 result_ = MakeName( 519 result_ = MakeName(
513 new (Z) ThrowNode(node->token_pos(), new_exception, node->stacktrace())); 520 new (Z) ThrowNode(node->token_pos(), new_exception, node->stacktrace()));
514 } 521 }
515 522
516 } // namespace dart 523 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/ast.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698