| Index: runtime/vm/scopes.cc
|
| diff --git a/runtime/vm/scopes.cc b/runtime/vm/scopes.cc
|
| index d9f2df16e615c53eff63ef0c68a131f57344ed50..bab5afbaeeef7446f18464e443e0dce2b12dca8f 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())) {
|
| + // Don't capture those variables as their scope of use can not be
|
| + // interrupted by await. In other words: There is no way to reach an await
|
| + // in between assigning them a value and reading the value, as these are
|
| + // just internals to pass along exception states.
|
| + continue;
|
| + }
|
| + found = CaptureVariable(VariableAt(i)->name());
|
| + 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;
|
|
|
|
|