Index: runtime/vm/scopes.cc |
diff --git a/runtime/vm/scopes.cc b/runtime/vm/scopes.cc |
index dcae0be58f60b1df800516781d758d4e506d90f6..a404f31fd5b95de77de81f3a4ccfff5a5da77364 100644 |
--- a/runtime/vm/scopes.cc |
+++ b/runtime/vm/scopes.cc |
@@ -194,6 +194,7 @@ void LocalScope::AllocateContextVariable(LocalVariable* variable, |
int LocalScope::AllocateVariables(int first_parameter_index, |
int num_parameters, |
+ int type_args_slot, |
int first_frame_index, |
LocalScope* context_owner, |
bool* found_captured_variables) { |
@@ -234,6 +235,12 @@ int LocalScope::AllocateVariables(int first_parameter_index, |
if (variable->is_captured()) { |
AllocateContextVariable(variable, &context_owner); |
*found_captured_variables = true; |
+ if ((pos == num_parameters) && (type_args_slot == 1)) { |
Vyacheslav Egorov (Google)
2017/06/20 15:21:41
can this instead be:
if (variable->name().raw() =
regis
2017/06/21 04:39:04
Good point. Thanks. I never revisited this code af
|
+ ASSERT(variable->name().Equals(Symbols::FunctionTypeArgumentsVar())); |
+ // A captured type args variable has a slot allocated in the frame and |
+ // one in the context, where it gets copied to. |
+ frame_index--; |
+ } |
} else { |
variable->set_index(frame_index--); |
} |
@@ -243,11 +250,12 @@ int LocalScope::AllocateVariables(int first_parameter_index, |
int min_frame_index = frame_index; // Frame index decreases with allocations. |
LocalScope* child = this->child(); |
while (child != NULL) { |
- int const dummy_parameter_index = 0; // Ignored, since no parameters. |
- int const num_parameters_in_child = 0; // No parameters in children scopes. |
+ const int dummy_parameter_index = 0; // Ignored, since no parameters. |
+ const int num_parameters_in_child = 0; // No parameters in children scopes. |
+ const int no_type_args_slot = 0; // No type args slot in children scopes. |
int child_frame_index = child->AllocateVariables( |
- dummy_parameter_index, num_parameters_in_child, frame_index, |
- context_owner, found_captured_variables); |
+ dummy_parameter_index, num_parameters_in_child, no_type_args_slot, |
+ frame_index, context_owner, found_captured_variables); |
if (child_frame_index < min_frame_index) { |
min_frame_index = child_frame_index; |
} |