Skip to content

Commit

Permalink
Merge pull request #16631 from Microsoft/fix13721
Browse files Browse the repository at this point in the history
Emit class annotation comment on downlevel classes
  • Loading branch information
DanielRosenwasser authored Aug 14, 2017
2 parents d03d107 + 660a63d commit ea7c7d3
Show file tree
Hide file tree
Showing 3,603 changed files with 7,534 additions and 7,524 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 3 additions & 1 deletion src/compiler/transformers/es2015.ts
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ namespace ts {
outer.end = skipTrivia(currentText, node.pos);
setEmitFlags(outer, EmitFlags.NoComments);

return createParen(
const result = createParen(
createCall(
outer,
/*typeArguments*/ undefined,
Expand All @@ -849,6 +849,8 @@ namespace ts {
: []
)
);
addSyntheticLeadingComment(result, SyntaxKind.MultiLineCommentTrivia, "* @class ");
return result;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/2dArrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ class Board {
}

//// [2dArrays.js]
var Cell = (function () {
var Cell = /** @class */ (function () {
function Cell() {
}
return Cell;
}());
var Ship = (function () {
var Ship = /** @class */ (function () {
function Ship() {
}
return Ship;
}());
var Board = (function () {
var Board = /** @class */ (function () {
function Board() {
}
Board.prototype.allShipsSunk = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var p = new A.Point(0, 0); // unexpected error here, bug 840000
//// [classPoint.js]
var A;
(function (A) {
var Point = (function () {
var Point = /** @class */ (function () {
function Point(x, y) {
this.x = x;
this.y = y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,42 +51,42 @@ module clodule4 {

//// [ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js]
// all expected to be errors
var clodule1 = (function () {
var clodule1 = /** @class */ (function () {
function clodule1() {
}
return clodule1;
}());
(function (clodule1) {
function f(x) { }
})(clodule1 || (clodule1 = {}));
var clodule2 = (function () {
var clodule2 = /** @class */ (function () {
function clodule2() {
}
return clodule2;
}());
(function (clodule2) {
var x;
var D = (function () {
var D = /** @class */ (function () {
function D() {
}
return D;
}());
})(clodule2 || (clodule2 = {}));
var clodule3 = (function () {
var clodule3 = /** @class */ (function () {
function clodule3() {
}
return clodule3;
}());
(function (clodule3) {
clodule3.y = { id: T };
})(clodule3 || (clodule3 = {}));
var clodule4 = (function () {
var clodule4 = /** @class */ (function () {
function clodule4() {
}
return clodule4;
}());
(function (clodule4) {
var D = (function () {
var D = /** @class */ (function () {
function D() {
}
return D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module clodule {


//// [ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js]
var clodule = (function () {
var clodule = /** @class */ (function () {
function clodule() {
}
clodule.fn = function (id) { };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module clodule {


//// [ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js]
var clodule = (function () {
var clodule = /** @class */ (function () {
function clodule() {
}
clodule.fn = function (id) { };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module clodule {


//// [ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js]
var clodule = (function () {
var clodule = /** @class */ (function () {
function clodule() {
}
clodule.sfn = function (id) { return 42; };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module A {
}

//// [ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js]
var Point = (function () {
var Point = /** @class */ (function () {
function Point(x, y) {
this.x = x;
this.y = y;
Expand All @@ -37,7 +37,7 @@ var Point = (function () {
})(Point || (Point = {}));
var A;
(function (A) {
var Point = (function () {
var Point = /** @class */ (function () {
function Point(x, y) {
this.x = x;
this.y = y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module A {
}

//// [ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js]
var Point = (function () {
var Point = /** @class */ (function () {
function Point(x, y) {
this.x = x;
this.y = y;
Expand All @@ -36,7 +36,7 @@ var Point = (function () {
})(Point || (Point = {}));
var A;
(function (A) {
var Point = (function () {
var Point = /** @class */ (function () {
function Point(x, y) {
this.x = x;
this.y = y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module A {
}

//// [ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js]
var Point = (function () {
var Point = /** @class */ (function () {
function Point(x, y) {
this.x = x;
this.y = y;
Expand All @@ -36,7 +36,7 @@ var Point = (function () {
})(Point || (Point = {}));
var A;
(function (A) {
var Point = (function () {
var Point = /** @class */ (function () {
function Point(x, y) {
this.x = x;
this.y = y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module A {
}

//// [ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js]
var Point = (function () {
var Point = /** @class */ (function () {
function Point(x, y) {
this.x = x;
this.y = y;
Expand All @@ -36,7 +36,7 @@ var Point = (function () {
})(Point || (Point = {}));
var A;
(function (A) {
var Point = (function () {
var Point = /** @class */ (function () {
function Point(x, y) {
this.x = x;
this.y = y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var X;
(function (X) {
var Y;
(function (Y) {
var Point = (function () {
var Point = /** @class */ (function () {
function Point(x, y) {
this.x = x;
this.y = y;
Expand All @@ -71,7 +71,7 @@ var X;
var cl = new X.Y.Point(1, 1);
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
//// [simple.js]
var A = (function () {
var A = /** @class */ (function () {
function A() {
}
return A;
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration10.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class C {
}

//// [ClassDeclaration10.js]
var C = (function () {
var C = /** @class */ (function () {
function C() {
}
return C;
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration11.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class C {
}

//// [ClassDeclaration11.js]
var C = (function () {
var C = /** @class */ (function () {
function C() {
}
C.prototype.foo = function () { };
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration13.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class C {
}

//// [ClassDeclaration13.js]
var C = (function () {
var C = /** @class */ (function () {
function C() {
}
C.prototype.bar = function () { };
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration14.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class C {
}

//// [ClassDeclaration14.js]
var C = (function () {
var C = /** @class */ (function () {
function C() {
}
return C;
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration15.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class C {
}

//// [ClassDeclaration15.js]
var C = (function () {
var C = /** @class */ (function () {
function C() {
}
return C;
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration21.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class C {
}

//// [ClassDeclaration21.js]
var C = (function () {
var C = /** @class */ (function () {
function C() {
}
C.prototype[1] = function () { };
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration22.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class C {
}

//// [ClassDeclaration22.js]
var C = (function () {
var C = /** @class */ (function () {
function C() {
}
C.prototype["bar"] = function () { };
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration24.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class any {
}

//// [ClassDeclaration24.js]
var any = (function () {
var any = /** @class */ (function () {
function any() {
}
return any;
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration25.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class List<U> implements IList<U> {


//// [ClassDeclaration25.js]
var List = (function () {
var List = /** @class */ (function () {
function List() {
}
return List;
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration26.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class C {
}

//// [ClassDeclaration26.js]
var C = (function () {
var C = /** @class */ (function () {
function C() {
this.foo = 10;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration8.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class C {
}

//// [ClassDeclaration8.js]
var C = (function () {
var C = /** @class */ (function () {
function C() {
}
return C;
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration9.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class C {
}

//// [ClassDeclaration9.js]
var C = (function () {
var C = /** @class */ (function () {
function C() {
}
return C;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class AtomicNumbers {
}

//// [ClassDeclarationWithInvalidConstOnPropertyDeclaration.js]
var AtomicNumbers = (function () {
var AtomicNumbers = /** @class */ (function () {
function AtomicNumbers() {
}
AtomicNumbers.H = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class C {
}

//// [ClassDeclarationWithInvalidConstOnPropertyDeclaration2.js]
var C = (function () {
var C = /** @class */ (function () {
function C() {
this.x = 10;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5For-ofTypeCheck10.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ for (var v of new StringIterator) { }

//// [ES5For-ofTypeCheck10.js]
// In ES3/5, you cannot for...of over an arbitrary iterable.
var StringIterator = (function () {
var StringIterator = /** @class */ (function () {
function StringIterator() {
}
StringIterator.prototype.next = function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5SymbolProperty2.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module M {
var M;
(function (M) {
var Symbol;
var C = (function () {
var C = /** @class */ (function () {
function C() {
}
C.prototype[Symbol.iterator] = function () { };
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5SymbolProperty3.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class C {

//// [ES5SymbolProperty3.js]
var Symbol;
var C = (function () {
var C = /** @class */ (function () {
function C() {
}
C.prototype[Symbol.iterator] = function () { };
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5SymbolProperty4.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class C {

//// [ES5SymbolProperty4.js]
var Symbol;
var C = (function () {
var C = /** @class */ (function () {
function C() {
}
C.prototype[Symbol.iterator] = function () { };
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5SymbolProperty5.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class C {

//// [ES5SymbolProperty5.js]
var Symbol;
var C = (function () {
var C = /** @class */ (function () {
function C() {
}
C.prototype[Symbol.iterator] = function () { };
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5SymbolProperty6.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class C {
(new C)[Symbol.iterator]

//// [ES5SymbolProperty6.js]
var C = (function () {
var C = /** @class */ (function () {
function C() {
}
C.prototype[Symbol.iterator] = function () { };
Expand Down
Loading

0 comments on commit ea7c7d3

Please sign in to comment.