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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart

Issue 866213005: dart2js: Make emitInstanceMember take a Class and not a classElement. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Save file... Created 5 years, 11 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
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/native_emitter.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ClassStubGenerator get _stubGenerator => 9 ClassStubGenerator get _stubGenerator =>
10 new ClassStubGenerator(compiler, namer, backend); 10 new ClassStubGenerator(compiler, namer, backend);
(...skipping 23 matching lines...) Expand all
34 superName = '$superName+$mixinName'; 34 superName = '$superName+$mixinName';
35 emitter.needsMixinSupport = true; 35 emitter.needsMixinSupport = true;
36 } 36 }
37 37
38 ClassBuilder builder = new ClassBuilder(classElement, namer); 38 ClassBuilder builder = new ClassBuilder(classElement, namer);
39 builder.superName = superName; 39 builder.superName = superName;
40 emitConstructorsForCSP(cls); 40 emitConstructorsForCSP(cls);
41 emitFields(cls, builder); 41 emitFields(cls, builder);
42 emitCheckedClassSetters(cls, builder); 42 emitCheckedClassSetters(cls, builder);
43 emitClassGettersSettersForCSP(cls, builder); 43 emitClassGettersSettersForCSP(cls, builder);
44 emitInstanceMembers(classElement, builder, onlyForRti: cls.onlyForRti); 44 emitInstanceMembers(cls, builder);
45 emitCallStubs(cls, builder); 45 emitCallStubs(cls, builder);
46 emitRuntimeTypeInformation(cls, builder); 46 emitRuntimeTypeInformation(cls, builder);
47 if (additionalProperties != null) { 47 if (additionalProperties != null) {
48 additionalProperties.forEach(builder.addProperty); 48 additionalProperties.forEach(builder.addProperty);
49 } 49 }
50 50
51 if (classElement == backend.closureClass) { 51 if (classElement == backend.closureClass) {
52 // We add a special getter here to allow for tearing off a closure from 52 // We add a special getter here to allow for tearing off a closure from
53 // itself. 53 // itself.
54 String name = namer.getMappedInstanceName(Compiler.CALL_OPERATOR_NAME); 54 String name = namer.getMappedInstanceName(Compiler.CALL_OPERATOR_NAME);
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 jsAst.Property property = builder.addProperty(method.name, method.code); 223 jsAst.Property property = builder.addProperty(method.name, method.code);
224 compiler.dumpInfoTask.registerElementAst(method.element, property); 224 compiler.dumpInfoTask.registerElementAst(method.element, property);
225 } 225 }
226 } 226 }
227 227
228 /** 228 /**
229 * Documentation wanted -- johnniwinther 229 * Documentation wanted -- johnniwinther
230 * 230 *
231 * Invariant: [classElement] must be a declaration element. 231 * Invariant: [classElement] must be a declaration element.
232 */ 232 */
233 void emitInstanceMembers(ClassElement classElement, 233 void emitInstanceMembers(Class cls,
234 ClassBuilder builder, 234 ClassBuilder builder) {
235 {bool onlyForRti: false}) { 235 ClassElement classElement = cls.element;
236 assert(invariant(classElement, classElement.isDeclaration)); 236 assert(invariant(classElement, classElement.isDeclaration));
237 237
238 if (onlyForRti || classElement.isMixinApplication) return; 238 if (cls.onlyForRti || cls.isMixinApplication) return;
239 239
240 void visitMember(ClassElement enclosing, Element member) { 240 void visitMember(ClassElement enclosing, Element member) {
241 assert(invariant(classElement, member.isDeclaration)); 241 assert(invariant(classElement, member.isDeclaration));
242 if (member.isInstanceMember) { 242 if (member.isInstanceMember) {
243 emitter.containerBuilder.addMember(member, builder); 243 emitter.containerBuilder.addMember(member, builder);
244 } 244 }
245 } 245 }
246 246
247 classElement.implementation.forEachMember( 247 classElement.implementation.forEachMember(
248 visitMember, 248 visitMember,
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 js.number(index)); 587 js.number(index));
588 } 588 }
589 jsAst.Expression convertRtiToRuntimeType = emitter 589 jsAst.Expression convertRtiToRuntimeType = emitter
590 .staticFunctionAccess(backend.findHelper('convertRtiToRuntimeType')); 590 .staticFunctionAccess(backend.findHelper('convertRtiToRuntimeType'));
591 compiler.dumpInfoTask.registerElementAst(element, 591 compiler.dumpInfoTask.registerElementAst(element,
592 builder.addProperty(name, 592 builder.addProperty(name,
593 js('function () { return #(#) }', 593 js('function () { return #(#) }',
594 [convertRtiToRuntimeType, computeTypeVariable]))); 594 [convertRtiToRuntimeType, computeTypeVariable])));
595 } 595 }
596 } 596 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/native_emitter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698