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 library dart2js.resolution.members; | 5 library dart2js.resolution.members; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/names.dart' show Selectors; | 8 import '../common/names.dart' show Selectors; |
9 import '../common/resolution.dart' show Resolution; | 9 import '../common/resolution.dart' show Resolution; |
10 import '../compile_time_constants.dart'; | 10 import '../compile_time_constants.dart'; |
(...skipping 3663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3674 redirectionTarget.computeType(resolution); | 3674 redirectionTarget.computeType(resolution); |
3675 FunctionSignature targetSignature = redirectionTarget.functionSignature; | 3675 FunctionSignature targetSignature = redirectionTarget.functionSignature; |
3676 constructor.computeType(resolution); | 3676 constructor.computeType(resolution); |
3677 FunctionSignature constructorSignature = constructor.functionSignature; | 3677 FunctionSignature constructorSignature = constructor.functionSignature; |
3678 if (!targetSignature.isCompatibleWith(constructorSignature)) { | 3678 if (!targetSignature.isCompatibleWith(constructorSignature)) { |
3679 assert(!isSubtype); | 3679 assert(!isSubtype); |
3680 registry.registerFeature(Feature.THROW_NO_SUCH_METHOD); | 3680 registry.registerFeature(Feature.THROW_NO_SUCH_METHOD); |
3681 isValidAsConstant = false; | 3681 isValidAsConstant = false; |
3682 } | 3682 } |
3683 | 3683 |
3684 registry.registerStaticUse( | 3684 registry.registerStaticUse(new StaticUse.constructorRedirect( |
3685 new StaticUse.constructorRedirect(redirectionTarget)); | 3685 redirectionTarget, |
3686 // TODO(johnniwinther): Register the effective target type as part of the | 3686 redirectionTarget.enclosingClass.thisType |
3687 // static use instead. | 3687 .subst(type.typeArguments, targetClass.typeVariables))); |
3688 registry.registerTypeUse(new TypeUse.instantiation(redirectionTarget | |
3689 .enclosingClass.thisType | |
3690 .subst(type.typeArguments, targetClass.typeVariables))); | |
3691 if (resolution.commonElements.isSymbolConstructor(enclosingElement)) { | 3688 if (resolution.commonElements.isSymbolConstructor(enclosingElement)) { |
3692 registry.registerFeature(Feature.SYMBOL_CONSTRUCTOR); | 3689 registry.registerFeature(Feature.SYMBOL_CONSTRUCTOR); |
3693 } | 3690 } |
3694 if (isValidAsConstant) { | 3691 if (isValidAsConstant) { |
3695 List<String> names = <String>[]; | 3692 List<String> names = <String>[]; |
3696 List<ConstantExpression> arguments = <ConstantExpression>[]; | 3693 List<ConstantExpression> arguments = <ConstantExpression>[]; |
3697 int index = 0; | 3694 int index = 0; |
3698 constructorSignature.forEachParameter((ParameterElement parameter) { | 3695 constructorSignature.forEachParameter((ParameterElement parameter) { |
3699 if (parameter.isNamed) { | 3696 if (parameter.isNamed) { |
3700 String name = parameter.name; | 3697 String name = parameter.name; |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4747 } | 4744 } |
4748 return const NoneResult(); | 4745 return const NoneResult(); |
4749 } | 4746 } |
4750 } | 4747 } |
4751 | 4748 |
4752 /// Looks up [name] in [scope] and unwraps the result. | 4749 /// Looks up [name] in [scope] and unwraps the result. |
4753 Element lookupInScope( | 4750 Element lookupInScope( |
4754 DiagnosticReporter reporter, Node node, Scope scope, String name) { | 4751 DiagnosticReporter reporter, Node node, Scope scope, String name) { |
4755 return Elements.unwrap(scope.lookup(name), reporter, node); | 4752 return Elements.unwrap(scope.lookup(name), reporter, node); |
4756 } | 4753 } |
OLD | NEW |