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]: Object rest, side effect order and function scope #16470

Open
1 task
magic-akari opened this issue May 3, 2024 · 1 comment
Open
1 task

[Bug]: Object rest, side effect order and function scope #16470

magic-akari opened this issue May 3, 2024 · 1 comment
Labels

Comments

@magic-akari
Copy link
Contributor

magic-akari commented May 3, 2024

馃捇

  • Would you like to work on a fix?

How are you using Babel?

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

Input code

function a() {
  console.log("a");
  return "a";
}

function B() {
  console.log("B");
  return "B";
}

function c() {
  console.log("c");
  return "c";
}

function foo([{ [a()]: b, ...x }, y = b()], z = c()) {
  console.log(x, y, z)
}



foo([{ a: B }]);

Configuration file name

No response

Configuration

chrome 59

Current and expected behavior

Current behavior:
Uncaught ReferenceError: b is not defined

Expected behavior:
print the following

a
B
c
{} 'B' 'c'

Environment

https://babeljs.io/repl#?browsers=chrome%2059&build=&builtIns=false&corejs=3.21&spec=false&loose=true&code_lz=GYVwdgxgLglg9mABAQwBQEpEG8BQjEQIDOcANgKYB0pcA5qgETIPoDceiATuVCJ0kwbsAvjhyhIsBIgBCGbB0JgSFanUYyW7fN179EDTSLETo8JBHm58SlVRr0GELR118Bz4-PBnpwOHCoANpYiEFo6AC6AFyIAEYANIiUKQAeiMJJAJ6IALzxGJFJAF55BBiY1gTEZPbqqdkl6DiiYuIBwaHIsTIZkWxAA&debug=false&forceAllTransforms=false&modules=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env&prettier=false&targets=&version=7.24.5&externalPlugins=&assumptions=%7B%7D

Possible solution

No response

Additional context

No response

@babel-bot
Copy link
Collaborator

Hey @magic-akari! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.

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

No branches or pull requests

3 participants