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

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

Issue 1575953005: Source position tests for switch and try catch finally (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
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 // 112 //
113 // :await_temp_var_X = <expr>; 113 // :await_temp_var_X = <expr>;
114 // AwaitMarker(kNewContinuationState); 114 // AwaitMarker(kNewContinuationState);
115 // :result_param = _awaitHelper( 115 // :result_param = _awaitHelper(
116 // :await_temp_var_X, :async_then_callback, :async_catch_error_callback); 116 // :await_temp_var_X, :async_then_callback, :async_catch_error_callback);
117 // return; // (return_type() == kContinuationTarget) 117 // return; // (return_type() == kContinuationTarget)
118 // 118 //
119 // :saved_try_ctx_var = :await_saved_try_ctx_var_y; 119 // :saved_try_ctx_var = :await_saved_try_ctx_var_y;
120 // :await_temp_var_(X+1) = :result_param; 120 // :await_temp_var_(X+1) = :result_param;
121 121
122 const intptr_t token_pos = node->token_pos();
122 LocalVariable* async_op = GetVariableInScope( 123 LocalVariable* async_op = GetVariableInScope(
123 preamble_->scope(), Symbols::AsyncOperation()); 124 preamble_->scope(), Symbols::AsyncOperation());
124 LocalVariable* async_then_callback = GetVariableInScope( 125 LocalVariable* async_then_callback = GetVariableInScope(
125 preamble_->scope(), Symbols::AsyncThenCallback()); 126 preamble_->scope(), Symbols::AsyncThenCallback());
126 LocalVariable* async_catch_error_callback = GetVariableInScope( 127 LocalVariable* async_catch_error_callback = GetVariableInScope(
127 preamble_->scope(), Symbols::AsyncCatchErrorCallback()); 128 preamble_->scope(), Symbols::AsyncCatchErrorCallback());
128 LocalVariable* result_param = GetVariableInScope( 129 LocalVariable* result_param = GetVariableInScope(
129 preamble_->scope(), Symbols::AsyncOperationParam()); 130 preamble_->scope(), Symbols::AsyncOperationParam());
130 LocalVariable* error_param = GetVariableInScope( 131 LocalVariable* error_param = GetVariableInScope(
131 preamble_->scope(), Symbols::AsyncOperationErrorParam()); 132 preamble_->scope(), Symbols::AsyncOperationErrorParam());
132 LocalVariable* stack_trace_param = GetVariableInScope( 133 LocalVariable* stack_trace_param = GetVariableInScope(
133 preamble_->scope(), Symbols::AsyncOperationStackTraceParam()); 134 preamble_->scope(), Symbols::AsyncOperationStackTraceParam());
134 135
135 AstNode* transformed_expr = Transform(node->expr()); 136 AstNode* transformed_expr = Transform(node->expr());
136 LocalVariable* await_temp = AddToPreambleNewTempVar(transformed_expr); 137 LocalVariable* await_temp = AddToPreambleNewTempVar(transformed_expr);
137 138
138 AwaitMarkerNode* await_marker = 139 AwaitMarkerNode* await_marker =
139 new (Z) AwaitMarkerNode(async_temp_scope_, node->scope()); 140 new (Z) AwaitMarkerNode(async_temp_scope_, node->scope(), token_pos);
140 preamble_->Add(await_marker); 141 preamble_->Add(await_marker);
141 142
142 // :result_param = _awaitHelper( 143 // :result_param = _awaitHelper(
143 // :await_temp, :async_then_callback, :async_catch_error_callback) 144 // :await_temp, :async_then_callback, :async_catch_error_callback)
144 const Library& async_lib = Library::Handle(Library::AsyncLibrary()); 145 const Library& async_lib = Library::Handle(Library::AsyncLibrary());
145 const Function& async_await_helper = Function::ZoneHandle( 146 const Function& async_await_helper = Function::ZoneHandle(
146 Z, async_lib.LookupFunctionAllowPrivate(Symbols::AsyncAwaitHelper())); 147 Z, async_lib.LookupFunctionAllowPrivate(Symbols::AsyncAwaitHelper()));
147 ASSERT(!async_await_helper.IsNull()); 148 ASSERT(!async_await_helper.IsNull());
148 ArgumentListNode* async_await_helper_args = new (Z) ArgumentListNode( 149 ArgumentListNode* async_await_helper_args = new (Z) ArgumentListNode(
149 Scanner::kNoSourcePos); 150 Scanner::kNoSourcePos);
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 587
587 588
588 void AwaitTransformer::VisitThrowNode(ThrowNode* node) { 589 void AwaitTransformer::VisitThrowNode(ThrowNode* node) {
589 AstNode* new_exception = Transform(node->exception()); 590 AstNode* new_exception = Transform(node->exception());
590 result_ = new(Z) ThrowNode(node->token_pos(), 591 result_ = new(Z) ThrowNode(node->token_pos(),
591 new_exception, 592 new_exception,
592 node->stacktrace()); 593 node->stacktrace());
593 } 594 }
594 595
595 } // namespace dart 596 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698