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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@babel/plugin-transform-property-mutators fails on computed property names #12097

Closed
1 task
JMarkoski opened this issue Sep 22, 2020 · 2 comments
Closed
1 task
Assignees
Labels
i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@JMarkoski
Copy link
Contributor

JMarkoski commented Sep 22, 2020

Bug Report

  • I would like to work on a fix!

Current behavior

  • REPL
    It fails with the error:
{ RangeError: /home/markoski/Documents/babel-test/script.js: Maximum call stack size exceeded
    at Scope.get parent [as parent] (/home/markoski/Documents/babel-test/node_modules/@babel/traverse/lib/scope/index.js:192:13)
    at Scope.getBinding (/home/markoski/Documents/babel-test/node_modules/@babel/traverse/lib/scope/index.js:789:28)
    at Scope.getBindingIdentifier (/home/markoski/Documents/babel-test/node_modules/@babel/traverse/lib/scope/index.js:797:23)
    at PluginPass.ReferencedIdentifier (/home/markoski/Documents/babel-test/node_modules/@babel/preset-env/lib/polyfills/corejs3/usage-plugin.js:172:17)
    at PluginPass.newFn (/home/markoski/Documents/babel-test/node_modules/@babel/traverse/lib/visitors.js:220:17)
    at newFn (/home/markoski/Documents/babel-test/node_modules/@babel/traverse/lib/visitors.js:179:21)
    at NodePath._call (/home/markoski/Documents/babel-test/node_modules/@babel/traverse/lib/path/context.js:55:20)
    at NodePath.call (/home/markoski/Documents/babel-test/node_modules/@babel/traverse/lib/path/context.js:42:17)
    at NodePath.visit (/home/markoski/Documents/babel-test/node_modules/@babel/traverse/lib/path/context.js:90:31)
    at TraversalContext.visitQueue (/home/markoski/Documents/babel-test/node_modules/@babel/traverse/lib/context.js:112:16) code: 'BABEL_TRANSFORM_ERROR' }

Input Code

const expr = "foo";

const obj = {
  get [expr]() {
    return "bar";
  },
};

console.log(obj.foo); // "bar"

Expected behavior
It should handle computed property names correctly, or at least give an error why that's not possible.

Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)

  • Filename: babel.config.js
{
  presets: [
    ["@babel/preset-env", { debug: true, useBuiltIns: "usage", corejs: 3 }],
  ],
  plugins: ["@babel/plugin-transform-property-mutators"],
};

Environment

System:
    OS: Linux 4.15 Ubuntu 18.04.4 LTS (Bionic Beaver)
  Binaries:
    Node: 10.19.0 - /usr/bin/node
    Yarn: 1.22.4 - /usr/bin/yarn
    npm: 6.13.4 - /usr/bin/npm
  npmPackages:
    @babel/cli: ^7.8.4 => 7.8.4 
    @babel/core: ^7.8.7 => 7.8.7 
    @babel/plugin-transform-modules-amd: ^7.8.3 => 7.8.3 
    @babel/plugin-transform-modules-commonjs: ^7.8.3 => 7.8.3 
    @babel/plugin-transform-property-mutators: ^7.10.4 => 7.10.4 
    @babel/plugin-transform-proto-to-assign: ^7.10.5 => 7.10.5 
    @babel/plugin-transform-runtime: ^7.9.0 => 7.9.0 
    @babel/preset-env: ^7.9.5 => 7.9.5 
    @babel/runtime-corejs3: ^7.9.2 => 7.9.2 
    babel-plugin-transform-inline-consecutive-adds: ^0.4.3 => 0.4.3 
@babel-bot
Copy link
Collaborator

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

@liuxingbaoyu
Copy link
Member

fixed in #15274

@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 Mar 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants