| 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 Set<Node> get superUses; | 9 Set<Node> get superUses; |
| 10 | 10 |
| (...skipping 3725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3736 } else { | 3736 } else { |
| 3737 compiler.onDeprecatedFeature(formalParameters, 'getter parameters'); | 3737 compiler.onDeprecatedFeature(formalParameters, 'getter parameters'); |
| 3738 } | 3738 } |
| 3739 } | 3739 } |
| 3740 } | 3740 } |
| 3741 LinkBuilder<Element> parametersBuilder = | 3741 LinkBuilder<Element> parametersBuilder = |
| 3742 visitor.analyzeNodes(formalParameters.nodes); | 3742 visitor.analyzeNodes(formalParameters.nodes); |
| 3743 requiredParameterCount = parametersBuilder.length; | 3743 requiredParameterCount = parametersBuilder.length; |
| 3744 parameters = parametersBuilder.toLink(); | 3744 parameters = parametersBuilder.toLink(); |
| 3745 } | 3745 } |
| 3746 DartType returnType = compiler.resolveReturnType(element, returnNode); | 3746 DartType returnType = element.isFactoryConstructor() |
| 3747 ? element.getEnclosingClass().computeType(compiler) |
| 3748 : compiler.resolveReturnType(element, returnNode); |
| 3747 if (element.isSetter() && (requiredParameterCount != 1 || | 3749 if (element.isSetter() && (requiredParameterCount != 1 || |
| 3748 visitor.optionalParameterCount != 0)) { | 3750 visitor.optionalParameterCount != 0)) { |
| 3749 // If there are no formal parameters, we already reported an error above. | 3751 // If there are no formal parameters, we already reported an error above. |
| 3750 if (formalParameters != null) { | 3752 if (formalParameters != null) { |
| 3751 compiler.reportErrorCode(formalParameters, | 3753 compiler.reportErrorCode(formalParameters, |
| 3752 MessageKind.ILLEGAL_SETTER_FORMALS); | 3754 MessageKind.ILLEGAL_SETTER_FORMALS); |
| 3753 } | 3755 } |
| 3754 } | 3756 } |
| 3755 if (element.isGetter() && (requiredParameterCount != 0 | 3757 if (element.isGetter() && (requiredParameterCount != 0 |
| 3756 || visitor.optionalParameterCount != 0)) { | 3758 || visitor.optionalParameterCount != 0)) { |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3926 return e; | 3928 return e; |
| 3927 } | 3929 } |
| 3928 | 3930 |
| 3929 /// Assumed to be called by [resolveRedirectingFactory]. | 3931 /// Assumed to be called by [resolveRedirectingFactory]. |
| 3930 Element visitReturn(Return node) { | 3932 Element visitReturn(Return node) { |
| 3931 Node expression = node.expression; | 3933 Node expression = node.expression; |
| 3932 return finishConstructorReference(visit(expression), | 3934 return finishConstructorReference(visit(expression), |
| 3933 expression, expression); | 3935 expression, expression); |
| 3934 } | 3936 } |
| 3935 } | 3937 } |
| OLD | NEW |