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

Unified Diff: runtime/vm/scopes.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 | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scopes.cc
diff --git a/runtime/vm/scopes.cc b/runtime/vm/scopes.cc
index 0d4233a5b907652fdd9ae7cb611d545512301f7b..a06bca391bb114d8fa048e942a5281758d8e7c36 100644
--- a/runtime/vm/scopes.cc
+++ b/runtime/vm/scopes.cc
@@ -431,9 +431,7 @@ bool LocalScope::CaptureVariable(const String& name) {
while (current_scope != NULL) {
LocalVariable* var = current_scope->LocalLookupVariable(name);
if (var != NULL) {
- if (var->owner()->function_level() != function_level()) {
- var->set_is_captured();
- }
+ var->set_is_captured();
// Insert aliases of the variable in intermediate scopes.
LocalScope* intermediate_scope = this;
while (intermediate_scope != current_scope) {
@@ -633,9 +631,6 @@ void LocalScope::RecursivelyCaptureAllVariables() {
continue;
}
found = CaptureVariable(VariableAt(i)->name());
- // Also manually set the variable as captured as CaptureVariable() does not
- // handle capturing variables on the same scope level.
- VariableAt(i)->set_is_captured();
ASSERT(found);
}
if (sibling() != NULL) { sibling()->RecursivelyCaptureAllVariables(); }
« no previous file with comments | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698