Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Regression with let in loops #16058

Open
1 task
nicolo-ribaudo opened this issue Oct 23, 2023 · 2 comments
Open
1 task

[Bug]: Regression with let in loops #16058

nicolo-ribaudo opened this issue Oct 23, 2023 · 2 comments

Comments

@nicolo-ribaudo
Copy link
Member

馃捇

  • Would you like to work on a fix?

How are you using Babel?

Other (Next.js, Gatsby, vue-cli, ...)

Input code

var objects = [];
var i = 0;
for (var proto of [0, 1 ,2]) if (true) {
  let _obj = i;
  i++;
  
  objects.push({
    foo() {
      return _obj;
    }
  });
}

console.assert(objects[0].foo()===0,objects[0].foo());

Configuration file name

No response

Configuration

No response

Current and expected behavior

old babel

repl

Environment

/

Possible solution

No response

Additional context

#15948 (comment)

@liuxingbaoyu

This comment was marked as outdated.

@liuxingbaoyu

This comment was marked as outdated.

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

No branches or pull requests

2 participants