OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 | 7 |
8 class OldEmitter implements Emitter { | 8 class OldEmitter implements Emitter { |
9 final Compiler compiler; | 9 final Compiler compiler; |
10 final CodeEmitterTask task; | 10 final CodeEmitterTask task; |
(...skipping 2012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2023 } | 2023 } |
2024 | 2024 |
2025 ClassBuilder getElementDescriptor(Element element) { | 2025 ClassBuilder getElementDescriptor(Element element) { |
2026 Element owner = element.library; | 2026 Element owner = element.library; |
2027 if (!element.isLibrary && !element.isTopLevel && !element.isNative) { | 2027 if (!element.isLibrary && !element.isTopLevel && !element.isNative) { |
2028 // For static (not top level) elements, record their code in a buffer | 2028 // For static (not top level) elements, record their code in a buffer |
2029 // specific to the class. For now, not supported for native classes and | 2029 // specific to the class. For now, not supported for native classes and |
2030 // native elements. | 2030 // native elements. |
2031 ClassElement cls = | 2031 ClassElement cls = |
2032 element.enclosingClassOrCompilationUnit.declaration; | 2032 element.enclosingClassOrCompilationUnit.declaration; |
2033 if (compiler.codegenWorld.directlyInstantiatedClasses.contains(cls) | 2033 if (compiler.codegenWorld.directlyInstantiatedClasses.contains(cls) && |
2034 && !cls.isNative) { | 2034 !cls.isNative && |
| 2035 compiler.deferredLoadTask.outputUnitForElement(element) == |
| 2036 compiler.deferredLoadTask.outputUnitForElement(cls)) { |
2035 owner = cls; | 2037 owner = cls; |
2036 } | 2038 } |
2037 } | 2039 } |
2038 if (owner == null) { | 2040 if (owner == null) { |
2039 compiler.internalError(element, 'Owner is null.'); | 2041 compiler.internalError(element, 'Owner is null.'); |
2040 } | 2042 } |
2041 return elementDescriptors.putIfAbsent( | 2043 return elementDescriptors.putIfAbsent( |
2042 owner, | 2044 owner, |
2043 () => new ClassBuilder(owner, namer)); | 2045 () => new ClassBuilder(owner, namer)); |
2044 } | 2046 } |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2261 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { | 2263 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { |
2262 if (element.isInstanceMember) { | 2264 if (element.isInstanceMember) { |
2263 cachedClassBuilders.remove(element.enclosingClass); | 2265 cachedClassBuilders.remove(element.enclosingClass); |
2264 | 2266 |
2265 nativeEmitter.cachedBuilders.remove(element.enclosingClass); | 2267 nativeEmitter.cachedBuilders.remove(element.enclosingClass); |
2266 | 2268 |
2267 } | 2269 } |
2268 } | 2270 } |
2269 } | 2271 } |
2270 } | 2272 } |
OLD | NEW |