| 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 Element get currentElement; | 8 Element get currentElement; |
| 9 Setlet<Node> get superUses; | 9 Setlet<Node> get superUses; |
| 10 | 10 |
| (...skipping 3030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3041 // [constructor] might be the implementation element | 3041 // [constructor] might be the implementation element |
| 3042 // and only declaration elements may be registered. | 3042 // and only declaration elements may be registered. |
| 3043 world.registerStaticUse(constructor.declaration); | 3043 world.registerStaticUse(constructor.declaration); |
| 3044 ClassElement cls = constructor.getEnclosingClass(); | 3044 ClassElement cls = constructor.getEnclosingClass(); |
| 3045 InterfaceType type = mapping.getType(node); | 3045 InterfaceType type = mapping.getType(node); |
| 3046 if (node.isConst() && type.containsTypeVariables) { | 3046 if (node.isConst() && type.containsTypeVariables) { |
| 3047 compiler.reportError(node.send.selector, | 3047 compiler.reportError(node.send.selector, |
| 3048 MessageKind.TYPE_VARIABLE_IN_CONSTANT); | 3048 MessageKind.TYPE_VARIABLE_IN_CONSTANT); |
| 3049 } | 3049 } |
| 3050 world.registerInstantiatedType(type, mapping); | 3050 world.registerInstantiatedType(type, mapping); |
| 3051 if (constructor.isFactoryConstructor() && !type.typeArguments.isEmpty) { | 3051 compiler.backend.registerRequiredType(type, enclosingElement); |
| 3052 world.registerFactoryWithTypeArguments(mapping); | |
| 3053 } | |
| 3054 if (constructor.isGenerativeConstructor() && cls.isAbstract) { | 3052 if (constructor.isGenerativeConstructor() && cls.isAbstract) { |
| 3055 warning(node, MessageKind.ABSTRACT_CLASS_INSTANTIATION); | 3053 warning(node, MessageKind.ABSTRACT_CLASS_INSTANTIATION); |
| 3056 compiler.backend.registerAbstractClassInstantiation(mapping); | 3054 compiler.backend.registerAbstractClassInstantiation(mapping); |
| 3057 } | 3055 } |
| 3058 | 3056 |
| 3059 if (isSymbolConstructor) { | 3057 if (isSymbolConstructor) { |
| 3060 if (node.isConst()) { | 3058 if (node.isConst()) { |
| 3061 Node argumentNode = node.send.arguments.head; | 3059 Node argumentNode = node.send.arguments.head; |
| 3062 Constant name = compiler.constantHandler.compileNodeWithDefinitions( | 3060 Constant name = compiler.constantHandler.compileNodeWithDefinitions( |
| 3063 argumentNode, mapping, isConst: true); | 3061 argumentNode, mapping, isConst: true); |
| (...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4770 return finishConstructorReference(visit(expression), | 4768 return finishConstructorReference(visit(expression), |
| 4771 expression, expression); | 4769 expression, expression); |
| 4772 } | 4770 } |
| 4773 } | 4771 } |
| 4774 | 4772 |
| 4775 /// Looks up [name] in [scope] and unwraps the result. | 4773 /// Looks up [name] in [scope] and unwraps the result. |
| 4776 Element lookupInScope(Compiler compiler, Node node, | 4774 Element lookupInScope(Compiler compiler, Node node, |
| 4777 Scope scope, String name) { | 4775 Scope scope, String name) { |
| 4778 return Elements.unwrap(scope.lookup(name), compiler, node); | 4776 return Elements.unwrap(scope.lookup(name), compiler, node); |
| 4779 } | 4777 } |
| OLD | NEW |