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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/warnings.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/resolution/members.dart
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index d30753dff35e6085cc95390c894ce77d827477dd..f5f10ba0184aab80d3b2c4b11229d2cdf49005f9 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -3038,6 +3038,15 @@ class SignatureResolver extends CommonResolverVisitor<Element> {
parameters = parametersBuilder.toLink();
}
DartType returnType = compiler.resolveReturnType(element, returnNode);
ngeoffray 2012/12/09 20:44:00 This can move line 3050.
+ if (element.isSetter() && (requiredParameterCount != 1 ||
+ visitor.optionalParameterCount != 0)) {
+ // 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
+ if (formalParameters != null) {
+ compiler.reportMessage(compiler.spanFromNode(formalParameters),
+ MessageKind.ILLEGAL_SETTER_FORMALS.error([]),
+ Diagnostic.ERROR);
+ }
+ }
return new FunctionSignature(parameters,
visitor.optionalParameters,
requiredParameterCount,
« 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