Chromium Code Reviews| 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 3844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3855 int requiredParameterCount = 0; | 3855 int requiredParameterCount = 0; |
| 3856 if (formalParameters == null) { | 3856 if (formalParameters == null) { |
| 3857 if (!element.isGetter()) { | 3857 if (!element.isGetter()) { |
| 3858 compiler.reportError(element, MessageKind.MISSING_FORMALS); | 3858 compiler.reportError(element, MessageKind.MISSING_FORMALS); |
| 3859 } | 3859 } |
| 3860 } else { | 3860 } else { |
| 3861 if (element.isGetter()) { | 3861 if (element.isGetter()) { |
| 3862 if (!identical(formalParameters.getEndToken().next.stringValue, | 3862 if (!identical(formalParameters.getEndToken().next.stringValue, |
| 3863 // TODO(ahe): Remove the check for native keyword. | 3863 // TODO(ahe): Remove the check for native keyword. |
| 3864 'native')) { | 3864 'native')) { |
| 3865 if (compiler.rejectDeprecatedFeatures && | 3865 trace('$element'); |
|
ahe
2013/08/06 14:25:06
Remove trace.
Johnni Winther
2013/08/07 06:35:17
Done.
| |
| 3866 // TODO(ahe): Remove isPlatformLibrary check. | 3866 compiler.reportError(formalParameters, |
| 3867 !element.getLibrary().isPlatformLibrary) { | 3867 MessageKind.EXTRA_FORMALS); |
| 3868 compiler.reportError(formalParameters, | |
| 3869 MessageKind.EXTRA_FORMALS); | |
| 3870 } else { | |
| 3871 compiler.onDeprecatedFeature(formalParameters, 'getter parameters'); | |
| 3872 } | |
| 3873 } | 3868 } |
| 3874 } | 3869 } |
| 3875 LinkBuilder<Element> parametersBuilder = | 3870 LinkBuilder<Element> parametersBuilder = |
| 3876 visitor.analyzeNodes(formalParameters.nodes); | 3871 visitor.analyzeNodes(formalParameters.nodes); |
| 3877 requiredParameterCount = parametersBuilder.length; | 3872 requiredParameterCount = parametersBuilder.length; |
| 3878 parameters = parametersBuilder.toLink(); | 3873 parameters = parametersBuilder.toLink(); |
| 3879 } | 3874 } |
| 3880 DartType returnType; | 3875 DartType returnType; |
| 3881 if (element.isFactoryConstructor()) { | 3876 if (element.isFactoryConstructor()) { |
| 3882 returnType = element.getEnclosingClass().computeType(compiler); | 3877 returnType = element.getEnclosingClass().computeType(compiler); |
| 3883 // Because there is no type annotation for the return type of | 3878 // Because there is no type annotation for the return type of |
| 3884 // this element, we explicitly add one. | 3879 // this element, we explicitly add one. |
| 3885 if (compiler.enableTypeAssertions) { | 3880 if (compiler.enableTypeAssertions) { |
| 3886 compiler.enqueuer.resolution.registerIsCheck( | 3881 compiler.enqueuer.resolution.registerIsCheck( |
| 3887 returnType, new TreeElementMapping(element)); | 3882 returnType, new TreeElementMapping(element)); |
| 3888 } | 3883 } |
| 3889 } else { | 3884 } else { |
| 3890 returnType = compiler.resolveReturnType(element, returnNode); | 3885 returnType = compiler.resolveReturnType(element, returnNode); |
| 3891 } | 3886 } |
| 3892 | 3887 |
| 3893 if (element.isSetter() && (requiredParameterCount != 1 || | 3888 if (element.isSetter() && (requiredParameterCount != 1 || |
| 3894 visitor.optionalParameterCount != 0)) { | 3889 visitor.optionalParameterCount != 0)) { |
| 3895 // If there are no formal parameters, we already reported an error above. | 3890 // If there are no formal parameters, we already reported an error above. |
| 3896 if (formalParameters != null) { | 3891 if (formalParameters != null) { |
| 3897 compiler.reportError(formalParameters, | 3892 compiler.reportError(formalParameters, |
| 3898 MessageKind.ILLEGAL_SETTER_FORMALS); | 3893 MessageKind.ILLEGAL_SETTER_FORMALS); |
| 3899 } | 3894 } |
| 3900 } | 3895 } |
| 3901 if (element.isGetter() && (requiredParameterCount != 0 | |
| 3902 || visitor.optionalParameterCount != 0)) { | |
| 3903 compiler.reportError(formalParameters, MessageKind.EXTRA_FORMALS); | |
| 3904 } | |
| 3905 return new FunctionSignatureX(parameters, | 3896 return new FunctionSignatureX(parameters, |
| 3906 visitor.optionalParameters, | 3897 visitor.optionalParameters, |
| 3907 requiredParameterCount, | 3898 requiredParameterCount, |
| 3908 visitor.optionalParameterCount, | 3899 visitor.optionalParameterCount, |
| 3909 visitor.optionalParametersAreNamed, | 3900 visitor.optionalParametersAreNamed, |
| 3910 returnType); | 3901 returnType); |
| 3911 } | 3902 } |
| 3912 | 3903 |
| 3913 // TODO(ahe): This is temporary. | 3904 // TODO(ahe): This is temporary. |
| 3914 void resolveExpression(Node node) { | 3905 void resolveExpression(Node node) { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4076 return e; | 4067 return e; |
| 4077 } | 4068 } |
| 4078 | 4069 |
| 4079 /// Assumed to be called by [resolveRedirectingFactory]. | 4070 /// Assumed to be called by [resolveRedirectingFactory]. |
| 4080 Element visitReturn(Return node) { | 4071 Element visitReturn(Return node) { |
| 4081 Node expression = node.expression; | 4072 Node expression = node.expression; |
| 4082 return finishConstructorReference(visit(expression), | 4073 return finishConstructorReference(visit(expression), |
| 4083 expression, expression); | 4074 expression, expression); |
| 4084 } | 4075 } |
| 4085 } | 4076 } |
| OLD | NEW |