Skip to content

vars which conflicts with a let declared in an outer block aren't reported. #6283

@nicolo-ribaudo

Description

@nicolo-ribaudo

This issue only appears if the let declaration is inside a block. If it is a direct child of a function body/program, babel throws correctly.

REPL

Input Code

{
  let a;
  { var a; }
}

Expected Behavior

Duplicate declaration "a"

Current Behavior

No error

Possible Solution

Scope should check the block scopes that variable declarations visit while they "walk up" the scope.
It should also keep track of them, in the case that the variable declaration comes before the lexical declaration (e.g. { { var a; }; let a; })

Your Environment

software version(s)
Babel 7.0.0-beta.1
node
npm
Operating System

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: traverse (scope)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions