| 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 js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Support for Custom Elements. | 8 * Support for Custom Elements. |
| 9 * | 9 * |
| 10 * The support for custom elements the compiler builds a table that maps the | 10 * The support for custom elements the compiler builds a table that maps the |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 64 } |
| 65 | 65 |
| 66 CustomElementsAnalysisJoin joinFor(Enqueuer enqueuer) => | 66 CustomElementsAnalysisJoin joinFor(Enqueuer enqueuer) => |
| 67 enqueuer.isResolutionQueue ? resolutionJoin : codegenJoin; | 67 enqueuer.isResolutionQueue ? resolutionJoin : codegenJoin; |
| 68 | 68 |
| 69 void registerInstantiatedClass(ClassElement classElement, Enqueuer enqueuer) { | 69 void registerInstantiatedClass(ClassElement classElement, Enqueuer enqueuer) { |
| 70 classElement.ensureResolved(compiler); | 70 classElement.ensureResolved(compiler); |
| 71 if (!Elements.isNativeOrExtendsNative(classElement)) return; | 71 if (!Elements.isNativeOrExtendsNative(classElement)) return; |
| 72 if (classElement.isMixinApplication) return; | 72 if (classElement.isMixinApplication) return; |
| 73 if (classElement.isAbstract) return; | 73 if (classElement.isAbstract) return; |
| 74 if (classElement.isJsInterop) return; |
| 74 joinFor(enqueuer).instantiatedClasses.add(classElement); | 75 joinFor(enqueuer).instantiatedClasses.add(classElement); |
| 75 } | 76 } |
| 76 | 77 |
| 77 void registerTypeLiteral(DartType type, Registry registry) { | 78 void registerTypeLiteral(DartType type, Registry registry) { |
| 78 assert(registry.isForResolution); | 79 assert(registry.isForResolution); |
| 79 // In codegen we see the TypeConstants instead. | 80 // In codegen we see the TypeConstants instead. |
| 80 if (!registry.isForResolution) return; | 81 if (!registry.isForResolution) return; |
| 81 | 82 |
| 82 if (type.isInterfaceType) { | 83 if (type.isInterfaceType) { |
| 83 // TODO(sra): If we had a flow query from the type literal expression to | 84 // TODO(sra): If we had a flow query from the type literal expression to |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // ClassesOutput: classes requiring metadata. | 145 // ClassesOutput: classes requiring metadata. |
| 145 final activeClasses = new Set<ClassElement>(); | 146 final activeClasses = new Set<ClassElement>(); |
| 146 | 147 |
| 147 CustomElementsAnalysisJoin(this.backend); | 148 CustomElementsAnalysisJoin(this.backend); |
| 148 | 149 |
| 149 void flush(Enqueuer enqueuer) { | 150 void flush(Enqueuer enqueuer) { |
| 150 if (!demanded) return; | 151 if (!demanded) return; |
| 151 var newActiveClasses = new Set<ClassElement>(); | 152 var newActiveClasses = new Set<ClassElement>(); |
| 152 for (ClassElement classElement in instantiatedClasses) { | 153 for (ClassElement classElement in instantiatedClasses) { |
| 153 bool isNative = classElement.isNative; | 154 bool isNative = classElement.isNative; |
| 155 // JsInterop classes are opaque interfaces without a concrete |
| 156 // implementation. |
| 157 if (classElement.isJsInterop) continue; |
| 154 bool isExtension = | 158 bool isExtension = |
| 155 !isNative && Elements.isNativeOrExtendsNative(classElement); | 159 !isNative && Elements.isNativeOrExtendsNative(classElement); |
| 156 // Generate table entries for native classes that are explicitly named and | 160 // Generate table entries for native classes that are explicitly named and |
| 157 // extensions that fix our criteria. | 161 // extensions that fix our criteria. |
| 158 if ((isNative && selectedClasses.contains(classElement)) || | 162 if ((isNative && selectedClasses.contains(classElement)) || |
| 159 (isExtension && | 163 (isExtension && |
| 160 (allClassesSelected || selectedClasses.contains(classElement)))) { | 164 (allClassesSelected || selectedClasses.contains(classElement)))) { |
| 161 newActiveClasses.add(classElement); | 165 newActiveClasses.add(classElement); |
| 162 Iterable<Element> escapingConstructors = | 166 Iterable<Element> escapingConstructors = |
| 163 computeEscapingConstructors(classElement); | 167 computeEscapingConstructors(classElement); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 result.add(member); | 202 result.add(member); |
| 199 } | 203 } |
| 200 } | 204 } |
| 201 } | 205 } |
| 202 classElement.forEachMember(selectGenerativeConstructors, | 206 classElement.forEachMember(selectGenerativeConstructors, |
| 203 includeBackendMembers: false, | 207 includeBackendMembers: false, |
| 204 includeSuperAndInjectedMembers: false); | 208 includeSuperAndInjectedMembers: false); |
| 205 return result; | 209 return result; |
| 206 } | 210 } |
| 207 } | 211 } |
| OLD | NEW |