| Index: runtime/vm/parser.cc
|
| diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
|
| index 1e92e4c0d4553a731497ff796724b1ebdf350dee..539acedc006c566006958c1d9197f82b1519facd 100644
|
| --- a/runtime/vm/parser.cc
|
| +++ b/runtime/vm/parser.cc
|
| @@ -1679,6 +1679,13 @@ void Parser::CheckDuplicateFieldInit(intptr_t init_pos,
|
| }
|
|
|
|
|
| +void Parser::CheckNoInitializersInExternal() {
|
| + if (CurrentToken() == Token::kCOLON) {
|
| + ErrorMsg("initializer lists invalid for 'external' constructors");
|
| + }
|
| +}
|
| +
|
| +
|
| void Parser::ParseInitializers(const Class& cls,
|
| LocalVariable* receiver,
|
| GrowableArray<Field*>* initialized_fields) {
|
| @@ -1914,7 +1921,12 @@ SequenceNode* Parser::ParseConstructor(const Function& func,
|
| }
|
|
|
| // Now parse the explicit initializer list or constructor redirection.
|
| - ParseInitializers(cls, receiver, &initialized_fields);
|
| + if (!func.is_external()) {
|
| + ParseInitializers(cls, receiver, &initialized_fields);
|
| + } else {
|
| + // 'external' constructors should have no initializers.
|
| + CheckNoInitializersInExternal();
|
| + }
|
|
|
| SequenceNode* init_statements = CloseBlock();
|
| if (init_statements->length() > 0) {
|
|
|