Previously, computed class properties would be evaluated every time a new instance of the class was created. This means the property name may have changed between different instances, as well as potential side effects. This commit fixes this by storing the computed value in a separate variable.
15 lines
249 B
JavaScript
15 lines
249 B
JavaScript
function test(x) {
|
|
var F = function F() {
|
|
babelHelpers.classCallCheck(this, F);
|
|
this[_x] = 1;
|
|
};
|
|
|
|
var _x = x;
|
|
x = 'deadbeef';
|
|
assert.strictEqual(new F().foo, 1);
|
|
x = 'wrong';
|
|
assert.strictEqual(new F().foo, 1);
|
|
}
|
|
|
|
test('foo');
|