Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 * | 229 * |
| 230 * Invariant: [classElement] must be a declaration element. | 230 * Invariant: [classElement] must be a declaration element. |
| 231 */ | 231 */ |
| 232 void emitInstanceMembers(Class cls, | 232 void emitInstanceMembers(Class cls, |
| 233 ClassBuilder builder) { | 233 ClassBuilder builder) { |
| 234 ClassElement classElement = cls.element; | 234 ClassElement classElement = cls.element; |
| 235 assert(invariant(classElement, classElement.isDeclaration)); | 235 assert(invariant(classElement, classElement.isDeclaration)); |
| 236 | 236 |
| 237 if (cls.onlyForRti || cls.isMixinApplication) return; | 237 if (cls.onlyForRti || cls.isMixinApplication) return; |
| 238 | 238 |
| 239 void visitMember(ClassElement enclosing, Element member) { | 239 // TODO(herhut): This is a no-op. Should it be removed? |
|
floitsch
2015/01/28 16:10:39
In a different CL.
herhut
2015/01/29 10:24:21
Acknowledged.
| |
| 240 assert(invariant(classElement, member.isDeclaration)); | 240 for (Field field in cls.fields) { |
| 241 if (member.isInstanceMember) { | 241 emitter.containerBuilder.addMemberField(field, builder); |
| 242 emitter.containerBuilder.addMember(member, builder); | |
| 243 } | |
| 244 } | 242 } |
| 245 | 243 |
| 246 classElement.implementation.forEachMember( | 244 for (Method method in cls.methods) { |
| 247 visitMember, | 245 assert(invariant(classElement, method.element.isDeclaration)); |
| 248 includeBackendMembers: true); | 246 assert(invariant(classElement, method.element.isInstanceMember)); |
| 247 emitter.containerBuilder.addMemberMethod(method, builder); | |
| 248 } | |
| 249 | 249 |
| 250 if (identical(classElement, compiler.objectClass) | 250 if (identical(classElement, compiler.objectClass) |
| 251 && compiler.enabledNoSuchMethod) { | 251 && compiler.enabledNoSuchMethod) { |
| 252 // Emit the noSuchMethod handlers on the Object prototype now, | 252 // Emit the noSuchMethod handlers on the Object prototype now, |
| 253 // so that the code in the dynamicFunction helper can find | 253 // so that the code in the dynamicFunction helper can find |
| 254 // them. Note that this helper is invoked before analyzing the | 254 // them. Note that this helper is invoked before analyzing the |
| 255 // full JS script. | 255 // full JS script. |
| 256 if (!emitter.nativeEmitter.handleNoSuchMethod) { | 256 if (!emitter.nativeEmitter.handleNoSuchMethod) { |
| 257 emitter.nsmEmitter.emitNoSuchMethodHandlers(builder.addProperty); | 257 emitter.nsmEmitter.emitNoSuchMethodHandlers(builder.addProperty); |
| 258 } | 258 } |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 586 js.number(index)); | 586 js.number(index)); |
| 587 } | 587 } |
| 588 jsAst.Expression convertRtiToRuntimeType = emitter | 588 jsAst.Expression convertRtiToRuntimeType = emitter |
| 589 .staticFunctionAccess(backend.findHelper('convertRtiToRuntimeType')); | 589 .staticFunctionAccess(backend.findHelper('convertRtiToRuntimeType')); |
| 590 compiler.dumpInfoTask.registerElementAst(element, | 590 compiler.dumpInfoTask.registerElementAst(element, |
| 591 builder.addProperty(name, | 591 builder.addProperty(name, |
| 592 js('function () { return #(#) }', | 592 js('function () { return #(#) }', |
| 593 [convertRtiToRuntimeType, computeTypeVariable]))); | 593 [convertRtiToRuntimeType, computeTypeVariable]))); |
| 594 } | 594 } |
| 595 } | 595 } |
| OLD | NEW |