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 resolution; | 5 part of resolution; |
6 | 6 |
7 abstract class TreeElements { | 7 abstract class TreeElements { |
8 AnalyzableElement get analyzedElement; | 8 AnalyzableElement get analyzedElement; |
9 Iterable<Node> get superUses; | 9 Iterable<Node> get superUses; |
10 | 10 |
(...skipping 3182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3193 registry.registerThrowNoSuchMethod(); | 3193 registry.registerThrowNoSuchMethod(); |
3194 } | 3194 } |
3195 | 3195 |
3196 // Register a post process to check for cycles in the redirection chain and | 3196 // Register a post process to check for cycles in the redirection chain and |
3197 // set the actual generative constructor at the end of the chain. | 3197 // set the actual generative constructor at the end of the chain. |
3198 addDeferredAction(constructor, () { | 3198 addDeferredAction(constructor, () { |
3199 compiler.resolver.resolveRedirectionChain(constructor, node); | 3199 compiler.resolver.resolveRedirectionChain(constructor, node); |
3200 }); | 3200 }); |
3201 | 3201 |
3202 registry.registerStaticUse(redirectionTarget); | 3202 registry.registerStaticUse(redirectionTarget); |
| 3203 // TODO(johnniwinther): Register the effective target type instead. |
3203 registry.registerInstantiatedClass( | 3204 registry.registerInstantiatedClass( |
3204 redirectionTarget.enclosingClass.declaration); | 3205 redirectionTarget.enclosingClass.declaration); |
3205 if (isSymbolConstructor) { | 3206 if (isSymbolConstructor) { |
3206 registry.registerSymbolConstructor(); | 3207 registry.registerSymbolConstructor(); |
3207 } | 3208 } |
3208 } | 3209 } |
3209 | 3210 |
3210 visitThrow(Throw node) { | 3211 visitThrow(Throw node) { |
3211 registry.registerThrowExpression(); | 3212 registry.registerThrowExpression(); |
3212 visit(node.expression); | 3213 visit(node.expression); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3290 | 3291 |
3291 // [constructor] might be the implementation element | 3292 // [constructor] might be the implementation element |
3292 // and only declaration elements may be registered. | 3293 // and only declaration elements may be registered. |
3293 registry.registerStaticUse(constructor.declaration); | 3294 registry.registerStaticUse(constructor.declaration); |
3294 ClassElement cls = constructor.enclosingClass; | 3295 ClassElement cls = constructor.enclosingClass; |
3295 InterfaceType type = registry.getType(node); | 3296 InterfaceType type = registry.getType(node); |
3296 if (node.isConst && type.containsTypeVariables) { | 3297 if (node.isConst && type.containsTypeVariables) { |
3297 compiler.reportError(node.send.selector, | 3298 compiler.reportError(node.send.selector, |
3298 MessageKind.TYPE_VARIABLE_IN_CONSTANT); | 3299 MessageKind.TYPE_VARIABLE_IN_CONSTANT); |
3299 } | 3300 } |
| 3301 // TODO(johniwinther): Avoid registration of `type` in face of redirecting |
| 3302 // factory constructors. |
3300 registry.registerInstantiatedType(type); | 3303 registry.registerInstantiatedType(type); |
3301 if (constructor.isFactoryConstructor && !type.typeArguments.isEmpty) { | 3304 if (constructor.isFactoryConstructor && !type.typeArguments.isEmpty) { |
3302 registry.registerFactoryWithTypeArguments(); | 3305 registry.registerFactoryWithTypeArguments(); |
3303 } | 3306 } |
3304 if (constructor.isGenerativeConstructor && cls.isAbstract) { | 3307 if (constructor.isGenerativeConstructor && cls.isAbstract) { |
3305 warning(node, MessageKind.ABSTRACT_CLASS_INSTANTIATION); | 3308 warning(node, MessageKind.ABSTRACT_CLASS_INSTANTIATION); |
3306 registry.registerAbstractClassInstantiation(); | 3309 registry.registerAbstractClassInstantiation(); |
3307 } | 3310 } |
3308 | 3311 |
3309 if (isSymbolConstructor) { | 3312 if (isSymbolConstructor) { |
(...skipping 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4965 } | 4968 } |
4966 | 4969 |
4967 /// The result for the resolution of the `assert` method. | 4970 /// The result for the resolution of the `assert` method. |
4968 class AssertResult implements ResolutionResult { | 4971 class AssertResult implements ResolutionResult { |
4969 const AssertResult(); | 4972 const AssertResult(); |
4970 | 4973 |
4971 Element get element => null; | 4974 Element get element => null; |
4972 | 4975 |
4973 String toString() => 'AssertResult()'; | 4976 String toString() => 'AssertResult()'; |
4974 } | 4977 } |
OLD | NEW |