Justin Ridgewell 890a45216f
Update super property get/set/call in loose mode (#7774)
* Update super property get/set/call in loose mode

Follows the plan laid out in https://github.com/babel/babel/pull/7553#issuecomment-381434519.

With #7691, this closes #7553, closes #4312.

* Post #7772

* Memoized property
2018-04-22 13:49:19 -04:00

28 lines
448 B
JavaScript

"use strict";
let value = 1;
class Base {
set test(v) {
value = v;
}
}
class Obj extends Base {
set() {
return super.test = 3;
}
}
Object.defineProperty(Obj.prototype, 'test', {
value: 2,
writable: true,
configurable: true,
});
const obj = new Obj();
expect(obj.set()).toBe(3);
// todo
expect(value).toBe(1);
expect(Base.prototype.test).toBeUndefined();
expect(Obj.prototype.test).toBe(2);
// todo
expect(obj.test).toBe(3);