Commit f419eca9 authored by Daniel Ehrenberg's avatar Daniel Ehrenberg Committed by Commit Bot

Revert "[parser] allow ASI when "await" or "yield" follows "let""

This reverts commit 96698b55.

Reason for revert: This patch was correct when it landed, but later,
the spec was changed to V8's old behavior in
https://github.com/tc39/ecma262/pull/885 .

Original change's description:
> [parser] allow ASI when "await" or "yield" follows "let"
> 
> Per https://github.com/tc39/test262/pull/956, André believes that ASI
> should be permitted in these situations.
> 
> BUG=
> R=​marja@chromium.org, adamk@chromium.org, littledan@chromium.org
> 
> Change-Id: I5602d8a507576607750ffa9e873e1bfa53dd3523
> Reviewed-on: https://chromium-review.googlesource.com/472568
> Reviewed-by: Marja Hölttä <marja@chromium.org>
> Commit-Queue: Caitlin Potter <caitp@igalia.com>
> Cr-Commit-Position: refs/heads/master@{#44585}

TBR=adamk@chromium.org,marja@chromium.org,littledan@chromium.org,caitp@igalia.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I2c5bf709867da539ccd4cd82f3be98c8a0301f31
Reviewed-on: https://chromium-review.googlesource.com/553617Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Daniel Ehrenberg <littledan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46317}
parent 92d5e42a
...@@ -4238,14 +4238,10 @@ bool ParserBase<Impl>::IsNextLetKeyword() { ...@@ -4238,14 +4238,10 @@ bool ParserBase<Impl>::IsNextLetKeyword() {
// for those semantics to apply. This ensures that ASI is // for those semantics to apply. This ensures that ASI is
// not honored when a LineTerminator separates the // not honored when a LineTerminator separates the
// tokens. // tokens.
case Token::YIELD:
case Token::AWAIT:
case Token::ASYNC: case Token::ASYNC:
return true; return true;
case Token::AWAIT:
// In an async function, allow ASI between `let` and `yield`
return !is_async_function() || !scanner_->HasAnyLineTerminatorAfterNext();
case Token::YIELD:
// In an generator, allow ASI between `let` and `yield`
return !is_generator() || !scanner_->HasAnyLineTerminatorAfterNext();
case Token::FUTURE_STRICT_RESERVED_WORD: case Token::FUTURE_STRICT_RESERVED_WORD:
return is_sloppy(language_mode()); return is_sloppy(language_mode());
default: default:
......
// Copyright 2017 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.
var let = 0;
function nonAsync() {
let
await 0;
}
*%(basename)s:8: SyntaxError: Unexpected number
await 0;
^
SyntaxError: Unexpected number
// Copyright 2017 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.
var let = 0;
function nonGenerator() {
let
yield 0;
}
*%(basename)s:8: SyntaxError: Unexpected number
yield 0;
^
SyntaxError: Unexpected number
// Copyright 2017 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.
var let = 0;
function* generator() {
let
yield 0;
}
let it = generator();
let {value, done} = it.next();
assertEquals(0, value);
assertEquals(false, done);
// Copyright 2017 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: --allow-natives-syntax
var let = 0;
async function asyncFn() {
let
await 0;
return 0;
}
asyncFn().then(value => {
assertEquals(0, value);
}, error => {
assertUnreachable();
}).catch(error => {
%AbortJS(String(error));
});
%RunMicrotasks();
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