Index: runtime/vm/parser.cc |
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc |
index 80493f29a304f8b34530a57165bf39cecde6d6eb..6af310070ea1e24b478bda2aff4811f1104355cc 100644 |
--- a/runtime/vm/parser.cc |
+++ b/runtime/vm/parser.cc |
@@ -7397,6 +7397,12 @@ void Parser::AddFormalParamsToFunction(const ParamList* params, |
ParamDesc& param_desc = (*params->parameters)[i]; |
func.SetParameterTypeAt(i, *param_desc.type); |
func.SetParameterNameAt(i, *param_desc.name); |
+ if (param_desc.is_field_initializer && !func.IsGenerativeConstructor()) { |
+ // Redirecting constructors are detected later in ParseConstructor. |
+ ReportError(param_desc.name_pos, |
+ "only generative constructors may have " |
+ "initializing formal parameters"); |
+ } |
} |
} |