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

Unified Diff: runtime/vm/parser.cc

Issue 1284103008: Clean up code capturing variables explicitly. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: use correct scope Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 457e235d9c48184708acb23a5fd5eb6e827b57de..ed49a3ccf32951909966398f40713e130128282e 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -6734,12 +6734,10 @@ void Parser::AddContinuationVariables() {
Scanner::kNoSourcePos, Symbols::AwaitJumpVar(), dynamic_type);
current_block_->scope->AddVariable(await_jump_var);
current_block_->scope->CaptureVariable(Symbols::AwaitJumpVar());
- await_jump_var->set_is_captured();
LocalVariable* await_ctx_var = new (Z) LocalVariable(
Scanner::kNoSourcePos, Symbols::AwaitContextVar(), dynamic_type);
current_block_->scope->AddVariable(await_ctx_var);
current_block_->scope->CaptureVariable(Symbols::AwaitContextVar());
- await_ctx_var->set_is_captured();
}
@@ -6754,22 +6752,18 @@ void Parser::AddAsyncClosureVariables() {
Scanner::kNoSourcePos, Symbols::AsyncOperation(), dynamic_type);
current_block_->scope->AddVariable(async_op_var);
current_block_->scope->CaptureVariable(Symbols::AsyncOperation());
- async_op_var->set_is_captured();
LocalVariable* async_then_callback_var = new(Z) LocalVariable(
Scanner::kNoSourcePos, Symbols::AsyncThenCallback(), dynamic_type);
current_block_->scope->AddVariable(async_then_callback_var);
current_block_->scope->CaptureVariable(Symbols::AsyncThenCallback());
- async_then_callback_var->set_is_captured();
LocalVariable* async_catch_error_callback_var = new(Z) LocalVariable(
Scanner::kNoSourcePos, Symbols::AsyncCatchErrorCallback(), dynamic_type);
current_block_->scope->AddVariable(async_catch_error_callback_var);
current_block_->scope->CaptureVariable(Symbols::AsyncCatchErrorCallback());
- async_catch_error_callback_var->set_is_captured();
LocalVariable* async_completer = new(Z) LocalVariable(
Scanner::kNoSourcePos, Symbols::AsyncCompleter(), dynamic_type);
current_block_->scope->AddVariable(async_completer);
current_block_->scope->CaptureVariable(Symbols::AsyncCompleter());
- async_completer->set_is_captured();
}
@@ -6789,23 +6783,19 @@ void Parser::AddAsyncGeneratorVariables() {
Scanner::kNoSourcePos, Symbols::Controller(), dynamic_type);
current_block_->scope->AddVariable(controller_var);
current_block_->scope->CaptureVariable(Symbols::Controller());
- controller_var->set_is_captured();
LocalVariable* async_op_var = new(Z) LocalVariable(
Scanner::kNoSourcePos, Symbols::AsyncOperation(), dynamic_type);
current_block_->scope->AddVariable(async_op_var);
current_block_->scope->CaptureVariable(Symbols::AsyncOperation());
- async_op_var->set_is_captured();
LocalVariable* async_then_callback_var = new(Z) LocalVariable(
Scanner::kNoSourcePos, Symbols::AsyncThenCallback(), dynamic_type);
current_block_->scope->AddVariable(async_then_callback_var);
current_block_->scope->CaptureVariable(Symbols::AsyncThenCallback());
- async_then_callback_var->set_is_captured();
LocalVariable* async_catch_error_callback_var = new(Z) LocalVariable(
Scanner::kNoSourcePos, Symbols::AsyncCatchErrorCallback(), dynamic_type);
current_block_->scope->AddVariable(async_catch_error_callback_var);
current_block_->scope->CaptureVariable(Symbols::AsyncCatchErrorCallback());
- async_catch_error_callback_var->set_is_captured();
}
@@ -9564,10 +9554,7 @@ void Parser::SetupSavedTryContext(LocalVariable* saved_try_context) {
Type::ZoneHandle(Z, Type::DynamicType()));
ASSERT(async_temp_scope_ != NULL);
async_temp_scope_->AddVariable(async_saved_try_ctx);
- async_saved_try_ctx->set_is_captured();
- async_saved_try_ctx = current_block_->scope->LookupVariable(
- async_saved_try_ctx_name, false);
- ASSERT(async_saved_try_ctx != NULL);
+ current_block_->scope->CaptureVariable(async_saved_try_ctx_name);
ASSERT(saved_try_context != NULL);
current_block_->statements->Add(new(Z) StoreLocalNode(
Scanner::kNoSourcePos,
« no previous file with comments | « no previous file | runtime/vm/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698