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]: babel-traverse path.isForAwaitStatement is broken #14929

Closed
1 task
ROpdebee opened this issue Sep 14, 2022 · 1 comment 路 Fixed by #14932
Closed
1 task

[Bug]: babel-traverse path.isForAwaitStatement is broken #14929

ROpdebee opened this issue Sep 14, 2022 · 1 comment 路 Fixed by #14932
Assignees
Labels
i: bug i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: traverse

Comments

@ROpdebee
Copy link

馃捇

  • Would you like to work on a fix?

How are you using Babel?

Programmatic API (babel.transform, babel.parse)

Input code

async function x() {
    for await (const i of [1, 2, 3]) {
        console.log(i);
    }
}

x();

Configuration file name

No response

Configuration

No response

Current and expected behavior

isForAwaitStatement on the node for the for await statement should return true. It returns false instead, since @babel/traverse@7.19.0.

Environment

System:
OS: macOS 11.5.2
Binaries:
Node: 18.8.0 - /usr/local/bin/node
npm: 8.18.0 - /usr/local/bin/npm
npmPackages:
@babel/core: 7.19.0 => 7.19.0
@babel/plugin-syntax-jsx: 7.18.6 => 7.18.6
@babel/plugin-transform-runtime: 7.18.10 => 7.18.10
@babel/preset-env: 7.19.0 => 7.19.0
@babel/preset-typescript: 7.18.6 => 7.18.6
babel-plugin-transform-async-to-promises: 0.8.16 => 0.8.16
eslint: 8.23.1 => 8.23.1
jest: 28.1.3 => 28.1.3

Possible solution

It seems that it got broken in the refactoring of #14799. I think

export function isForAwaitStatement(this: NodePath): boolean {
return isForStatement(this.node, { await: true });
}
should use isForOfStatement instead of isForStatement.

Additional context

No response

@babel-bot
Copy link
Collaborator

Hey @ROpdebee! 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.

@JLHwung JLHwung self-assigned this Sep 14, 2022
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Dec 15, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: bug i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: traverse
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants