2014-09-19 23:01:07 +02:00
|
|
|
//// [protectedClassPropertyAccessibleWithinClass.ts]
|
|
|
|
// no errors
|
|
|
|
|
|
|
|
class C {
|
|
|
|
protected x: string;
|
|
|
|
protected get y() { return this.x; }
|
|
|
|
protected set y(x) { this.y = this.x; }
|
|
|
|
protected foo() { return this.foo; }
|
|
|
|
|
|
|
|
protected static x: string;
|
|
|
|
protected static get y() { return this.x; }
|
|
|
|
protected static set y(x) { this.y = this.x; }
|
|
|
|
protected static foo() { return this.foo; }
|
|
|
|
protected static bar() { this.foo(); }
|
|
|
|
}
|
|
|
|
|
|
|
|
// added level of function nesting
|
|
|
|
class C2 {
|
|
|
|
protected x: string;
|
|
|
|
protected get y() { () => this.x; return null; }
|
|
|
|
protected set y(x) { () => { this.y = this.x; } }
|
|
|
|
protected foo() { () => this.foo; }
|
|
|
|
|
|
|
|
protected static x: string;
|
|
|
|
protected static get y() { () => this.x; return null; }
|
|
|
|
protected static set y(x) {
|
|
|
|
() => { this.y = this.x; }
|
|
|
|
}
|
|
|
|
protected static foo() { () => this.foo; }
|
|
|
|
protected static bar() { () => this.foo(); }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//// [protectedClassPropertyAccessibleWithinClass.js]
|
|
|
|
// no errors
|
|
|
|
var C = (function () {
|
|
|
|
function C() {
|
|
|
|
}
|
|
|
|
Object.defineProperty(C.prototype, "y", {
|
2015-03-26 21:46:35 +01:00
|
|
|
get: function () { return this.x; },
|
|
|
|
set: function (x) { this.y = this.x; },
|
2014-09-19 23:01:07 +02:00
|
|
|
enumerable: true,
|
|
|
|
configurable: true
|
|
|
|
});
|
2015-03-26 21:46:35 +01:00
|
|
|
C.prototype.foo = function () { return this.foo; };
|
2014-09-19 23:01:07 +02:00
|
|
|
Object.defineProperty(C, "y", {
|
2015-03-26 21:46:35 +01:00
|
|
|
get: function () { return this.x; },
|
|
|
|
set: function (x) { this.y = this.x; },
|
2014-09-19 23:01:07 +02:00
|
|
|
enumerable: true,
|
|
|
|
configurable: true
|
|
|
|
});
|
2015-03-26 21:46:35 +01:00
|
|
|
C.foo = function () { return this.foo; };
|
|
|
|
C.bar = function () { this.foo(); };
|
2014-09-19 23:01:07 +02:00
|
|
|
return C;
|
|
|
|
})();
|
|
|
|
// added level of function nesting
|
|
|
|
var C2 = (function () {
|
|
|
|
function C2() {
|
|
|
|
}
|
|
|
|
Object.defineProperty(C2.prototype, "y", {
|
|
|
|
get: function () {
|
|
|
|
var _this = this;
|
2015-03-26 21:46:35 +01:00
|
|
|
(function () { return _this.x; });
|
2014-09-19 23:01:07 +02:00
|
|
|
return null;
|
|
|
|
},
|
|
|
|
set: function (x) {
|
|
|
|
var _this = this;
|
2015-03-26 21:46:35 +01:00
|
|
|
(function () { _this.y = _this.x; });
|
2014-09-19 23:01:07 +02:00
|
|
|
},
|
|
|
|
enumerable: true,
|
|
|
|
configurable: true
|
|
|
|
});
|
|
|
|
C2.prototype.foo = function () {
|
|
|
|
var _this = this;
|
2015-03-26 21:46:35 +01:00
|
|
|
(function () { return _this.foo; });
|
2014-09-19 23:01:07 +02:00
|
|
|
};
|
|
|
|
Object.defineProperty(C2, "y", {
|
|
|
|
get: function () {
|
|
|
|
var _this = this;
|
2015-03-26 21:46:35 +01:00
|
|
|
(function () { return _this.x; });
|
2014-09-19 23:01:07 +02:00
|
|
|
return null;
|
|
|
|
},
|
|
|
|
set: function (x) {
|
|
|
|
var _this = this;
|
2015-03-26 21:46:35 +01:00
|
|
|
(function () { _this.y = _this.x; });
|
2014-09-19 23:01:07 +02:00
|
|
|
},
|
|
|
|
enumerable: true,
|
|
|
|
configurable: true
|
|
|
|
});
|
|
|
|
C2.foo = function () {
|
|
|
|
var _this = this;
|
2015-03-26 21:46:35 +01:00
|
|
|
(function () { return _this.foo; });
|
2014-09-19 23:01:07 +02:00
|
|
|
};
|
|
|
|
C2.bar = function () {
|
|
|
|
var _this = this;
|
2015-03-26 21:46:35 +01:00
|
|
|
(function () { return _this.foo(); });
|
2014-09-19 23:01:07 +02:00
|
|
|
};
|
|
|
|
return C2;
|
|
|
|
})();
|