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

Unified Diff: runtime/vm/parser.cc

Issue 269253007: - Fix the external_test.dart as it was relying on outdated (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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 | tests/language/external_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)) {
« no previous file with comments | « no previous file | tests/language/external_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698