Skip to content

Duplicate definitions of variables should throw syntax error #6722

@babel-bot

Description

@babel-bot

Issue originally reported by @danez in babel/babylon#78

According to the spec when defining multiple variables with the same name, the parser should throw and SyntaxError when using let or const:

let foo, foo;
or
let foo; let foo;

From 13.2.1.1:

It is a Syntax Error if the BoundNames of BindingList contains any duplicate entries.

V8 trows an error for let and const, but not vor var.

Metadata

Metadata

Assignees

No one assigned

    Labels

    importedoutdatedA 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