1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
//// [thisInAccessors.ts]
// this capture only in getter
class GetterOnly {
get Value() {
var fn = () => this;
return '';
}
set Value(val) {
}
}
// this capture only in setter
class SetterOnly {
get Value() {
return '';
}
set Value(val) {
var fn = () => this;
}
}
// this capture only in both setter and getter
class GetterAndSetter {
get Value() {
var fn = () => this;
return '';
}
set Value(val) {
var fn = () => this;
}
}
//// [thisInAccessors.js]
// this capture only in getter
var GetterOnly = /** @class */ (function () {
function GetterOnly() {
}
Object.defineProperty(GetterOnly.prototype, "Value", {
get: function () {
var _this = this;
var fn = function () { return _this; };
return '';
},
set: function (val) {
},
enumerable: true,
configurable: true
});
return GetterOnly;
}());
// this capture only in setter
var SetterOnly = /** @class */ (function () {
function SetterOnly() {
}
Object.defineProperty(SetterOnly.prototype, "Value", {
get: function () {
return '';
},
set: function (val) {
var _this = this;
var fn = function () { return _this; };
},
enumerable: true,
configurable: true
});
return SetterOnly;
}());
// this capture only in both setter and getter
var GetterAndSetter = /** @class */ (function () {
function GetterAndSetter() {
}
Object.defineProperty(GetterAndSetter.prototype, "Value", {
get: function () {
var _this = this;
var fn = function () { return _this; };
return '';
},
set: function (val) {
var _this = this;
var fn = function () { return _this; };
},
enumerable: true,
configurable: true
});
return GetterAndSetter;
}());
|