| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 element, 'Expected a ClassElement or a LibraryElement.'); | 383 element, 'Expected a ClassElement or a LibraryElement.'); |
| 384 } | 384 } |
| 385 | 385 |
| 386 // If the class is never instantiated we still need to set it up for | 386 // If the class is never instantiated we still need to set it up for |
| 387 // inheritance purposes, but we can simplify its JavaScript constructor. | 387 // inheritance purposes, but we can simplify its JavaScript constructor. |
| 388 bool isInstantiated = | 388 bool isInstantiated = |
| 389 compiler.codegenWorld.directlyInstantiatedClasses.contains(element); | 389 compiler.codegenWorld.directlyInstantiatedClasses.contains(element); |
| 390 | 390 |
| 391 void visitField(Element holder, FieldElement field) { | 391 void visitField(Element holder, FieldElement field) { |
| 392 assert(invariant(element, field.isDeclaration)); | 392 assert(invariant(element, field.isDeclaration)); |
| 393 String name = field.name; | |
| 394 | 393 |
| 395 // Keep track of whether or not we're dealing with a field mixin | 394 // Keep track of whether or not we're dealing with a field mixin |
| 396 // into a native class. | 395 // into a native class. |
| 397 bool isMixinNativeField = | 396 bool isMixinNativeField = |
| 398 isClass && element.isNative && holder.isMixinApplication; | 397 isClass && element.isNative && holder.isMixinApplication; |
| 399 | 398 |
| 400 // See if we can dynamically create getters and setters. | 399 // See if we can dynamically create getters and setters. |
| 401 // We can only generate getters and setters for [element] since | 400 // We can only generate getters and setters for [element] since |
| 402 // the fields of super classes could be overwritten with getters or | 401 // the fields of super classes could be overwritten with getters or |
| 403 // setters. | 402 // setters. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 ? new Selector.getter(member.name, member.library) | 555 ? new Selector.getter(member.name, member.library) |
| 557 : new Selector.setter(member.name, member.library); | 556 : new Selector.setter(member.name, member.library); |
| 558 String reflectionName = emitter.getReflectionName(selector, name); | 557 String reflectionName = emitter.getReflectionName(selector, name); |
| 559 if (reflectionName != null) { | 558 if (reflectionName != null) { |
| 560 var reflectable = | 559 var reflectable = |
| 561 js(backend.isAccessibleByReflection(member) ? '1' : '0'); | 560 js(backend.isAccessibleByReflection(member) ? '1' : '0'); |
| 562 builder.addProperty('+$reflectionName', reflectable); | 561 builder.addProperty('+$reflectionName', reflectable); |
| 563 } | 562 } |
| 564 } | 563 } |
| 565 } | 564 } |
| OLD | NEW |