Commit dd24cc33 authored by littledan's avatar littledan Committed by Commit bot

Check for let in lexically bound names for short object literals

An identifier may be parsed in an object literal like {let}, but
this was previously left out of lexical name checking. This patch
adds that check to prohibit code like
  let {let} = {let: 1}

BUG=v8:4403
LOG=N
R=adamk

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

Cr-Commit-Position: refs/heads/master@{#31278}
parent ad1e0570
......@@ -2649,6 +2649,10 @@ ParserBase<Traits>::ParsePropertyDefinition(
scanner()->FindSymbol(classifier->duplicate_finder(), 1) != 0) {
classifier->RecordDuplicateFormalParameterError(scanner()->location());
}
if (name_token == Token::LET) {
classifier->RecordLetPatternError(
scanner()->location(), MessageTemplate::kLetInLexicalBinding);
}
ExpressionT lhs = this->ExpressionFromIdentifier(
name, next_beg_pos, next_end_pos, scope_, factory());
......
// 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: --harmony-sloppy --harmony-sloppy-let --harmony-destructuring
let {let};
*%(basename)s:7: SyntaxError: let is disallowed as a lexically bound name
let {let};
^^^
SyntaxError: let is disallowed as a lexically bound name
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