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

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

Issue 11453009: Report a compile-time error when a setter has not exactly one formal parameter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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
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 operator[](Node node); 8 Element operator[](Node node);
9 Selector getSelector(Send send); 9 Selector getSelector(Send send);
10 DartType getType(Node node); 10 DartType getType(Node node);
(...skipping 3020 matching lines...) Expand 10 before | Expand all | Expand 10 after
3031 compiler.onDeprecatedFeature(formalParameters, 'getter parameters'); 3031 compiler.onDeprecatedFeature(formalParameters, 'getter parameters');
3032 } 3032 }
3033 } 3033 }
3034 } 3034 }
3035 LinkBuilder<Element> parametersBuilder = 3035 LinkBuilder<Element> parametersBuilder =
3036 visitor.analyzeNodes(formalParameters.nodes); 3036 visitor.analyzeNodes(formalParameters.nodes);
3037 requiredParameterCount = parametersBuilder.length; 3037 requiredParameterCount = parametersBuilder.length;
3038 parameters = parametersBuilder.toLink(); 3038 parameters = parametersBuilder.toLink();
3039 } 3039 }
3040 DartType returnType = compiler.resolveReturnType(element, returnNode); 3040 DartType returnType = compiler.resolveReturnType(element, returnNode);
3041 if (element.isSetter() && (requiredParameterCount != 1 ||
3042 visitor.optionalParameterCount != 0)) {
3043 compiler.reportMessage(compiler.spanFromElement(element),
ahe 2012/12/05 20:17:06 I think a better location would be: compiler.span
karlklose 2012/12/06 09:13:32 Done.
3044 MessageKind.ILLEGAL_SETTER_FORMALS.error([]),
3045 Diagnostic.ERROR);
3046 }
3041 return new FunctionSignature(parameters, 3047 return new FunctionSignature(parameters,
3042 visitor.optionalParameters, 3048 visitor.optionalParameters,
3043 requiredParameterCount, 3049 requiredParameterCount,
3044 visitor.optionalParameterCount, 3050 visitor.optionalParameterCount,
3045 visitor.optionalParametersAreNamed, 3051 visitor.optionalParametersAreNamed,
3046 returnType); 3052 returnType);
3047 } 3053 }
3048 3054
3049 // TODO(ahe): This is temporary. 3055 // TODO(ahe): This is temporary.
3050 void resolveExpression(Node node) { 3056 void resolveExpression(Node node) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
3210 return e; 3216 return e;
3211 } 3217 }
3212 3218
3213 /// Assumed to be called by [resolveRedirectingFactory]. 3219 /// Assumed to be called by [resolveRedirectingFactory].
3214 Element visitReturn(Return node) { 3220 Element visitReturn(Return node) {
3215 Node expression = node.expression; 3221 Node expression = node.expression;
3216 return finishConstructorReference(visit(expression), 3222 return finishConstructorReference(visit(expression),
3217 expression, expression); 3223 expression, expression);
3218 } 3224 }
3219 } 3225 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698