| Index: pkg/kernel/lib/transformations/closure/context.dart
|
| diff --git a/pkg/kernel/lib/transformations/closure/context.dart b/pkg/kernel/lib/transformations/closure/context.dart
|
| index 79ceaefde95039f55d449563d65171a32e4e1f4b..3e4ed1790904785fa56979252c480ee6682998b1 100644
|
| --- a/pkg/kernel/lib/transformations/closure/context.dart
|
| +++ b/pkg/kernel/lib/transformations/closure/context.dart
|
| @@ -129,10 +129,11 @@ class LocalContext extends Context {
|
| Accessor get accessor => new VariableAccessor(self, null, TreeNode.noOffset);
|
|
|
| void extend(VariableDeclaration variable, Expression value) {
|
| - // Increase index by 1, because the parent occupies item 0, and all other
|
| - // variables are therefore shifted by 1.
|
| + // Increase index by 2, because the type arguments vector occupies position
|
| + // 0, the parent occupies position 1, and all other variables are therefore
|
| + // shifted by 2.
|
| VectorSet initializer =
|
| - new VectorSet(expression, variables.length + 1, value);
|
| + new VectorSet(expression, variables.length + 2, value);
|
| value.parent = initializer;
|
|
|
| converter.rewriter.insertExtendContext(initializer);
|
| @@ -150,21 +151,23 @@ class LocalContext extends Context {
|
|
|
| Expression lookup(VariableDeclaration variable) {
|
| var index = variables.indexOf(variable);
|
| - // Increase index by 1 in case of success, because the parent occupies
|
| - // item 0, and all other variables are therefore shifted by 1.
|
| + // Increase index by 2 in case of success, because the type arguments vector
|
| + // occupies position 0, the parent occupies position 1, and all other
|
| + // variables are therefore shifted by 2.
|
| return index == -1
|
| ? parent.lookup(variable)
|
| - : new VectorGet(expression, index + 1);
|
| + : new VectorGet(expression, index + 2);
|
| }
|
|
|
| Expression assign(VariableDeclaration variable, Expression value,
|
| {bool voidContext: false}) {
|
| var index = variables.indexOf(variable);
|
| - // Increase index by 1 in case of success, because the parent occupies
|
| - // item 0, and all other variables are therefore shifted by 1.
|
| + // Increase index by 2 in case of success, because the type arguments vector
|
| + // occupies position 0, the parent occupies position 1, and all other
|
| + // variables are therefore shifted by 2.
|
| return index == -1
|
| ? parent.assign(variable, value, voidContext: voidContext)
|
| - : new VectorSet(expression, index + 1, value);
|
| + : new VectorSet(expression, index + 2, value);
|
| }
|
|
|
| Context toNestedContext([Accessor accessor]) {
|
| @@ -210,12 +213,13 @@ class NestedContext extends Context {
|
| for (var variables in variabless) {
|
| var index = variables.indexOf(variable);
|
| if (index != -1) {
|
| - // Increase index by 1, because the parent occupies item 0, and all
|
| - // other variables are therefore shifted by 1.
|
| - return new VectorGet(context, index + 1);
|
| + // Increase index by 2 in case of success, because the type arguments
|
| + // vector occupies position 0, the parent occupies item 1, and all other
|
| + // variables are therefore shifted by 2.
|
| + return new VectorGet(context, index + 2);
|
| }
|
| - // Item 0 of a context always points to its parent.
|
| - context = new VectorGet(context, 0);
|
| + // Item 1 of a context always points to its parent.
|
| + context = new VectorGet(context, 1);
|
| }
|
| throw 'Unbound NestedContext.lookup($variable)';
|
| }
|
| @@ -226,12 +230,13 @@ class NestedContext extends Context {
|
| for (List<VariableDeclaration> variables in variabless) {
|
| var index = variables.indexOf(variable);
|
| if (index != -1) {
|
| - // Increase index by 1, because the parent occupies item 0, and all
|
| - // other variables are therefore shifted by 1.
|
| - return new VectorSet(context, index + 1, value);
|
| + // Increase index by 2 in case of success, because the type arguments
|
| + // vector occupies position 0, the parent occupies item 1, and all other
|
| + // variables are therefore shifted by 2.
|
| + return new VectorSet(context, index + 2, value);
|
| }
|
| - // Item 0 of a context always points to its parent.
|
| - context = new VectorGet(context, 0);
|
| + // Item 1 of a context always points to its parent.
|
| + context = new VectorGet(context, 1);
|
| }
|
| throw 'Unbound NestedContext.lookup($variable)';
|
| }
|
|
|