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

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

Issue 18523002: Report error when using initializing formals in redirecting constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 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 cd0cb86ca642233ee7e1e77b81201ec5ed3408f9..c45ecd2d4c2a23e9b0887c5927061b07f9f83de5 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -1243,6 +1243,15 @@ class InitializerResolver {
if (!initializers.tail.isEmpty) {
error(call, MessageKind.REDIRECTING_CONSTRUCTOR_HAS_INITIALIZER);
}
+ // Check that there are no field initializing parameters.
+ Compiler compiler = visitor.compiler;
+ FunctionSignature signature = constructor.computeSignature(compiler);
+ signature.forEachParameter((Element parameter) {
+ if (parameter.isFieldParameter()) {
+ Node node = parameter.parseNode(compiler);
+ error(node, MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED);
+ }
+ });
return resolveSuperOrThisForSend(constructor, functionNode, call);
} else {
visitor.error(call, MessageKind.CONSTRUCTOR_CALL_EXPECTED);
@@ -3763,7 +3772,7 @@ class SignatureResolver extends CommonResolverVisitor<Element> {
error(node, MessageKind.INVALID_PARAMETER);
} else if (!identical(enclosingElement.kind,
ElementKind.GENERATIVE_CONSTRUCTOR)) {
- error(node, MessageKind.FIELD_PARAMETER_NOT_ALLOWED);
+ error(node, MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED);
} else {
SourceString name = getParameterName(node);
Element fieldElement = currentClass.lookupLocalMember(name);
« 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