Commit 96698b55 authored by Caitlin Potter's avatar Caitlin Potter Committed by Commit Bot

[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/472568Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Commit-Queue: Caitlin Potter <caitp@igalia.com>
Cr-Commit-Position: refs/heads/master@{#44585}
parent b3ff3903
......@@ -4132,10 +4132,14 @@ bool ParserBase<Impl>::IsNextLetKeyword() {
// for those semantics to apply. This ensures that ASI is
// not honored when a LineTerminator separates the
// tokens.
case Token::YIELD:
case Token::AWAIT:
case Token::ASYNC:
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:
return is_sloppy(language_mode());
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