Commit 943dc631 authored by rossberg's avatar rossberg Committed by Commit bot

[strong] Deprecate ellisions

R=marja@chromium.org
BUG=

Review URL: https://codereview.chromium.org/950303002

Cr-Commit-Position: refs/heads/master@{#26820}
parent 95df1bc2
......@@ -161,6 +161,7 @@ var kMessages = {
strict_cannot_assign: ["Cannot assign to read only '", "%0", "' in strict mode"],
strict_poison_pill: ["'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them"],
strict_caller: ["Illegal access to a strict mode caller function."],
strong_ellision: ["Please don't use arrays with holes in strong mode, use maps instead"],
strong_arguments: ["Please don't use 'arguments' in strong mode, use '...args' instead"],
strong_equal: ["Please don't use '==' or '!=' in strong mode, use '===' or '!==' instead"],
strong_delete: ["Please don't use 'delete' in strong mode, use maps or sets instead"],
......
......@@ -2013,6 +2013,11 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseArrayLiteral(
while (peek() != Token::RBRACK) {
ExpressionT elem = this->EmptyExpression();
if (peek() == Token::COMMA) {
if (is_strong(language_mode())) {
ReportMessageAt(scanner()->peek_location(), "strong_ellision");
*ok = false;
return this->EmptyExpression();
}
elem = this->GetLiteralTheHole(peek_position(), factory());
} else {
elem = this->ParseAssignmentExpression(true, CHECK_OK);
......
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --strong-mode
(function NoEllisions() {
assertThrows("'use strong'; [,]", SyntaxError);
assertThrows("'use strong'; [,3]", SyntaxError);
assertThrows("'use strong'; [3,,4]", SyntaxError);
assertTrue(eval("'use strong'; [3,] !== [3,4,]"));
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment