Skip to content

Hoisting a var declaration past a lexical declaration of the same name should be a SyntaxError #357

@ianwjhalliday

Description

@ianwjhalliday

Second bullet point of block static semantics and similarly for function body static semantics.

E.g.

let x;
{
    var x; // error (already works)
    let y;
    var y; // should be an error (doesn't work)
    {
        var y; // should also be an error (doesn't work)
    }
}

This applies for var declarations hoisting past all lexical declarations, i.e. let, const, class, function (and generators and async functions).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions