Skip to content

ASI hazard with trailing +, -, /, and /= #19

@rbuckton

Description

@rbuckton

The recent change in #17 to ban infix tokens runs afoul of an ASI hazard that results in different semantics between throw expressions and ThrowStatement for the +, -, /, and /= tokens:

a ?? throw b // <- ASI inserts semicolon
+ c // <- prefix '+'
// vs
throw b // <- no ASI
+ c
a ?? throw b // <- ASI inserts semicolon
- c // <- prefix '-'
// vs
throw b // <- no ASI
- c
a ?? throw b // <- ASI inserts semicolon
/ c/d // <- regexp literal
// vs
throw b // <- no ASI
/ c/d
a = throw b // <- ASI inserts semicolon
/=c/d // <- regexp literal
// vs
throw b // <- no ASI
/=c/d

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions