FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

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

/ babel Public

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

Description

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 

Activity

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

Metadata

Metadata

Assignees

Labels

outdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL