Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Unified Diff: sdk/lib/_internal/compiler/implementation/js_emitter/class_emitter.dart

Issue 252693003: Allow a closure to be torn off from itself via .call. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/js_emitter/class_emitter.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_emitter/class_emitter.dart b/sdk/lib/_internal/compiler/implementation/js_emitter/class_emitter.dart
index 6f19edbabfb30fca42b91aafa3009a93424c6f80..af06202c35071606fce8335828ee17863471d572 100644
--- a/sdk/lib/_internal/compiler/implementation/js_emitter/class_emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_emitter/class_emitter.dart
@@ -47,6 +47,14 @@ class ClassEmitter extends CodeEmitterHelper {
additionalProperties.forEach(builder.addProperty);
}
+ if (classElement == compiler.closureClass) {
+ // We add a special getter here to allow for tearing off a closure form
karlklose 2014/04/28 07:04:23 'form' -> 'from'.
+ // itself.
+ String name = namer.safeName(Compiler.CALL_OPERATOR_NAME);
+ jsAst.Fun function = js('function() { return this; }');
+ builder.addProperty(namer.getterNameFromAccessorName(name), function);
+ }
+
emitTypeVariableReaders(classElement, builder);
emitClassBuilderWithReflectionData(

Powered by Google App Engine
This is Rietveld 408576698