Skip to content

Commit 660a63d

Browse files
committed
Emit class annotation comment on downlevel classes
1 parent a277664 commit 660a63d

File tree

3,603 files changed

+7534
-7524
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,603 files changed

+7534
-7524
lines changed

src/compiler/transformers/es2015.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ namespace ts {
840840
outer.end = skipTrivia(currentText, node.pos);
841841
setEmitFlags(outer, EmitFlags.NoComments);
842842

843-
return createParen(
843+
const result = createParen(
844844
createCall(
845845
outer,
846846
/*typeArguments*/ undefined,
@@ -849,6 +849,8 @@ namespace ts {
849849
: []
850850
)
851851
);
852+
addSyntheticLeadingComment(result, SyntaxKind.MultiLineCommentTrivia, "* @class ");
853+
return result;
852854
}
853855

854856
/**

tests/baselines/reference/2dArrays.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ class Board {
1616
}
1717

1818
//// [2dArrays.js]
19-
var Cell = (function () {
19+
var Cell = /** @class */ (function () {
2020
function Cell() {
2121
}
2222
return Cell;
2323
}());
24-
var Ship = (function () {
24+
var Ship = /** @class */ (function () {
2525
function Ship() {
2626
}
2727
return Ship;
2828
}());
29-
var Board = (function () {
29+
var Board = /** @class */ (function () {
3030
function Board() {
3131
}
3232
Board.prototype.allShipsSunk = function () {

tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var p = new A.Point(0, 0); // unexpected error here, bug 840000
2525
//// [classPoint.js]
2626
var A;
2727
(function (A) {
28-
var Point = (function () {
28+
var Point = /** @class */ (function () {
2929
function Point(x, y) {
3030
this.x = x;
3131
this.y = y;

tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,42 +51,42 @@ module clodule4 {
5151

5252
//// [ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js]
5353
// all expected to be errors
54-
var clodule1 = (function () {
54+
var clodule1 = /** @class */ (function () {
5555
function clodule1() {
5656
}
5757
return clodule1;
5858
}());
5959
(function (clodule1) {
6060
function f(x) { }
6161
})(clodule1 || (clodule1 = {}));
62-
var clodule2 = (function () {
62+
var clodule2 = /** @class */ (function () {
6363
function clodule2() {
6464
}
6565
return clodule2;
6666
}());
6767
(function (clodule2) {
6868
var x;
69-
var D = (function () {
69+
var D = /** @class */ (function () {
7070
function D() {
7171
}
7272
return D;
7373
}());
7474
})(clodule2 || (clodule2 = {}));
75-
var clodule3 = (function () {
75+
var clodule3 = /** @class */ (function () {
7676
function clodule3() {
7777
}
7878
return clodule3;
7979
}());
8080
(function (clodule3) {
8181
clodule3.y = { id: T };
8282
})(clodule3 || (clodule3 = {}));
83-
var clodule4 = (function () {
83+
var clodule4 = /** @class */ (function () {
8484
function clodule4() {
8585
}
8686
return clodule4;
8787
}());
8888
(function (clodule4) {
89-
var D = (function () {
89+
var D = /** @class */ (function () {
9090
function D() {
9191
}
9292
return D;

tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module clodule {
1616

1717

1818
//// [ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js]
19-
var clodule = (function () {
19+
var clodule = /** @class */ (function () {
2020
function clodule() {
2121
}
2222
clodule.fn = function (id) { };

tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module clodule {
1616

1717

1818
//// [ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js]
19-
var clodule = (function () {
19+
var clodule = /** @class */ (function () {
2020
function clodule() {
2121
}
2222
clodule.fn = function (id) { };

tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module clodule {
1616

1717

1818
//// [ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js]
19-
var clodule = (function () {
19+
var clodule = /** @class */ (function () {
2020
function clodule() {
2121
}
2222
clodule.sfn = function (id) { return 42; };

tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module A {
2323
}
2424

2525
//// [ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js]
26-
var Point = (function () {
26+
var Point = /** @class */ (function () {
2727
function Point(x, y) {
2828
this.x = x;
2929
this.y = y;
@@ -37,7 +37,7 @@ var Point = (function () {
3737
})(Point || (Point = {}));
3838
var A;
3939
(function (A) {
40-
var Point = (function () {
40+
var Point = /** @class */ (function () {
4141
function Point(x, y) {
4242
this.x = x;
4343
this.y = y;

tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module A {
2323
}
2424

2525
//// [ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js]
26-
var Point = (function () {
26+
var Point = /** @class */ (function () {
2727
function Point(x, y) {
2828
this.x = x;
2929
this.y = y;
@@ -36,7 +36,7 @@ var Point = (function () {
3636
})(Point || (Point = {}));
3737
var A;
3838
(function (A) {
39-
var Point = (function () {
39+
var Point = /** @class */ (function () {
4040
function Point(x, y) {
4141
this.x = x;
4242
this.y = y;

tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module A {
2323
}
2424

2525
//// [ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js]
26-
var Point = (function () {
26+
var Point = /** @class */ (function () {
2727
function Point(x, y) {
2828
this.x = x;
2929
this.y = y;
@@ -36,7 +36,7 @@ var Point = (function () {
3636
})(Point || (Point = {}));
3737
var A;
3838
(function (A) {
39-
var Point = (function () {
39+
var Point = /** @class */ (function () {
4040
function Point(x, y) {
4141
this.x = x;
4242
this.y = y;

tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module A {
2323
}
2424

2525
//// [ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js]
26-
var Point = (function () {
26+
var Point = /** @class */ (function () {
2727
function Point(x, y) {
2828
this.x = x;
2929
this.y = y;
@@ -36,7 +36,7 @@ var Point = (function () {
3636
})(Point || (Point = {}));
3737
var A;
3838
(function (A) {
39-
var Point = (function () {
39+
var Point = /** @class */ (function () {
4040
function Point(x, y) {
4141
this.x = x;
4242
this.y = y;

tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var X;
4545
(function (X) {
4646
var Y;
4747
(function (Y) {
48-
var Point = (function () {
48+
var Point = /** @class */ (function () {
4949
function Point(x, y) {
5050
this.x = x;
5151
this.y = y;
@@ -71,7 +71,7 @@ var X;
7171
var cl = new X.Y.Point(1, 1);
7272
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
7373
//// [simple.js]
74-
var A = (function () {
74+
var A = /** @class */ (function () {
7575
function A() {
7676
}
7777
return A;

tests/baselines/reference/ClassDeclaration10.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class C {
55
}
66

77
//// [ClassDeclaration10.js]
8-
var C = (function () {
8+
var C = /** @class */ (function () {
99
function C() {
1010
}
1111
return C;

tests/baselines/reference/ClassDeclaration11.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class C {
55
}
66

77
//// [ClassDeclaration11.js]
8-
var C = (function () {
8+
var C = /** @class */ (function () {
99
function C() {
1010
}
1111
C.prototype.foo = function () { };

tests/baselines/reference/ClassDeclaration13.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class C {
55
}
66

77
//// [ClassDeclaration13.js]
8-
var C = (function () {
8+
var C = /** @class */ (function () {
99
function C() {
1010
}
1111
C.prototype.bar = function () { };

tests/baselines/reference/ClassDeclaration14.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class C {
55
}
66

77
//// [ClassDeclaration14.js]
8-
var C = (function () {
8+
var C = /** @class */ (function () {
99
function C() {
1010
}
1111
return C;

tests/baselines/reference/ClassDeclaration15.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class C {
55
}
66

77
//// [ClassDeclaration15.js]
8-
var C = (function () {
8+
var C = /** @class */ (function () {
99
function C() {
1010
}
1111
return C;

tests/baselines/reference/ClassDeclaration21.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class C {
55
}
66

77
//// [ClassDeclaration21.js]
8-
var C = (function () {
8+
var C = /** @class */ (function () {
99
function C() {
1010
}
1111
C.prototype[1] = function () { };

tests/baselines/reference/ClassDeclaration22.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class C {
55
}
66

77
//// [ClassDeclaration22.js]
8-
var C = (function () {
8+
var C = /** @class */ (function () {
99
function C() {
1010
}
1111
C.prototype["bar"] = function () { };

tests/baselines/reference/ClassDeclaration24.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class any {
33
}
44

55
//// [ClassDeclaration24.js]
6-
var any = (function () {
6+
var any = /** @class */ (function () {
77
function any() {
88
}
99
return any;

tests/baselines/reference/ClassDeclaration25.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class List<U> implements IList<U> {
1010

1111

1212
//// [ClassDeclaration25.js]
13-
var List = (function () {
13+
var List = /** @class */ (function () {
1414
function List() {
1515
}
1616
return List;

tests/baselines/reference/ClassDeclaration26.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class C {
66
}
77

88
//// [ClassDeclaration26.js]
9-
var C = (function () {
9+
var C = /** @class */ (function () {
1010
function C() {
1111
this.foo = 10;
1212
}

tests/baselines/reference/ClassDeclaration8.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class C {
44
}
55

66
//// [ClassDeclaration8.js]
7-
var C = (function () {
7+
var C = /** @class */ (function () {
88
function C() {
99
}
1010
return C;

tests/baselines/reference/ClassDeclaration9.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class C {
44
}
55

66
//// [ClassDeclaration9.js]
7-
var C = (function () {
7+
var C = /** @class */ (function () {
88
function C() {
99
}
1010
return C;

tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class AtomicNumbers {
44
}
55

66
//// [ClassDeclarationWithInvalidConstOnPropertyDeclaration.js]
7-
var AtomicNumbers = (function () {
7+
var AtomicNumbers = /** @class */ (function () {
88
function AtomicNumbers() {
99
}
1010
AtomicNumbers.H = 1;

tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class C {
55
}
66

77
//// [ClassDeclarationWithInvalidConstOnPropertyDeclaration2.js]
8-
var C = (function () {
8+
var C = /** @class */ (function () {
99
function C() {
1010
this.x = 10;
1111
}

tests/baselines/reference/ES5For-ofTypeCheck10.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ for (var v of new StringIterator) { }
1616

1717
//// [ES5For-ofTypeCheck10.js]
1818
// In ES3/5, you cannot for...of over an arbitrary iterable.
19-
var StringIterator = (function () {
19+
var StringIterator = /** @class */ (function () {
2020
function StringIterator() {
2121
}
2222
StringIterator.prototype.next = function () {

tests/baselines/reference/ES5SymbolProperty2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module M {
1414
var M;
1515
(function (M) {
1616
var Symbol;
17-
var C = (function () {
17+
var C = /** @class */ (function () {
1818
function C() {
1919
}
2020
C.prototype[Symbol.iterator] = function () { };

tests/baselines/reference/ES5SymbolProperty3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class C {
99

1010
//// [ES5SymbolProperty3.js]
1111
var Symbol;
12-
var C = (function () {
12+
var C = /** @class */ (function () {
1313
function C() {
1414
}
1515
C.prototype[Symbol.iterator] = function () { };

tests/baselines/reference/ES5SymbolProperty4.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class C {
99

1010
//// [ES5SymbolProperty4.js]
1111
var Symbol;
12-
var C = (function () {
12+
var C = /** @class */ (function () {
1313
function C() {
1414
}
1515
C.prototype[Symbol.iterator] = function () { };

tests/baselines/reference/ES5SymbolProperty5.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class C {
99

1010
//// [ES5SymbolProperty5.js]
1111
var Symbol;
12-
var C = (function () {
12+
var C = /** @class */ (function () {
1313
function C() {
1414
}
1515
C.prototype[Symbol.iterator] = function () { };

tests/baselines/reference/ES5SymbolProperty6.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class C {
66
(new C)[Symbol.iterator]
77

88
//// [ES5SymbolProperty6.js]
9-
var C = (function () {
9+
var C = /** @class */ (function () {
1010
function C() {
1111
}
1212
C.prototype[Symbol.iterator] = function () { };

0 commit comments

Comments
 (0)