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

Unified Diff: runtime/vm/scopes.cc

Issue 484933003: Await it! (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 6 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/scopes.h ('k') | runtime/vm/symbols.h » ('j') | 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 d9f2df16e615c53eff63ef0c68a131f57344ed50..72a300238fc2a001525f3711bb29061f665d3faa 100644
--- a/runtime/vm/scopes.cc
+++ b/runtime/vm/scopes.cc
@@ -602,6 +602,27 @@ LocalScope* LocalScope::RestoreOuterScope(const ContextScope& context_scope) {
}
+void LocalScope::RecursivelyCaptureAllVariables() {
+ bool found = false;
+ for (intptr_t i = 0; i < num_variables(); i++) {
+ if ((VariableAt(i)->name().raw() == Symbols::StackTraceVar().raw()) ||
+ (VariableAt(i)->name().raw() == Symbols::ExceptionVar().raw()) ||
+ (VariableAt(i)->name().raw() == Symbols::SavedTryContextVar().raw())) {
+ // Don't capture those variables because the VM expects them to be on the
+ // stack.
+ 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(); }
+ if (child() != NULL) { child()->RecursivelyCaptureAllVariables(); }
+}
+
+
RawContextScope* LocalScope::CreateImplicitClosureScope(const Function& func) {
static const intptr_t kNumCapturedVars = 1;
« no previous file with comments | « runtime/vm/scopes.h ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698