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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 joinFor(enqueuer).instantiatedClasses.add(classElement); | 73 joinFor(enqueuer).instantiatedClasses.add(classElement); |
74 } | 74 } |
75 | 75 |
76 void registerTypeLiteral(Element element, Enqueuer enqueuer) { | 76 void registerTypeLiteral(DartType type, Enqueuer enqueuer) { |
77 // In codegen we see the TypeConstants instead. | 77 // In codegen we see the TypeConstants instead. |
78 if (!enqueuer.isResolutionQueue) return; | 78 if (!enqueuer.isResolutionQueue) return; |
79 | 79 |
80 if (element.isClass) { | 80 if (type.isInterfaceType) { |
81 // TODO(sra): If we had a flow query from the type literal expression to | 81 // TODO(sra): If we had a flow query from the type literal expression to |
82 // the Type argument of the metadata lookup, we could tell if this type | 82 // the Type argument of the metadata lookup, we could tell if this type |
83 // literal is really a demand for the metadata. | 83 // literal is really a demand for the metadata. |
84 resolutionJoin.selectedClasses.add(element); | 84 resolutionJoin.selectedClasses.add(type.element); |
85 } else { | 85 } else if (type.isTypeVariable) { |
86 // This is a type parameter of a parameterized class. | 86 // This is a type parameter of a parameterized class. |
87 // TODO(sra): Is there a way to determine which types are bound to the | 87 // TODO(sra): Is there a way to determine which types are bound to the |
88 // parameter? | 88 // parameter? |
89 resolutionJoin.allClassesSelected = true; | 89 resolutionJoin.allClassesSelected = true; |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 void registerTypeConstant(Element element, Enqueuer enqueuer) { | 93 void registerTypeConstant(Element element, Enqueuer enqueuer) { |
94 assert(element.isClass); | 94 assert(element.isClass); |
95 assert(!enqueuer.isResolutionQueue); | 95 assert(!enqueuer.isResolutionQueue); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 result.add(member); | 192 result.add(member); |
193 } | 193 } |
194 } | 194 } |
195 } | 195 } |
196 classElement.forEachMember(selectGenerativeConstructors, | 196 classElement.forEachMember(selectGenerativeConstructors, |
197 includeBackendMembers: false, | 197 includeBackendMembers: false, |
198 includeSuperAndInjectedMembers: false); | 198 includeSuperAndInjectedMembers: false); |
199 return result; | 199 return result; |
200 } | 200 } |
201 } | 201 } |
OLD | NEW |