Skip to content

Commit 3dd21fc

Browse files
committed
Trailing comment tests for parameters, fixes the trailing // comments and parameter indentation
1 parent 1b64519 commit 3dd21fc

File tree

391 files changed

+1600
-1565
lines changed

Some content is hidden

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

391 files changed

+1600
-1565
lines changed

src/compiler/emitter.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,13 +1204,13 @@ module ts {
12041204
}
12051205

12061206
function emitSignatureParameters(node: FunctionDeclaration) {
1207+
increaseIndent();
12071208
write("(");
12081209
if (node) {
1209-
increaseIndent();
12101210
emitCommaList(node.parameters, node.parameters.length - (hasRestParameters(node) ? 1 : 0));
1211-
decreaseIndent();
12121211
}
12131212
write(")");
1213+
decreaseIndent();
12141214
}
12151215

12161216
function emitSignatureAndBody(node: FunctionDeclaration) {
@@ -1386,8 +1386,8 @@ module ts {
13861386
write("function ");
13871387
emitSignatureAndBody(accessors.getAccessor);
13881388
emitEnd(accessors.getAccessor);
1389-
write(",");
13901389
emitTrailingComments(accessors.getAccessor);
1390+
write(",");
13911391
}
13921392
if (accessors.setAccessor) {
13931393
writeLine();
@@ -1397,8 +1397,8 @@ module ts {
13971397
write("function ");
13981398
emitSignatureAndBody(accessors.setAccessor);
13991399
emitEnd(accessors.setAccessor);
1400-
write(",");
14011400
emitTrailingComments(accessors.setAccessor);
1401+
write(",");
14021402
}
14031403
writeLine();
14041404
write("enumerable: true,");

src/compiler/scanner.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,14 @@ module ts {
385385
continue;
386386
case CharacterCodes.slash:
387387
var nextChar = text.charCodeAt(pos + 1);
388+
var hasTrailingNewLine = false;
388389
if (nextChar === CharacterCodes.slash || nextChar === CharacterCodes.asterisk) {
389390
var startPos = pos;
390391
pos += 2;
391392
if (nextChar === CharacterCodes.slash) {
392393
while (pos < text.length) {
393394
if (isLineBreak(text.charCodeAt(pos))) {
395+
hasTrailingNewLine = true;
394396
break;
395397
}
396398
pos++;
@@ -407,7 +409,7 @@ module ts {
407409
}
408410
if (collecting) {
409411
if (!result) result = [];
410-
result.push({ pos: startPos, end: pos });
412+
result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine });
411413
}
412414
continue;
413415
}

tests/baselines/reference/AmbientModuleAndAmbientWithSameNameAndCommonRoot.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ var p = new A.Point(0, 0); // unexpected error here, bug 840000
2828
//// [test.js]
2929
var p;
3030
var p = A.Point.Origin;
31-
var p = new A.Point(0, 0); // unexpected error here, bug 840000
31+
var p = new A.Point(0, 0); // unexpected error here, bug 840000

tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ var Point = (function () {
3030
}
3131
Point.Origin = function () {
3232
return { x: 0, y: 0 };
33-
}; // unexpected error here bug 840246
33+
}; // unexpected error here bug 840246
3434
return Point;
3535
})();
3636
var Point;
3737
(function (Point) {
3838
function Origin() {
3939
return null;
4040
}
41-
Point.Origin = Origin; //expected duplicate identifier error
41+
Point.Origin = Origin; //expected duplicate identifier error
4242
})(Point || (Point = {}));
4343
var A;
4444
(function (A) {
@@ -49,15 +49,15 @@ var A;
4949
}
5050
Point.Origin = function () {
5151
return { x: 0, y: 0 };
52-
}; // unexpected error here bug 840246
52+
}; // unexpected error here bug 840246
5353
return Point;
5454
})();
5555
A.Point = Point;
5656
(function (Point) {
5757
function Origin() {
5858
return "";
5959
}
60-
Point.Origin = Origin; //expected duplicate identifier error
60+
Point.Origin = Origin; //expected duplicate identifier error
6161
})(A.Point || (A.Point = {}));
6262
var Point = A.Point;
6363
})(A || (A = {}));

tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var Point;
3737
(function (Point) {
3838
function Origin() {
3939
return "";
40-
} // not an error, since not exported
40+
} // not an error, since not exported
4141
})(Point || (Point = {}));
4242
var A;
4343
(function (A) {
@@ -55,7 +55,7 @@ var A;
5555
(function (Point) {
5656
function Origin() {
5757
return "";
58-
} // not an error since not exported
58+
} // not an error since not exported
5959
})(A.Point || (A.Point = {}));
6060
var Point = A.Point;
6161
})(A || (A = {}));

tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var Point = (function () {
3333
})();
3434
var Point;
3535
(function (Point) {
36-
Point.Origin = ""; //expected duplicate identifier error
36+
Point.Origin = ""; //expected duplicate identifier error
3737
})(Point || (Point = {}));
3838
var A;
3939
(function (A) {
@@ -47,7 +47,7 @@ var A;
4747
})();
4848
A.Point = Point;
4949
(function (Point) {
50-
Point.Origin = ""; //expected duplicate identifier error
50+
Point.Origin = ""; //expected duplicate identifier error
5151
})(A.Point || (A.Point = {}));
5252
var Point = A.Point;
5353
})(A || (A = {}));

tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var Point = (function () {
3333
})();
3434
var Point;
3535
(function (Point) {
36-
var Origin = ""; // not an error, since not exported
36+
var Origin = ""; // not an error, since not exported
3737
})(Point || (Point = {}));
3838
var A;
3939
(function (A) {
@@ -47,7 +47,7 @@ var A;
4747
})();
4848
A.Point = Point;
4949
(function (Point) {
50-
var Origin = ""; // not an error since not exported
50+
var Origin = ""; // not an error since not exported
5151
})(A.Point || (A.Point = {}));
5252
var Point = A.Point;
5353
})(A || (A = {}));

tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ var X;
6969
//// [test.js]
7070
//var cl: { x: number; y: number; }
7171
var cl = new X.Y.Point(1, 1);
72-
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
72+
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
7373
//// [simple.js]
7474
var A = (function () {
7575
function A() {

tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ var fn;
6464
var fn = A.Point;
6565
var cl;
6666
var cl = A.Point();
67-
var cl = A.Point.Origin; // not expected to be an error.
67+
var cl = A.Point.Origin; // not expected to be an error.
6868
//// [simple.js]
6969
var B;
7070
(function (B) {
@@ -78,7 +78,7 @@ var B;
7878
var Point = B.Point;
7979
})(B || (B = {}));
8080
var fn;
81-
var fn = B.Point; // not expected to be an error. bug 840000: [corelang] Function of fundule not assignalbe as expected
81+
var fn = B.Point; // not expected to be an error. bug 840000: [corelang] Function of fundule not assignalbe as expected
8282
var cl;
8383
var cl = B.Point();
8484
var cl = B.Point.Origin;

tests/baselines/reference/InvalidNonInstantiatedModule.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ var x: typeof M; // Error only a namespace
99

1010

1111
//// [InvalidNonInstantiatedModule.js]
12-
var m = M; // Error, not instantiated can not be used as var
13-
var x; // Error only a namespace
12+
var m = M; // Error, not instantiated can not be used as var
13+
var x; // Error only a namespace

0 commit comments

Comments
 (0)