Chromium Code Reviews| Index: runtime/vm/scopes.cc |
| diff --git a/runtime/vm/scopes.cc b/runtime/vm/scopes.cc |
| index d9f2df16e615c53eff63ef0c68a131f57344ed50..50c90f8ff512d36684bd6409da302d5d51642902 100644 |
| --- a/runtime/vm/scopes.cc |
| +++ b/runtime/vm/scopes.cc |
| @@ -602,6 +602,25 @@ 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()) { |
|
srdjan
2014/08/20 17:50:06
Please add parentheses.
Michael Lippautz (Google)
2014/08/20 20:56:07
Done.
|
| + // Don't capture those variables as there scope of use can not be |
|
hausner
2014/08/20 19:47:48
there -> their
I'm not sure what the "scope of us
Michael Lippautz (Google)
2014/08/20 20:56:07
There is no way to interrupt those variable's scop
|
| + // interrupted by await. |
|
srdjan
2014/08/20 17:50:06
s/there/their/ ?
Michael Lippautz (Google)
2014/08/20 20:56:07
Done.
|
| + continue; |
| + } |
| + found = CaptureVariable(VariableAt(i)->name()); |
| + VariableAt(i)->set_is_captured(); |
|
hausner
2014/08/20 19:47:48
Why do you need to set the variable as captured ag
Michael Lippautz (Google)
2014/08/20 20:56:07
CaptureVariable() conveniently manages regular cap
hausner
2014/08/20 21:42:52
Maybe a one-liner comment might help a future read
Michael Lippautz (Google)
2014/08/21 16:39:14
Done.
|
| + ASSERT(found); |
| + } |
| + if (sibling() != NULL) { sibling()->RecursivelyCaptureAllVariables(); } |
| + if (child() != NULL) { child()->RecursivelyCaptureAllVariables(); } |
| +} |
| + |
| + |
| + |
| RawContextScope* LocalScope::CreateImplicitClosureScope(const Function& func) { |
| static const intptr_t kNumCapturedVars = 1; |