Skip to content

ASI incorrectly kicks in for let declarations #3784

Closed
@DanielRosenwasser

Description

@DanielRosenwasser

From looking through the specification, I don't think we are doing the right thing when a let declaration spans multiple lines.

The following:

let
x

seems to incorrectly compile to

let;
x;

instead of

var x;

I'm not seeing a "[No LineTerminator here]" for let declarations in the spec. The most relevant restriction on let that I see is the following:

13.4 Expression Statement

Syntax

ExpressionStatement[Yield] :

      [lookahead ∉ {{, function, class, let [}] Expression[In,\ ?Yield] ;

NOTE [...] An ExpressionStatement cannot start with the two token sequence let [ because that would make it ambiguous with a let LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern.

Metadata

Metadata

Labels

Breaking ChangeWould introduce errors in existing codeBugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions