Index: pkg/compiler/lib/src/js_emitter/program_builder.dart |
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder.dart b/pkg/compiler/lib/src/js_emitter/program_builder.dart |
index 7036bb73a526943aa7b76c7b6428ec600e21bedc..e5b40e47677c1287e55b28bbbaa5902f51ae73e3 100644 |
--- a/pkg/compiler/lib/src/js_emitter/program_builder.dart |
+++ b/pkg/compiler/lib/src/js_emitter/program_builder.dart |
@@ -353,6 +353,15 @@ class ProgramBuilder { |
}); |
} |
+ if (element == backend.closureClass) { |
+ // We add a special getter here to allow for tearing off a closure from |
+ // itself. |
+ String name = namer.getterNameFromAccessorName( |
+ namer.getMappedInstanceName(Compiler.CALL_OPERATOR_NAME)); |
+ js.Fun function = js.js('function() { return this; }'); |
+ callStubs.add(_buildStubMethod(name, function)); |
+ } |
+ |
ClassElement implementation = element.implementation; |
// MixinApplications run through the members of their mixin. Here, we are |