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.full_emitter; | 5 part of dart2js.js_emitter.full_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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 for (Field field in cls.fields) { | 246 for (Field field in cls.fields) { |
247 emitter.containerBuilder.addMemberField(field, builder); | 247 emitter.containerBuilder.addMemberField(field, builder); |
248 } | 248 } |
249 | 249 |
250 for (Method method in cls.methods) { | 250 for (Method method in cls.methods) { |
251 assert(invariant(classElement, method.element.isDeclaration)); | 251 assert(invariant(classElement, method.element.isDeclaration)); |
252 assert(invariant(classElement, method.element.isInstanceMember)); | 252 assert(invariant(classElement, method.element.isInstanceMember)); |
253 emitter.containerBuilder.addMemberMethod(method, builder); | 253 emitter.containerBuilder.addMemberMethod(method, builder); |
254 } | 254 } |
255 | 255 |
256 if (identical(classElement, compiler.objectClass) | 256 if (classElement.isObject && backend.enabledNoSuchMethod) { |
257 && backend.enabledNoSuchMethod) { | |
258 // Emit the noSuchMethod handlers on the Object prototype now, | 257 // Emit the noSuchMethod handlers on the Object prototype now, |
259 // so that the code in the dynamicFunction helper can find | 258 // so that the code in the dynamicFunction helper can find |
260 // them. Note that this helper is invoked before analyzing the | 259 // them. Note that this helper is invoked before analyzing the |
261 // full JS script. | 260 // full JS script. |
262 emitter.nsmEmitter.emitNoSuchMethodHandlers(builder.addProperty); | 261 emitter.nsmEmitter.emitNoSuchMethodHandlers(builder.addProperty); |
263 } | 262 } |
264 } | 263 } |
265 | 264 |
266 /// Emits the members from the model. | 265 /// Emits the members from the model. |
267 void emitRuntimeTypeInformation(Class cls, ClassBuilder builder) { | 266 void emitRuntimeTypeInformation(Class cls, ClassBuilder builder) { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 : new Selector.setter( | 426 : new Selector.setter( |
428 new Name(member.name, member.library, isSetter: true)); | 427 new Name(member.name, member.library, isSetter: true)); |
429 String reflectionName = emitter.getReflectionName(selector, name); | 428 String reflectionName = emitter.getReflectionName(selector, name); |
430 if (reflectionName != null) { | 429 if (reflectionName != null) { |
431 var reflectable = | 430 var reflectable = |
432 js(backend.isAccessibleByReflection(member) ? '1' : '0'); | 431 js(backend.isAccessibleByReflection(member) ? '1' : '0'); |
433 builder.addPropertyByName('+$reflectionName', reflectable); | 432 builder.addPropertyByName('+$reflectionName', reflectable); |
434 } | 433 } |
435 } | 434 } |
436 } | 435 } |
OLD | NEW |