OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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; | 5 part of dart2js; |
6 | 6 |
7 typedef ItemCompilationContext ItemCompilationContextCreator(); | 7 typedef ItemCompilationContext ItemCompilationContextCreator(); |
8 | 8 |
9 class EnqueueTask extends CompilerTask { | 9 class EnqueueTask extends CompilerTask { |
10 final ResolutionEnqueuer resolution; | 10 final ResolutionEnqueuer resolution; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 onRegisterInstantiatedClass(cls); | 129 onRegisterInstantiatedClass(cls); |
130 }); | 130 }); |
131 } | 131 } |
132 | 132 |
133 void registerInstantiatedClass(ClassElement cls, TreeElements elements) { | 133 void registerInstantiatedClass(ClassElement cls, TreeElements elements) { |
134 cls.ensureResolved(compiler); | 134 cls.ensureResolved(compiler); |
135 registerInstantiatedType(cls.rawType, elements); | 135 registerInstantiatedType(cls.rawType, elements); |
136 } | 136 } |
137 | 137 |
138 void registerTypeLiteral(Element element, TreeElements elements) { | 138 void registerTypeLiteral(Element element, TreeElements elements) { |
139 assert(isResolutionQueue); | |
139 registerInstantiatedClass(compiler.typeClass, elements); | 140 registerInstantiatedClass(compiler.typeClass, elements); |
140 compiler.backend.registerTypeLiteral(element, this, elements); | 141 compiler.backend.registerTypeLiteral(element, this, elements); |
142 registerEscapingConstructorsOfClass(element); | |
143 } | |
144 | |
145 void registerEscapingConstructorsOfClass(ClassElement classElement) { | |
146 // Web component classes have constructors that are escaped to the host | |
147 // environment. | |
148 classElement.forEachMember( | |
149 (ClassElement enclosingClass, Element member) { | |
150 if (member.isGenerativeConstructor()) { | |
151 // isNativeOrExtendsNative is valid only after resolution. | |
152 if (isResolutionQueue | |
153 || Elements.isNativeOrExtendsNative(classElement)) { | |
154 registerStaticUse(member); | |
ahe
2013/10/03 07:44:49
This means that all constructors of type literals
sra1
2013/10/03 17:00:23
I think that isNativeOrExtendsNative can be made t
| |
155 } | |
156 } | |
157 }, | |
158 includeBackendMembers: false, | |
159 includeSuperAndInjectedMembers: false); | |
141 } | 160 } |
142 | 161 |
143 bool checkNoEnqueuedInvokedInstanceMethods() { | 162 bool checkNoEnqueuedInvokedInstanceMethods() { |
144 task.measure(() { | 163 task.measure(() { |
145 // Run through the classes and see if we need to compile methods. | 164 // Run through the classes and see if we need to compile methods. |
146 for (ClassElement classElement in universe.instantiatedClasses) { | 165 for (ClassElement classElement in universe.instantiatedClasses) { |
147 for (ClassElement currentClass = classElement; | 166 for (ClassElement currentClass = classElement; |
148 currentClass != null; | 167 currentClass != null; |
149 currentClass = currentClass.superclass) { | 168 currentClass = currentClass.superclass) { |
150 processInstantiatedClass(currentClass); | 169 processInstantiatedClass(currentClass); |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
735 } | 754 } |
736 CodegenWorkItem workItem = new CodegenWorkItem( | 755 CodegenWorkItem workItem = new CodegenWorkItem( |
737 element, itemCompilationContextCreator()); | 756 element, itemCompilationContextCreator()); |
738 queue.add(workItem); | 757 queue.add(workItem); |
739 } | 758 } |
740 | 759 |
741 void _logSpecificSummary(log(message)) { | 760 void _logSpecificSummary(log(message)) { |
742 log('Compiled ${generatedCode.length} methods.'); | 761 log('Compiled ${generatedCode.length} methods.'); |
743 } | 762 } |
744 } | 763 } |
OLD | NEW |