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

Unnecessary variable injected by class-properties plugin #6916

Open
nicolo-ribaudo opened this Issue Nov 27, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@nicolo-ribaudo
Member

nicolo-ribaudo commented Nov 27, 2017

Choose one: is this a bug report or feature request?

Input Code

var foo = "bar";

let Foo = class Foo {
  bar = foo;

  constructor() {
    var foo = "foo";
  }
};

Babel/Babylon Configuration (.babelrc, package.json, cli command)

{
  "presets": ["@babel/stage-3"]
}

Current Behavior

https://babeljs.io/repl/build/master#?babili=false&browsers=&build=&builtIns=false&code_lz=G4QwTgBAZg9jEF4ICIBG5kG4BQ2A2ApgC4QBiciEAxniAM51kUDe2EE6kSsMOb1MAHZ0iYAK5UiMMAAoAlBFbt2oSD0rIeWfgF9sOnEA&debug=false&circleciRepo=&evaluate=false&lineWrap=false&presets=stage-3&prettier=false&targets=&version=7.0.0-beta.32

var _class, _temp, _initialiseProps;

var foo = "bar";
let Foo = (_temp = _class = class Foo {
  constructor() {
    _initialiseProps.call(this);

    var foo = "foo";
  }

}, _initialiseProps = function () {
  Object.defineProperty(this, "bar", {
    configurable: true,
    enumerable: true,
    writable: true,
    value: foo
  });
}, _temp);

The _class variable shouldn't be added.

Your Environment

(Found in repl, not tested locally)

software version(s)
Babel 7.0.0-beta.32
Babylon
node
npm
Operating System
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment