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

Computed accessor pairs shouldn't be merged #7156

Open
nicolo-ribaudo opened this Issue Jan 4, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@nicolo-ribaudo
Member

nicolo-ribaudo commented Jan 4, 2018

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

Input Code

let i = 0;

let result = "";

function fn() {
  i++;
  return i === 1 ? "foo" : "bar";
}

class A {
  get [fn()]() { result += "get foo"; }
  set [fn()](a) { result += "set bar"; }
}

var x = new A();
result += "Getting foo: ";
x.foo;
result += "\nSetting foo: ";
x.foo = 2;
result += "\nSetting bar: ";
x.bar = 2;

console.log(result);

https://babeljs.io/repl/build/master#?babili=false&browsers=&build=&builtIns=false&code_lz=DYUwLgBAlhC8EAYDcAoFpICcQGcCuwk8ARMaigGZ4B2AxmFAPbUQXUAUAlBAN4oTQA1INQDsYPJhYxYsiAEYIAfgjEKjRsQgAuVQCMAhpjIoAvmlrADOHBACCvfhADm4CAG02XALpdeEbHxCCEESV0h1TSQIcwEcN08OTl8Dbh4A3AJIUNV4yENjaPNzFAA3IwgADzgIahAAd3suVECskJIAcXAGamdWDV0TSoA6SJbM4JziAB1qAGVuqF7-xkHUEciagCZxoOySWYWwHr6CtZQRgu3yWmYcRlBh4EZndlbCTiQgA&debug=false&circleciRepo=&evaluate=true&fileSize=false&lineWrap=false&presets=es2015%2Ces2017%2Cstage-0%2Cflow&prettier=false&targets=&version=7.0.0-beta.36

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

preset-es2015

Expected Behavior

Getting foo: get foo
Setting foo: 
Setting bar: set bar

Current Behavior

Getting foo: get foo
Setting foo: set bar
Setting bar:

Your Environment

software version(s)
Babel 7.0.0-beta.36
Babylon
node
npm
Operating System

@Andarist Andarist added the i: bug label Jan 5, 2018

@Axnyff

This comment has been minimized.

Show comment
Hide comment
@Axnyff

Axnyff Mar 18, 2018

Contributor

Hello,
can I claim this bug if nobody is already working on it?

Contributor

Axnyff commented Mar 18, 2018

Hello,
can I claim this bug if nobody is already working on it?

@Andarist

This comment has been minimized.

Show comment
Hide comment
@Andarist

Andarist Mar 18, 2018

Member

Go for it! If you need any help you can always reach to us at slack.

Member

Andarist commented Mar 18, 2018

Go for it! If you need any help you can always reach to us at slack.

@Andarist Andarist added the claimed label Mar 18, 2018

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