Chromium Code Reviews| Index: runtime/vm/parser.cc |
| =================================================================== |
| --- runtime/vm/parser.cc (revision 35870) |
| +++ runtime/vm/parser.cc (working copy) |
| @@ -2818,6 +2818,18 @@ |
| } else if (CurrentToken() == Token::kSEMICOLON) { |
| // Some constructors have no function body. |
| ConsumeToken(); |
| + if (func.is_external()) { |
| + // Body of an external method contains a single throw. |
| + const String& function_name = String::ZoneHandle(func.name()); |
| + current_block_->statements->Add( |
| + ThrowNoSuchMethodError(TokenPos(), |
| + current_class(), |
| + function_name, |
| + NULL, // No arguments. |
| + InvocationMirror::kStatic, |
| + InvocationMirror::kMethod, |
| + NULL)); // No existing function. |
| + } |
| } else { |
| UnexpectedToken(); |
| } |
| @@ -3184,6 +3196,12 @@ |
| &method->params); |
| } |
| + if (method->has_external && method->params.has_field_initializer) { |
| + ErrorMsg(method->name_pos, |
| + "external method '%s' may not have field initializers", |
|
hausner
2014/05/07 23:45:42
The message is a bit misleading. If the external m
|
| + method->name->ToCString()); |
| + } |
| + |
| // Now that we know the parameter list, we can distinguish between the |
| // unary and binary operator -. |
| if (method->has_operator) { |
| @@ -3258,6 +3276,11 @@ |
| if (!method->IsConstructor()) { |
| ErrorMsg("initializers only allowed on constructors"); |
| } |
| + if (method->has_external) { |
| + ErrorMsg(method->name_pos, |
| + "external method '%s' may not have a initializers", |
|
hausner
2014/05/07 23:45:42
If the external method is not a constructor, we sh
|
| + method->name->ToCString()); |
| + } |
| if ((LookaheadToken(1) == Token::kTHIS) && |
| ((LookaheadToken(2) == Token::kLPAREN) || |
| LookaheadToken(4) == Token::kLPAREN)) { |