| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // for the unimplemented `ClassMirror.reflectedType` is not recognizable. | 60 // for the unimplemented `ClassMirror.reflectedType` is not recognizable. |
| 61 // TODO(12607): Match on [ClassMirror.reflectedType] | 61 // TODO(12607): Match on [ClassMirror.reflectedType] |
| 62 resolutionJoin.allClassesSelected = true; | 62 resolutionJoin.allClassesSelected = true; |
| 63 codegenJoin.allClassesSelected = true; | 63 codegenJoin.allClassesSelected = true; |
| 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.resolution); |
| 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 joinFor(enqueuer).instantiatedClasses.add(classElement); | 74 joinFor(enqueuer).instantiatedClasses.add(classElement); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void registerTypeLiteral(DartType type, Registry registry) { | 77 void registerTypeLiteral(DartType type, Registry registry) { |
| 78 assert(registry.isForResolution); | 78 assert(registry.isForResolution); |
| 79 // In codegen we see the TypeConstants instead. | 79 // In codegen we see the TypeConstants instead. |
| 80 if (!registry.isForResolution) return; | 80 if (!registry.isForResolution) return; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 List<Element> result = <Element>[]; | 184 List<Element> result = <Element>[]; |
| 185 // Only classes that extend native classes have constructors in the table. | 185 // Only classes that extend native classes have constructors in the table. |
| 186 // We could refine this to classes that extend Element, but that would break | 186 // We could refine this to classes that extend Element, but that would break |
| 187 // the tests and there is no sane reason to subclass other native classes. | 187 // the tests and there is no sane reason to subclass other native classes. |
| 188 if (classElement.isNative) return result; | 188 if (classElement.isNative) return result; |
| 189 | 189 |
| 190 selectGenerativeConstructors(ClassElement enclosing, Element member) { | 190 selectGenerativeConstructors(ClassElement enclosing, Element member) { |
| 191 if (member.isGenerativeConstructor) { | 191 if (member.isGenerativeConstructor) { |
| 192 // Ignore constructors that cannot be called with zero arguments. | 192 // Ignore constructors that cannot be called with zero arguments. |
| 193 FunctionElement constructor = member; | 193 FunctionElement constructor = member; |
| 194 constructor.computeType(compiler); | 194 constructor.computeType(compiler.resolution); |
| 195 FunctionSignature parameters = constructor.functionSignature; | 195 FunctionSignature parameters = constructor.functionSignature; |
| 196 if (parameters.requiredParameterCount == 0) { | 196 if (parameters.requiredParameterCount == 0) { |
| 197 result.add(member); | 197 result.add(member); |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 classElement.forEachMember(selectGenerativeConstructors, | 201 classElement.forEachMember(selectGenerativeConstructors, |
| 202 includeBackendMembers: false, | 202 includeBackendMembers: false, |
| 203 includeSuperAndInjectedMembers: false); | 203 includeSuperAndInjectedMembers: false); |
| 204 return result; | 204 return result; |
| 205 } | 205 } |
| 206 } | 206 } |
| OLD | NEW |