| Index: src/parser.cc
|
| diff --git a/src/parser.cc b/src/parser.cc
|
| index b57a545ffe0c6940f3d1fcc6dc6bfc71221081e9..dcf2960e964711ce023202f193ea3027f38aad2a 100644
|
| --- a/src/parser.cc
|
| +++ b/src/parser.cc
|
| @@ -1185,8 +1185,27 @@ void* Parser::ParseStatementList(ZoneList<Statement*>* body, int end_token,
|
| directive_prologue = false;
|
| }
|
|
|
| + Token::Value token = peek();
|
| Scanner::Location token_loc = scanner()->peek_location();
|
| + Scanner::Location old_super_loc = function_state_->super_call_location();
|
| Statement* stat = ParseStatementListItem(CHECK_OK);
|
| + Scanner::Location super_loc = function_state_->super_call_location();
|
| +
|
| + if (is_strong(language_mode()) &&
|
| + i::IsConstructor(function_state_->kind()) &&
|
| + !old_super_loc.IsValid() && super_loc.IsValid() &&
|
| + token != Token::SUPER) {
|
| + // TODO(rossberg): This is more permissive than spec'ed, it allows e.g.
|
| + // super(), 1;
|
| + // super() + "";
|
| + // super() = 0;
|
| + // That should still be safe, though, thanks to left-to-right evaluation.
|
| + // The proper check would be difficult to implement in the preparser.
|
| + ReportMessageAt(super_loc, "strong_super_call_nested");
|
| + *ok = false;
|
| + return NULL;
|
| + }
|
| +
|
| if (stat == NULL || stat->IsEmpty()) {
|
| directive_prologue = false; // End of directive prologue.
|
| continue;
|
| @@ -3918,6 +3937,13 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
|
| if (allow_harmony_scoping() && is_strict(language_mode())) {
|
| CheckConflictingVarDeclarations(scope, CHECK_OK);
|
| }
|
| + if (is_strong(language_mode()) && IsSubclassConstructor(kind)) {
|
| + if (!function_state.super_call_location().IsValid()) {
|
| + ReportMessageAt(function_name_location, "strong_super_call_missing");
|
| + *ok = false;
|
| + return nullptr;
|
| + }
|
| + }
|
| }
|
|
|
| FunctionLiteral* function_literal = factory()->NewFunctionLiteral(
|
|
|