Issue originally made by Kris Zyp (kriszyp)
Bug information
- Babel version: 6.8.0
- Node version: 6.1.0
- npm version: 3.8.9
Options
presets: ['es2015-loose']
Input code
class Foo extends Bar {
set foo(value) {
super.foo = value
}
}
Description
The setter produces:
Bar.prototype.foo = value
I know that loose mode isn't precisely spec equivalent, but the resulting code never behaves even close to a true super assignment. A super assignment isn't supposed to assign to the proto object, it is supposed to do assignment to this, using a super setter function if available. I would recommend just leaving loose mode super property handling the same as spec mode, and calling getSuperProperty here (and getting rid of getLooseSuperProperty):
https://github.com/babel/babel/blob/master/packages/babel-helper-replace-supers/src/index.js#L189
Bug information
Options
Input code
Description
The setter produces:
Bar.prototype.foo = valueI know that loose mode isn't precisely spec equivalent, but the resulting code never behaves even close to a true super assignment. A super assignment isn't supposed to assign to the proto object, it is supposed to do assignment to
this, using a super setter function if available. I would recommend just leaving loose mode super property handling the same as spec mode, and callinggetSuperPropertyhere (and getting rid ofgetLooseSuperProperty):https://github.com/babel/babel/blob/master/packages/babel-helper-replace-supers/src/index.js#L189