Skip to content

Commit 4e794c7

Browse files
committed
Add test cases for prototype variable
1 parent e5a5411 commit 4e794c7

8 files changed

+126
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//// [prototypeVariableVisibility2.ts]
2+
class A {
3+
a() {
4+
return proto_1;
5+
}
6+
}
7+
8+
var proto_1;
9+
10+
//// [prototypeVariableVisibility2.js]
11+
var A = (function () {
12+
function A() {
13+
}
14+
var proto_2 = A.prototype;
15+
proto_2.a = function () {
16+
return proto_1;
17+
};
18+
return A;
19+
}());
20+
var proto_1;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
=== tests/cases/conformance/classes/classDeclarations/prototypeVariableVisibility2.ts ===
2+
class A {
3+
>A : Symbol(A, Decl(prototypeVariableVisibility2.ts, 0, 0))
4+
5+
a() {
6+
>a : Symbol(A.a, Decl(prototypeVariableVisibility2.ts, 0, 9))
7+
8+
return proto_1;
9+
>proto_1 : Symbol(proto_1, Decl(prototypeVariableVisibility2.ts, 6, 3))
10+
}
11+
}
12+
13+
var proto_1;
14+
>proto_1 : Symbol(proto_1, Decl(prototypeVariableVisibility2.ts, 6, 3))
15+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
=== tests/cases/conformance/classes/classDeclarations/prototypeVariableVisibility2.ts ===
2+
class A {
3+
>A : A
4+
5+
a() {
6+
>a : () => any
7+
8+
return proto_1;
9+
>proto_1 : any
10+
}
11+
}
12+
13+
var proto_1;
14+
>proto_1 : any
15+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//// [prototypeVariableVisiblity1.ts]
2+
const proto_1 = 1;
3+
const proto_2 = 2;
4+
5+
class A {
6+
a(): number {
7+
return proto_1 + proto_2;
8+
}
9+
}
10+
11+
//// [prototypeVariableVisiblity1.js]
12+
var proto_1 = 1;
13+
var proto_2 = 2;
14+
var A = (function () {
15+
function A() {
16+
}
17+
var proto_3 = A.prototype;
18+
proto_3.a = function () {
19+
return proto_1 + proto_2;
20+
};
21+
return A;
22+
}());
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
=== tests/cases/conformance/classes/classDeclarations/prototypeVariableVisiblity1.ts ===
2+
const proto_1 = 1;
3+
>proto_1 : Symbol(proto_1, Decl(prototypeVariableVisiblity1.ts, 0, 5))
4+
5+
const proto_2 = 2;
6+
>proto_2 : Symbol(proto_2, Decl(prototypeVariableVisiblity1.ts, 1, 5))
7+
8+
class A {
9+
>A : Symbol(A, Decl(prototypeVariableVisiblity1.ts, 1, 18))
10+
11+
a(): number {
12+
>a : Symbol(A.a, Decl(prototypeVariableVisiblity1.ts, 3, 9))
13+
14+
return proto_1 + proto_2;
15+
>proto_1 : Symbol(proto_1, Decl(prototypeVariableVisiblity1.ts, 0, 5))
16+
>proto_2 : Symbol(proto_2, Decl(prototypeVariableVisiblity1.ts, 1, 5))
17+
}
18+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
=== tests/cases/conformance/classes/classDeclarations/prototypeVariableVisiblity1.ts ===
2+
const proto_1 = 1;
3+
>proto_1 : 1
4+
>1 : 1
5+
6+
const proto_2 = 2;
7+
>proto_2 : 2
8+
>2 : 2
9+
10+
class A {
11+
>A : A
12+
13+
a(): number {
14+
>a : () => number
15+
16+
return proto_1 + proto_2;
17+
>proto_1 + proto_2 : number
18+
>proto_1 : 1
19+
>proto_2 : 2
20+
}
21+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class A {
2+
a() {
3+
return proto_1;
4+
}
5+
}
6+
7+
var proto_1;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const proto_1 = 1;
2+
const proto_2 = 2;
3+
4+
class A {
5+
a(): number {
6+
return proto_1 + proto_2;
7+
}
8+
}

0 commit comments

Comments
 (0)