Index: src/preparser.cc |
diff --git a/src/preparser.cc b/src/preparser.cc |
index 914f1192df651d0a578d9700edb23a03ad9cbdbe..5a6a094f6af52b7ba025e9d4ff9c0450499497f7 100644 |
--- a/src/preparser.cc |
+++ b/src/preparser.cc |
@@ -613,6 +613,7 @@ PreParser::Statement PreParser::ParseReturnStatement(bool* ok) { |
// reporting any errors on it, because of the way errors are |
// reported (underlining). |
Expect(Token::RETURN, CHECK_OK); |
+ function_state_->set_return_location(scanner()->location()); |
// An ECMAScript program is considered syntactically incorrect if it |
// contains a return statement that is not within the body of a |
@@ -624,6 +625,14 @@ PreParser::Statement PreParser::ParseReturnStatement(bool* ok) { |
tok != Token::SEMICOLON && |
tok != Token::RBRACE && |
tok != Token::EOS) { |
+ if (is_strong(language_mode()) && |
+ i::IsConstructor(function_state_->kind())) { |
+ int pos = peek_position(); |
+ ReportMessageAt(Scanner::Location(pos, pos + 1), |
+ "strong_constructor_return_value"); |
+ *ok = false; |
+ return Statement::Default(); |
+ } |
ParseExpression(true, CHECK_OK); |
} |
ExpectSemicolon(CHECK_OK); |