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

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: Address comments. 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/warnings.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 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 3019 matching lines...) Expand 10 before | Expand all | Expand 10 after
3030 } else { 3030 } else {
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);
ngeoffray 2012/12/09 20:44:00 This can move line 3050.
3041 if (element.isSetter() && (requiredParameterCount != 1 ||
3042 visitor.optionalParameterCount != 0)) {
3043 // If there are no formal parameters, we already reported an error above.
ngeoffray 2012/12/09 20:44:00 Somehow this looks a bit brittle. Could you instea
3044 if (formalParameters != null) {
3045 compiler.reportMessage(compiler.spanFromNode(formalParameters),
3046 MessageKind.ILLEGAL_SETTER_FORMALS.error([]),
3047 Diagnostic.ERROR);
3048 }
3049 }
3041 return new FunctionSignature(parameters, 3050 return new FunctionSignature(parameters,
3042 visitor.optionalParameters, 3051 visitor.optionalParameters,
3043 requiredParameterCount, 3052 requiredParameterCount,
3044 visitor.optionalParameterCount, 3053 visitor.optionalParameterCount,
3045 visitor.optionalParametersAreNamed, 3054 visitor.optionalParametersAreNamed,
3046 returnType); 3055 returnType);
3047 } 3056 }
3048 3057
3049 // TODO(ahe): This is temporary. 3058 // TODO(ahe): This is temporary.
3050 void resolveExpression(Node node) { 3059 void resolveExpression(Node node) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
3210 return e; 3219 return e;
3211 } 3220 }
3212 3221
3213 /// Assumed to be called by [resolveRedirectingFactory]. 3222 /// Assumed to be called by [resolveRedirectingFactory].
3214 Element visitReturn(Return node) { 3223 Element visitReturn(Return node) {
3215 Node expression = node.expression; 3224 Node expression = node.expression;
3216 return finishConstructorReference(visit(expression), 3225 return finishConstructorReference(visit(expression),
3217 expression, expression); 3226 expression, expression);
3218 } 3227 }
3219 } 3228 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698