add object getter memoization and this shorthand to playground
This commit is contained in:
19
test/fixtures/transformation/playground/object-getter-memoization/actual.js
vendored
Normal file
19
test/fixtures/transformation/playground/object-getter-memoization/actual.js
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
class Foo {
|
||||
memo bar() {
|
||||
return complex();
|
||||
}
|
||||
|
||||
memo [bar]() {
|
||||
return complex();
|
||||
}
|
||||
}
|
||||
|
||||
var foo = {
|
||||
memo bar() {
|
||||
return complex();
|
||||
},
|
||||
|
||||
memo [bar]() {
|
||||
return complex();
|
||||
}
|
||||
};
|
||||
53
test/fixtures/transformation/playground/object-getter-memoization/expected.js
vendored
Normal file
53
test/fixtures/transformation/playground/object-getter-memoization/expected.js
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
|
||||
var _classProps = function (child, staticProps, instanceProps) {
|
||||
if (staticProps) Object.defineProperties(child, staticProps);
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var Foo = (function () {
|
||||
var Foo = function Foo() {};
|
||||
|
||||
_classProps(Foo, null, (function (_ref) {
|
||||
_ref[bar] = {
|
||||
get: function () {
|
||||
if (this._memoDone) return this._memo;
|
||||
this._memoDone = true;
|
||||
return this._memo = complex();
|
||||
}
|
||||
};
|
||||
return _ref;
|
||||
})({
|
||||
bar: {
|
||||
get: function () {
|
||||
if (this._barDone) return this._bar;
|
||||
this._barDone = true;
|
||||
return this._bar = complex();
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
var foo = (function (_foo) {
|
||||
_foo[bar] = function () {
|
||||
if (this._memo2Done) return this._memo2;
|
||||
this._memo2Done = true;
|
||||
return this._memo2 = complex();
|
||||
};
|
||||
|
||||
return _foo;
|
||||
})((function (_ref2) {
|
||||
Object.defineProperties(_ref2, {
|
||||
bar: {
|
||||
get: function () {
|
||||
if (this._barDone) return this._bar;
|
||||
this._barDone = true;
|
||||
return this._bar = complex();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return _ref2;
|
||||
})({}));
|
||||
Reference in New Issue
Block a user