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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 bool get needsTable => codegenJoin.demanded; | 114 bool get needsTable => codegenJoin.demanded; |
115 | 115 |
116 bool needsClass(ClassElement classElement) => | 116 bool needsClass(ClassElement classElement) => |
117 codegenJoin.activeClasses.contains(classElement); | 117 codegenJoin.activeClasses.contains(classElement); |
118 | 118 |
119 List<Element> constructors(ClassElement classElement) => | 119 List<Element> constructors(ClassElement classElement) => |
120 codegenJoin.computeEscapingConstructors(classElement); | 120 codegenJoin.computeEscapingConstructors(classElement); |
121 } | 121 } |
122 | 122 |
123 | |
124 class CustomElementsAnalysisJoin { | 123 class CustomElementsAnalysisJoin { |
125 final JavaScriptBackend backend; | 124 final JavaScriptBackend backend; |
126 Compiler get compiler => backend.compiler; | 125 Compiler get compiler => backend.compiler; |
127 | 126 |
128 // Classes that are candidates for needing constructors. Classes are moved to | 127 // Classes that are candidates for needing constructors. Classes are moved to |
129 // [activeClasses] when we know they need constructors. | 128 // [activeClasses] when we know they need constructors. |
130 final instantiatedClasses = new Set<ClassElement>(); | 129 final instantiatedClasses = new Set<ClassElement>(); |
131 | 130 |
132 // Classes explicitly named. | 131 // Classes explicitly named. |
133 final selectedClasses = new Set<ClassElement>(); | 132 final selectedClasses = new Set<ClassElement>(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // Ignore constructors that cannot be called with zero arguments. | 192 // Ignore constructors that cannot be called with zero arguments. |
194 ConstructorElement constructor = member; | 193 ConstructorElement constructor = member; |
195 constructor.computeType(compiler.resolution); | 194 constructor.computeType(compiler.resolution); |
196 FunctionSignature parameters = constructor.functionSignature; | 195 FunctionSignature parameters = constructor.functionSignature; |
197 if (parameters.requiredParameterCount == 0) { | 196 if (parameters.requiredParameterCount == 0) { |
198 result.add(member); | 197 result.add(member); |
199 } | 198 } |
200 } | 199 } |
201 } | 200 } |
202 classElement.forEachMember(selectGenerativeConstructors, | 201 classElement.forEachMember(selectGenerativeConstructors, |
203 includeBackendMembers: false, | 202 includeBackendMembers: false, includeSuperAndInjectedMembers: false); |
204 includeSuperAndInjectedMembers: false); | |
205 return result; | 203 return result; |
206 } | 204 } |
207 } | 205 } |
OLD | NEW |