2015-02-03 00:15:54 +01:00
|
|
|
//// [classPropertyAsPrivate.ts]
|
|
|
|
class C {
|
|
|
|
private x: string;
|
|
|
|
private get y() { return null; }
|
|
|
|
private set y(x) { }
|
|
|
|
private foo() { }
|
|
|
|
|
|
|
|
private static a: string;
|
|
|
|
private static get b() { return null; }
|
|
|
|
private static set b(x) { }
|
|
|
|
private static foo() { }
|
|
|
|
}
|
|
|
|
|
|
|
|
var c: C;
|
|
|
|
// all errors
|
|
|
|
c.x;
|
|
|
|
c.y;
|
|
|
|
c.y = 1;
|
|
|
|
c.foo();
|
|
|
|
|
|
|
|
C.a;
|
|
|
|
C.b();
|
|
|
|
C.b = 1;
|
|
|
|
C.foo();
|
|
|
|
|
|
|
|
//// [classPropertyAsPrivate.js]
|
|
|
|
var C = (function () {
|
|
|
|
function C() {
|
|
|
|
}
|
|
|
|
Object.defineProperty(C.prototype, "y", {
|
2015-02-07 05:03:24 +01:00
|
|
|
get: function () { return null; },
|
2015-02-07 03:45:09 +01:00
|
|
|
set: function (x) { },
|
2015-02-03 00:15:54 +01:00
|
|
|
enumerable: true,
|
|
|
|
configurable: true
|
|
|
|
});
|
2015-02-07 03:45:09 +01:00
|
|
|
C.prototype.foo = function () { };
|
2015-02-03 00:15:54 +01:00
|
|
|
Object.defineProperty(C, "b", {
|
2015-02-07 05:03:24 +01:00
|
|
|
get: function () { return null; },
|
2015-02-07 03:45:09 +01:00
|
|
|
set: function (x) { },
|
2015-02-03 00:15:54 +01:00
|
|
|
enumerable: true,
|
|
|
|
configurable: true
|
|
|
|
});
|
2015-02-07 03:45:09 +01:00
|
|
|
C.foo = function () { };
|
2015-02-03 00:15:54 +01:00
|
|
|
return C;
|
|
|
|
})();
|
|
|
|
var c;
|
|
|
|
// all errors
|
|
|
|
c.x;
|
|
|
|
c.y;
|
|
|
|
c.y = 1;
|
|
|
|
c.foo();
|
|
|
|
C.a;
|
|
|
|
C.b();
|
|
|
|
C.b = 1;
|
|
|
|
C.foo();
|