Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 21013004: Remove support for getters with parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/compiler/dart2js/deprecated_features_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 } 1508 }
1509 } else if (element.isTypedef()) { 1509 } else if (element.isTypedef()) {
1510 TypedefElement typdef = element; 1510 TypedefElement typdef = element;
1511 // TODO(ahe): Should be [ensureResolved]. 1511 // TODO(ahe): Should be [ensureResolved].
1512 compiler.resolveTypedef(typdef); 1512 compiler.resolveTypedef(typdef);
1513 var arguments = new LinkBuilder<DartType>(); 1513 var arguments = new LinkBuilder<DartType>();
1514 bool hasTypeArgumentMismatch = resolveTypeArguments( 1514 bool hasTypeArgumentMismatch = resolveTypeArguments(
1515 visitor, node, typdef.typeVariables, arguments); 1515 visitor, node, typdef.typeVariables, arguments);
1516 if (hasTypeArgumentMismatch) { 1516 if (hasTypeArgumentMismatch) {
1517 type = new BadTypedefType(typdef, 1517 type = new BadTypedefType(typdef,
1518 new TypedefType.forUserProvidedBadType(typdef, 1518 new TypedefType.forUserProvidedBadType(typdef,
1519 arguments.toLink())); 1519 arguments.toLink()));
1520 } else { 1520 } else {
1521 if (arguments.isEmpty) { 1521 if (arguments.isEmpty) {
1522 type = typdef.rawType; 1522 type = typdef.rawType;
1523 } else { 1523 } else {
1524 type = new TypedefType(typdef, arguments.toLink()); 1524 type = new TypedefType(typdef, arguments.toLink());
1525 } 1525 }
1526 } 1526 }
1527 } else if (element.isTypeVariable()) { 1527 } else if (element.isTypeVariable()) {
1528 Element outer = 1528 Element outer =
(...skipping 2318 matching lines...) Expand 10 before | Expand all | Expand 10 after
3847 int requiredParameterCount = 0; 3847 int requiredParameterCount = 0;
3848 if (formalParameters == null) { 3848 if (formalParameters == null) {
3849 if (!element.isGetter()) { 3849 if (!element.isGetter()) {
3850 compiler.reportError(element, MessageKind.MISSING_FORMALS); 3850 compiler.reportError(element, MessageKind.MISSING_FORMALS);
3851 } 3851 }
3852 } else { 3852 } else {
3853 if (element.isGetter()) { 3853 if (element.isGetter()) {
3854 if (!identical(formalParameters.getEndToken().next.stringValue, 3854 if (!identical(formalParameters.getEndToken().next.stringValue,
3855 // TODO(ahe): Remove the check for native keyword. 3855 // TODO(ahe): Remove the check for native keyword.
3856 'native')) { 3856 'native')) {
3857 if (compiler.rejectDeprecatedFeatures && 3857 compiler.reportError(formalParameters,
3858 // TODO(ahe): Remove isPlatformLibrary check. 3858 MessageKind.EXTRA_FORMALS);
3859 !element.getLibrary().isPlatformLibrary) {
3860 compiler.reportError(formalParameters,
3861 MessageKind.EXTRA_FORMALS);
3862 } else {
3863 compiler.onDeprecatedFeature(formalParameters, 'getter parameters');
3864 }
3865 } 3859 }
3866 } 3860 }
3867 LinkBuilder<Element> parametersBuilder = 3861 LinkBuilder<Element> parametersBuilder =
3868 visitor.analyzeNodes(formalParameters.nodes); 3862 visitor.analyzeNodes(formalParameters.nodes);
3869 requiredParameterCount = parametersBuilder.length; 3863 requiredParameterCount = parametersBuilder.length;
3870 parameters = parametersBuilder.toLink(); 3864 parameters = parametersBuilder.toLink();
3871 } 3865 }
3872 DartType returnType; 3866 DartType returnType;
3873 if (element.isFactoryConstructor()) { 3867 if (element.isFactoryConstructor()) {
3874 returnType = element.getEnclosingClass().computeType(compiler); 3868 returnType = element.getEnclosingClass().computeType(compiler);
3875 // Because there is no type annotation for the return type of 3869 // Because there is no type annotation for the return type of
3876 // this element, we explicitly add one. 3870 // this element, we explicitly add one.
3877 if (compiler.enableTypeAssertions) { 3871 if (compiler.enableTypeAssertions) {
3878 compiler.enqueuer.resolution.registerIsCheck( 3872 compiler.enqueuer.resolution.registerIsCheck(
3879 returnType, new TreeElementMapping(element)); 3873 returnType, new TreeElementMapping(element));
3880 } 3874 }
3881 } else { 3875 } else {
3882 returnType = compiler.resolveReturnType(element, returnNode); 3876 returnType = compiler.resolveReturnType(element, returnNode);
3883 } 3877 }
3884 3878
3885 if (element.isSetter() && (requiredParameterCount != 1 || 3879 if (element.isSetter() && (requiredParameterCount != 1 ||
3886 visitor.optionalParameterCount != 0)) { 3880 visitor.optionalParameterCount != 0)) {
3887 // If there are no formal parameters, we already reported an error above. 3881 // If there are no formal parameters, we already reported an error above.
3888 if (formalParameters != null) { 3882 if (formalParameters != null) {
3889 compiler.reportError(formalParameters, 3883 compiler.reportError(formalParameters,
3890 MessageKind.ILLEGAL_SETTER_FORMALS); 3884 MessageKind.ILLEGAL_SETTER_FORMALS);
3891 } 3885 }
3892 } 3886 }
3893 if (element.isGetter() && (requiredParameterCount != 0
3894 || visitor.optionalParameterCount != 0)) {
3895 compiler.reportError(formalParameters, MessageKind.EXTRA_FORMALS);
3896 }
3897 return new FunctionSignatureX(parameters, 3887 return new FunctionSignatureX(parameters,
3898 visitor.optionalParameters, 3888 visitor.optionalParameters,
3899 requiredParameterCount, 3889 requiredParameterCount,
3900 visitor.optionalParameterCount, 3890 visitor.optionalParameterCount,
3901 visitor.optionalParametersAreNamed, 3891 visitor.optionalParametersAreNamed,
3902 returnType); 3892 returnType);
3903 } 3893 }
3904 3894
3905 // TODO(ahe): This is temporary. 3895 // TODO(ahe): This is temporary.
3906 void resolveExpression(Node node) { 3896 void resolveExpression(Node node) {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
4068 return e; 4058 return e;
4069 } 4059 }
4070 4060
4071 /// Assumed to be called by [resolveRedirectingFactory]. 4061 /// Assumed to be called by [resolveRedirectingFactory].
4072 Element visitReturn(Return node) { 4062 Element visitReturn(Return node) {
4073 Node expression = node.expression; 4063 Node expression = node.expression;
4074 return finishConstructorReference(visit(expression), 4064 return finishConstructorReference(visit(expression),
4075 expression, expression); 4065 expression, expression);
4076 } 4066 }
4077 } 4067 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/deprecated_features_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698