Index: pkg/compiler/lib/src/ssa/codegen.dart |
diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart |
index ac17c4787e1a39f41c232ca4e4533142e62071ac..75bab2ac4b82d1130034dc473a70a1d32c6c5c3c 100644 |
--- a/pkg/compiler/lib/src/ssa/codegen.dart |
+++ b/pkg/compiler/lib/src/ssa/codegen.dart |
@@ -1816,6 +1816,12 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
List<js.Expression> arguments = visitArguments(node.inputs, start: 0); |
push(new js.New(jsClassReference, arguments), node); |
registerForeignTypes(node); |
+ // We also use ForeignNew to instantiate closure classes that belong to |
+ // function expressions. We have to register their use here, as otherwise |
+ // code for them might not be emitted. |
+ if (node.element.isClosure) { |
+ registry.registerInstantiatedClass(node.element); |
+ } |
if (node.instantiatedTypes == null) { |
return; |
} |