Skip to content

[parser] let in catch clause is not an error in sloppy #10413

@pvdz

Description

@pvdz

Bug Report

The let identifier should be valid in a catch clause in sloppy (non-strict) mode but this appears to be invalid.

Current Behavior

The let identifier is special in strict mode but not a keyword in non-strict mode. In this case Babel still throws over it where I think it should not.

Input Code

https://astexplorer.net/#/gist/15eb31fbb1024faa6f42a4940d8beb4a/50b40e18038bb65c40bc3257e886093a206ad411

try {} catch (let) {}

Expected behavior/code

Should pass.

Environment

Babel 7.5.5

Possible Solution

Update heuristics to detect this :)

Additional context/Screenshots

I hope I'm not missing some weird exception in the spec but as far as I can see there is none and this should pass.

Metadata

Metadata

Assignees

Labels

Has PRoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions