74 lines
1.7 KiB
JavaScript
74 lines
1.7 KiB
JavaScript
//// [protectedClassPropertyAccessibleWithinSubclass.ts]
|
|
// no errors
|
|
|
|
class B {
|
|
protected x: string;
|
|
protected static x: string;
|
|
}
|
|
|
|
class C extends B {
|
|
protected get y() { return this.x; }
|
|
protected set y(x) { this.y = this.x; }
|
|
protected foo() { return this.x; }
|
|
protected bar() { return this.foo(); }
|
|
|
|
protected static get y() { return this.x; }
|
|
protected static set y(x) { this.y = this.x; }
|
|
protected static foo() { return this.x; }
|
|
protected static bar() { this.foo(); }
|
|
}
|
|
|
|
|
|
//// [protectedClassPropertyAccessibleWithinSubclass.js]
|
|
// no errors
|
|
var __extends = this.__extends || function (d, b) {
|
|
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
function __() { this.constructor = d; }
|
|
__.prototype = b.prototype;
|
|
d.prototype = new __();
|
|
};
|
|
var B = (function () {
|
|
function B() {
|
|
}
|
|
return B;
|
|
})();
|
|
var C = (function (_super) {
|
|
__extends(C, _super);
|
|
function C() {
|
|
_super.apply(this, arguments);
|
|
}
|
|
Object.defineProperty(C.prototype, "y", {
|
|
get: function () {
|
|
return this.x;
|
|
},
|
|
set: function (x) {
|
|
this.y = this.x;
|
|
},
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
C.prototype.foo = function () {
|
|
return this.x;
|
|
};
|
|
C.prototype.bar = function () {
|
|
return this.foo();
|
|
};
|
|
Object.defineProperty(C, "y", {
|
|
get: function () {
|
|
return this.x;
|
|
},
|
|
set: function (x) {
|
|
this.y = this.x;
|
|
},
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
C.foo = function () {
|
|
return this.x;
|
|
};
|
|
C.bar = function () {
|
|
this.foo();
|
|
};
|
|
return C;
|
|
})(B);
|