| Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
|
| diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
|
| index 11b963494bb240bc832881090e7613cd6fb91fb0..80e18cd8bcbd8cb06b0d78f65dfc3d979cb7eba7 100644
|
| --- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
|
| +++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
|
| @@ -2368,11 +2368,17 @@ class IrBuilder {
|
| SourceInformation sourceInformation) {
|
| List<ir.Primitive> arguments = <ir.Primitive>[];
|
| for (ClosureFieldElement field in classElement.closureFields) {
|
| - // Captured 'this' is not available as a local in the current environment,
|
| - // so treat that specially.
|
| - ir.Primitive value = field.local is ThisLocal
|
| - ? buildThis()
|
| - : environment.lookup(field.local);
|
| + // Captured 'this' and type variables are not always available as locals
|
| + // in the environment, so treat those specially.
|
| + ir.Primitive value;
|
| + if (field.local is ThisLocal) {
|
| + value = buildThis();
|
| + } else if (field.local is TypeVariableLocal) {
|
| + TypeVariableLocal variable = field.local;
|
| + value = buildTypeVariableAccess(variable.typeVariable);
|
| + } else {
|
| + value = environment.lookup(field.local);
|
| + }
|
| arguments.add(value);
|
| }
|
| return addPrimitive(new ir.CreateInstance(
|
|
|