| 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 import '../common/backend_api.dart'; | 5 import '../common/backend_api.dart'; |
| 6 import '../common/resolution.dart'; | 6 import '../common/resolution.dart'; |
| 7 import '../common_elements.dart'; | 7 import '../common_elements.dart'; |
| 8 import '../constants/values.dart'; | 8 import '../constants/values.dart'; |
| 9 import '../elements/resolution_types.dart'; | 9 import '../elements/resolution_types.dart'; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 CustomElementsAnalysisJoin(this._backend, this._resolution, | 189 CustomElementsAnalysisJoin(this._backend, this._resolution, |
| 190 this._commonElements, this._backendClasses, this._nativeData, | 190 this._commonElements, this._backendClasses, this._nativeData, |
| 191 {BackendUsageBuilder backendUsageBuilder}) | 191 {BackendUsageBuilder backendUsageBuilder}) |
| 192 : this._backendUsageBuilder = backendUsageBuilder, | 192 : this._backendUsageBuilder = backendUsageBuilder, |
| 193 this.forResolution = backendUsageBuilder != null; | 193 this.forResolution = backendUsageBuilder != null; |
| 194 | 194 |
| 195 WorldImpact flush() { | 195 WorldImpact flush() { |
| 196 if (!demanded) return const WorldImpact(); | 196 if (!demanded) return const WorldImpact(); |
| 197 var newActiveClasses = new Set<ClassElement>(); | 197 var newActiveClasses = new Set<ClassElement>(); |
| 198 for (ClassElement classElement in instantiatedClasses) { | 198 for (ClassElement classElement in instantiatedClasses) { |
| 199 bool isNative = _nativeData.isNative(classElement); | 199 bool isNative = _nativeData.isNativeClass(classElement); |
| 200 bool isExtension = | 200 bool isExtension = |
| 201 !isNative && _nativeData.isNativeOrExtendsNative(classElement); | 201 !isNative && _nativeData.isNativeOrExtendsNative(classElement); |
| 202 // Generate table entries for native classes that are explicitly named and | 202 // Generate table entries for native classes that are explicitly named and |
| 203 // extensions that fix our criteria. | 203 // extensions that fix our criteria. |
| 204 if ((isNative && selectedClasses.contains(classElement)) || | 204 if ((isNative && selectedClasses.contains(classElement)) || |
| 205 (isExtension && | 205 (isExtension && |
| 206 (allClassesSelected || selectedClasses.contains(classElement)))) { | 206 (allClassesSelected || selectedClasses.contains(classElement)))) { |
| 207 newActiveClasses.add(classElement); | 207 newActiveClasses.add(classElement); |
| 208 Iterable<ConstructorElement> escapingConstructors = | 208 Iterable<ConstructorElement> escapingConstructors = |
| 209 computeEscapingConstructors(classElement); | 209 computeEscapingConstructors(classElement); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 233 return _backend.constantSystem | 233 return _backend.constantSystem |
| 234 .createType(_commonElements, _backendClasses, elementType); | 234 .createType(_commonElements, _backendClasses, elementType); |
| 235 } | 235 } |
| 236 | 236 |
| 237 List<ConstructorElement> computeEscapingConstructors( | 237 List<ConstructorElement> computeEscapingConstructors( |
| 238 ClassElement classElement) { | 238 ClassElement classElement) { |
| 239 List<ConstructorElement> result = <ConstructorElement>[]; | 239 List<ConstructorElement> result = <ConstructorElement>[]; |
| 240 // Only classes that extend native classes have constructors in the table. | 240 // Only classes that extend native classes have constructors in the table. |
| 241 // We could refine this to classes that extend Element, but that would break | 241 // We could refine this to classes that extend Element, but that would break |
| 242 // the tests and there is no sane reason to subclass other native classes. | 242 // the tests and there is no sane reason to subclass other native classes. |
| 243 if (_nativeData.isNative(classElement)) return result; | 243 if (_nativeData.isNativeClass(classElement)) return result; |
| 244 | 244 |
| 245 void selectGenerativeConstructors(ClassElement enclosing, Element member) { | 245 void selectGenerativeConstructors(ClassElement enclosing, Element member) { |
| 246 if (member.isGenerativeConstructor) { | 246 if (member.isGenerativeConstructor) { |
| 247 // Ignore constructors that cannot be called with zero arguments. | 247 // Ignore constructors that cannot be called with zero arguments. |
| 248 ConstructorElement constructor = member; | 248 ConstructorElement constructor = member; |
| 249 constructor.computeType(_resolution); | 249 constructor.computeType(_resolution); |
| 250 FunctionSignature parameters = constructor.functionSignature; | 250 FunctionSignature parameters = constructor.functionSignature; |
| 251 if (parameters.requiredParameterCount == 0) { | 251 if (parameters.requiredParameterCount == 0) { |
| 252 result.add(member); | 252 result.add(member); |
| 253 } | 253 } |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 | 256 |
| 257 classElement.forEachMember(selectGenerativeConstructors, | 257 classElement.forEachMember(selectGenerativeConstructors, |
| 258 includeBackendMembers: false, includeSuperAndInjectedMembers: false); | 258 includeBackendMembers: false, includeSuperAndInjectedMembers: false); |
| 259 return result; | 259 return result; |
| 260 } | 260 } |
| 261 } | 261 } |
| OLD | NEW |