Skip to content

Commit a8ffb5c

Browse files
author
Kanchalai Tanglertsampan
committed
Address code review
1 parent 028c41b commit a8ffb5c

8 files changed

+70
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//// [classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts]
2+
function f() {
3+
new C2(); // OK
4+
}
5+
class C2 { }
6+
7+
//// [classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.js]
8+
function f() {
9+
new C2(); // OK
10+
}
11+
var C2 = (function () {
12+
function C2() {
13+
}
14+
return C2;
15+
}());
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
=== tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts ===
2+
function f() {
3+
>f : Symbol(f, Decl(classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts, 0, 0))
4+
5+
new C2(); // OK
6+
>C2 : Symbol(C2, Decl(classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts, 2, 1))
7+
}
8+
class C2 { }
9+
>C2 : Symbol(C2, Decl(classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts, 2, 1))
10+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
=== tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts ===
2+
function f() {
3+
>f : () => void
4+
5+
new C2(); // OK
6+
>new C2() : C2
7+
>C2 : typeof C2
8+
}
9+
class C2 { }
10+
>C2 : C2
11+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//// [classDeclarationCheckUsedBeforeDefinitionInItself.ts]
2+
class C3 {
3+
static intance = new C3(); // ok
4+
}
5+
6+
//// [classDeclarationCheckUsedBeforeDefinitionInItself.js]
7+
class C3 {
8+
}
9+
C3.intance = new C3(); // ok
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
=== tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInItself.ts ===
2+
class C3 {
3+
>C3 : Symbol(C3, Decl(classDeclarationCheckUsedBeforeDefinitionInItself.ts, 0, 0))
4+
5+
static intance = new C3(); // ok
6+
>intance : Symbol(C3.intance, Decl(classDeclarationCheckUsedBeforeDefinitionInItself.ts, 0, 10))
7+
>C3 : Symbol(C3, Decl(classDeclarationCheckUsedBeforeDefinitionInItself.ts, 0, 0))
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
=== tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInItself.ts ===
2+
class C3 {
3+
>C3 : C3
4+
5+
static intance = new C3(); // ok
6+
>intance : C3
7+
>new C3() : C3
8+
>C3 : typeof C3
9+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function f() {
2+
new C2(); // OK
3+
}
4+
class C2 { }
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// @target: es6
2+
class C3 {
3+
static intance = new C3(); // ok
4+
}

0 commit comments

Comments
 (0)