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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 class ClassEmitter extends CodeEmitterHelper { 7 class ClassEmitter extends CodeEmitterHelper {
8 /** 8 /**
9 * Documentation wanted -- johnniwinther 9 * Documentation wanted -- johnniwinther
10 * 10 *
(...skipping 29 matching lines...) Expand all
40 emitClassConstructor(classElement, builder, runtimeName, 40 emitClassConstructor(classElement, builder, runtimeName,
41 onlyForRti: onlyForRti); 41 onlyForRti: onlyForRti);
42 emitFields(classElement, builder, superName, onlyForRti: onlyForRti); 42 emitFields(classElement, builder, superName, onlyForRti: onlyForRti);
43 emitClassGettersSetters(classElement, builder, onlyForRti: onlyForRti); 43 emitClassGettersSetters(classElement, builder, onlyForRti: onlyForRti);
44 emitInstanceMembers(classElement, builder, onlyForRti: onlyForRti); 44 emitInstanceMembers(classElement, builder, onlyForRti: onlyForRti);
45 task.typeTestEmitter.emitIsTests(classElement, builder); 45 task.typeTestEmitter.emitIsTests(classElement, builder);
46 if (additionalProperties != null) { 46 if (additionalProperties != null) {
47 additionalProperties.forEach(builder.addProperty); 47 additionalProperties.forEach(builder.addProperty);
48 } 48 }
49 49
50 if (classElement == compiler.closureClass) {
51 // We add a special getter here to allow for tearing off a closure form
karlklose 2014/04/28 07:04:23 'form' -> 'from'.
52 // itself.
53 String name = namer.safeName(Compiler.CALL_OPERATOR_NAME);
54 jsAst.Fun function = js('function() { return this; }');
55 builder.addProperty(namer.getterNameFromAccessorName(name), function);
56 }
57
50 emitTypeVariableReaders(classElement, builder); 58 emitTypeVariableReaders(classElement, builder);
51 59
52 emitClassBuilderWithReflectionData( 60 emitClassBuilderWithReflectionData(
53 className, classElement, builder, properties); 61 className, classElement, builder, properties);
54 } 62 }
55 63
56 void emitClassConstructor(ClassElement classElement, 64 void emitClassConstructor(ClassElement classElement,
57 ClassBuilder builder, 65 ClassBuilder builder,
58 String runtimeName, 66 String runtimeName,
59 {bool onlyForRti: false}) { 67 {bool onlyForRti: false}) {
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 computeTypeVariable = 620 computeTypeVariable =
613 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index); 621 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index);
614 } 622 }
615 jsAst.Expression convertRtiToRuntimeType = 623 jsAst.Expression convertRtiToRuntimeType =
616 namer.elementAccess(compiler.findHelper('convertRtiToRuntimeType')); 624 namer.elementAccess(compiler.findHelper('convertRtiToRuntimeType'));
617 builder.addProperty(name, 625 builder.addProperty(name,
618 js('function () { return #(#) }', 626 js('function () { return #(#) }',
619 [convertRtiToRuntimeType, computeTypeVariable])); 627 [convertRtiToRuntimeType, computeTypeVariable]));
620 } 628 }
621 } 629 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698