114 lines
4.6 KiB
Text
114 lines
4.6 KiB
Text
=== tests/cases/compiler/declarationEmit_protectedMembers.ts ===
|
|
|
|
// Class with protected members
|
|
class C1 {
|
|
>C1 : Symbol(C1, Decl(declarationEmit_protectedMembers.ts, 0, 0))
|
|
|
|
protected x: number;
|
|
>x : Symbol(x, Decl(declarationEmit_protectedMembers.ts, 2, 10))
|
|
|
|
protected f() {
|
|
>f : Symbol(f, Decl(declarationEmit_protectedMembers.ts, 3, 24))
|
|
|
|
return this.x;
|
|
>this.x : Symbol(x, Decl(declarationEmit_protectedMembers.ts, 2, 10))
|
|
>this : Symbol(C1, Decl(declarationEmit_protectedMembers.ts, 0, 0))
|
|
>x : Symbol(x, Decl(declarationEmit_protectedMembers.ts, 2, 10))
|
|
}
|
|
|
|
protected set accessor(a: number) { }
|
|
>accessor : Symbol(accessor, Decl(declarationEmit_protectedMembers.ts, 7, 5), Decl(declarationEmit_protectedMembers.ts, 9, 41))
|
|
>a : Symbol(a, Decl(declarationEmit_protectedMembers.ts, 9, 27))
|
|
|
|
protected get accessor() { return 0; }
|
|
>accessor : Symbol(accessor, Decl(declarationEmit_protectedMembers.ts, 7, 5), Decl(declarationEmit_protectedMembers.ts, 9, 41))
|
|
|
|
protected static sx: number;
|
|
>sx : Symbol(C1.sx, Decl(declarationEmit_protectedMembers.ts, 10, 42))
|
|
|
|
protected static sf() {
|
|
>sf : Symbol(C1.sf, Decl(declarationEmit_protectedMembers.ts, 12, 32))
|
|
|
|
return this.sx;
|
|
>this.sx : Symbol(C1.sx, Decl(declarationEmit_protectedMembers.ts, 10, 42))
|
|
>this : Symbol(C1, Decl(declarationEmit_protectedMembers.ts, 0, 0))
|
|
>sx : Symbol(C1.sx, Decl(declarationEmit_protectedMembers.ts, 10, 42))
|
|
}
|
|
|
|
protected static set staticSetter(a: number) { }
|
|
>staticSetter : Symbol(C1.staticSetter, Decl(declarationEmit_protectedMembers.ts, 16, 5))
|
|
>a : Symbol(a, Decl(declarationEmit_protectedMembers.ts, 18, 38))
|
|
|
|
protected static get staticGetter() { return 0; }
|
|
>staticGetter : Symbol(C1.staticGetter, Decl(declarationEmit_protectedMembers.ts, 18, 52))
|
|
}
|
|
|
|
// Derived class overriding protected members
|
|
class C2 extends C1 {
|
|
>C2 : Symbol(C2, Decl(declarationEmit_protectedMembers.ts, 20, 1))
|
|
>C1 : Symbol(C1, Decl(declarationEmit_protectedMembers.ts, 0, 0))
|
|
|
|
protected f() {
|
|
>f : Symbol(f, Decl(declarationEmit_protectedMembers.ts, 23, 21))
|
|
|
|
return super.f() + this.x;
|
|
>super.f : Symbol(C1.f, Decl(declarationEmit_protectedMembers.ts, 3, 24))
|
|
>super : Symbol(C1, Decl(declarationEmit_protectedMembers.ts, 0, 0))
|
|
>f : Symbol(C1.f, Decl(declarationEmit_protectedMembers.ts, 3, 24))
|
|
>this.x : Symbol(C1.x, Decl(declarationEmit_protectedMembers.ts, 2, 10))
|
|
>this : Symbol(C2, Decl(declarationEmit_protectedMembers.ts, 20, 1))
|
|
>x : Symbol(C1.x, Decl(declarationEmit_protectedMembers.ts, 2, 10))
|
|
}
|
|
protected static sf() {
|
|
>sf : Symbol(C2.sf, Decl(declarationEmit_protectedMembers.ts, 26, 5))
|
|
|
|
return super.sf() + this.sx;
|
|
>super.sf : Symbol(C1.sf, Decl(declarationEmit_protectedMembers.ts, 12, 32))
|
|
>super : Symbol(C1, Decl(declarationEmit_protectedMembers.ts, 0, 0))
|
|
>sf : Symbol(C1.sf, Decl(declarationEmit_protectedMembers.ts, 12, 32))
|
|
>this.sx : Symbol(C1.sx, Decl(declarationEmit_protectedMembers.ts, 10, 42))
|
|
>this : Symbol(C2, Decl(declarationEmit_protectedMembers.ts, 20, 1))
|
|
>sx : Symbol(C1.sx, Decl(declarationEmit_protectedMembers.ts, 10, 42))
|
|
}
|
|
}
|
|
|
|
// Derived class making protected members public
|
|
class C3 extends C2 {
|
|
>C3 : Symbol(C3, Decl(declarationEmit_protectedMembers.ts, 30, 1))
|
|
>C2 : Symbol(C2, Decl(declarationEmit_protectedMembers.ts, 20, 1))
|
|
|
|
x: number;
|
|
>x : Symbol(x, Decl(declarationEmit_protectedMembers.ts, 33, 21))
|
|
|
|
static sx: number;
|
|
>sx : Symbol(C3.sx, Decl(declarationEmit_protectedMembers.ts, 34, 14))
|
|
|
|
f() {
|
|
>f : Symbol(f, Decl(declarationEmit_protectedMembers.ts, 35, 22))
|
|
|
|
return super.f();
|
|
>super.f : Symbol(C2.f, Decl(declarationEmit_protectedMembers.ts, 23, 21))
|
|
>super : Symbol(C2, Decl(declarationEmit_protectedMembers.ts, 20, 1))
|
|
>f : Symbol(C2.f, Decl(declarationEmit_protectedMembers.ts, 23, 21))
|
|
}
|
|
static sf() {
|
|
>sf : Symbol(C3.sf, Decl(declarationEmit_protectedMembers.ts, 38, 5))
|
|
|
|
return super.sf();
|
|
>super.sf : Symbol(C2.sf, Decl(declarationEmit_protectedMembers.ts, 26, 5))
|
|
>super : Symbol(C2, Decl(declarationEmit_protectedMembers.ts, 20, 1))
|
|
>sf : Symbol(C2.sf, Decl(declarationEmit_protectedMembers.ts, 26, 5))
|
|
}
|
|
|
|
static get staticGetter() { return 1; }
|
|
>staticGetter : Symbol(C3.staticGetter, Decl(declarationEmit_protectedMembers.ts, 41, 5))
|
|
}
|
|
|
|
// Protected properties in constructors
|
|
class C4 {
|
|
>C4 : Symbol(C4, Decl(declarationEmit_protectedMembers.ts, 44, 1))
|
|
|
|
constructor(protected a: number, protected b) { }
|
|
>a : Symbol(a, Decl(declarationEmit_protectedMembers.ts, 48, 16))
|
|
>b : Symbol(b, Decl(declarationEmit_protectedMembers.ts, 48, 36))
|
|
}
|