New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`Scope#push(var)`, doesn't check for conflicting lexical bindings in outer scopes #6284

nicolo-ribaudo opened this Issue Sep 20, 2017 · 0 comments


None yet
1 participant

nicolo-ribaudo commented Sep 20, 2017

AST Explorer

Choose one: is this a bug report or feature request?

Input Code

let a;


export default function ({ types: t }) {
  return {
    visitor: {
      Identifier(path) {
        if ( !== "PLACEHOLDER") return;
        path.scope.push({ kind: "var", id: t.identifier("a") });

Expected Behavior

Duplicate declaration "a"

Current Behavior

let a;
  var a;

Note that if I give that output to babel a second time, it correctly throws the error.

Your Environment

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

@nicolo-ribaudo nicolo-ribaudo changed the title from When inserting a variable declared in an outer scope using `Scope#push`, references aren't updated to `Scope#push(var)`, doesn't check for conflicting lexical bindings in outer scopes Sep 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment