mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-20 22:51:17 -05:00
fix(35779): emit comments after trailing comma (#37887)
This commit is contained in:
@@ -4165,20 +4165,26 @@ namespace ts {
|
||||
}
|
||||
|
||||
// Write a trailing comma, if requested.
|
||||
const hasTrailingComma = (format & ListFormat.AllowTrailingComma) && children!.hasTrailingComma;
|
||||
if (format & ListFormat.CommaDelimited && hasTrailingComma) {
|
||||
writePunctuation(",");
|
||||
const emitFlags = previousSibling ? getEmitFlags(previousSibling) : 0;
|
||||
const skipTrailingComments = commentsDisabled || !!(emitFlags & EmitFlags.NoTrailingComments);
|
||||
const hasTrailingComma = children?.hasTrailingComma && (format & ListFormat.AllowTrailingComma) && (format & ListFormat.CommaDelimited);
|
||||
if (hasTrailingComma) {
|
||||
if (previousSibling && !skipTrailingComments) {
|
||||
emitTokenWithComment(SyntaxKind.CommaToken, previousSibling.end, writePunctuation, previousSibling);
|
||||
}
|
||||
else {
|
||||
writePunctuation(",");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Emit any trailing comment of the last element in the list
|
||||
// i.e
|
||||
// var array = [...
|
||||
// 2
|
||||
// /* end of element 2 */
|
||||
// ];
|
||||
if (previousSibling && format & ListFormat.DelimitersMask && previousSibling.end !== parentNode.end && !(getEmitFlags(previousSibling) & EmitFlags.NoTrailingComments)) {
|
||||
emitLeadingCommentsOfPosition(previousSibling.end);
|
||||
if (previousSibling && parentNode.end !== previousSibling.end && (format & ListFormat.DelimitersMask) && !skipTrailingComments) {
|
||||
emitLeadingCommentsOfPosition(hasTrailingComma && children?.end ? children.end : previousSibling.end);
|
||||
}
|
||||
|
||||
// Decrease the indent, if requested.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//// [commentOnArrayElement1.ts]
|
||||
var array = [
|
||||
const array = [
|
||||
/* element 1*/
|
||||
1
|
||||
/* end of element 1 */,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement1.ts ===
|
||||
var array = [
|
||||
>array : Symbol(array, Decl(commentOnArrayElement1.ts, 0, 3))
|
||||
const array = [
|
||||
>array : Symbol(array, Decl(commentOnArrayElement1.ts, 0, 5))
|
||||
|
||||
/* element 1*/
|
||||
1
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement1.ts ===
|
||||
var array = [
|
||||
const array = [
|
||||
>array : number[]
|
||||
>[ /* element 1*/ 1 /* end of element 1 */, 2 /* end of element 2 */] : number[]
|
||||
|
||||
|
||||
6
tests/baselines/reference/commentOnArrayElement10.js
Normal file
6
tests/baselines/reference/commentOnArrayElement10.js
Normal file
@@ -0,0 +1,6 @@
|
||||
//// [commentOnArrayElement10.ts]
|
||||
const array = [,, /* comment */];
|
||||
|
||||
|
||||
//// [commentOnArrayElement10.js]
|
||||
var array = [, , /* comment */];
|
||||
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement10.ts ===
|
||||
const array = [,, /* comment */];
|
||||
>array : Symbol(array, Decl(commentOnArrayElement10.ts, 0, 5))
|
||||
|
||||
7
tests/baselines/reference/commentOnArrayElement10.types
Normal file
7
tests/baselines/reference/commentOnArrayElement10.types
Normal file
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement10.ts ===
|
||||
const array = [,, /* comment */];
|
||||
>array : any[]
|
||||
>[,, /* comment */] : undefined[]
|
||||
> : undefined
|
||||
> : undefined
|
||||
|
||||
10
tests/baselines/reference/commentOnArrayElement11.js
Normal file
10
tests/baselines/reference/commentOnArrayElement11.js
Normal file
@@ -0,0 +1,10 @@
|
||||
//// [commentOnArrayElement11.ts]
|
||||
const array = [
|
||||
, /* comment */
|
||||
];
|
||||
|
||||
|
||||
//// [commentOnArrayElement11.js]
|
||||
var array = [
|
||||
, /* comment */
|
||||
];
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement11.ts ===
|
||||
const array = [
|
||||
>array : Symbol(array, Decl(commentOnArrayElement11.ts, 0, 5))
|
||||
|
||||
, /* comment */
|
||||
];
|
||||
|
||||
10
tests/baselines/reference/commentOnArrayElement11.types
Normal file
10
tests/baselines/reference/commentOnArrayElement11.types
Normal file
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement11.ts ===
|
||||
const array = [
|
||||
>array : any[]
|
||||
>[ , /* comment */] : undefined[]
|
||||
|
||||
, /* comment */
|
||||
> : undefined
|
||||
|
||||
];
|
||||
|
||||
11
tests/baselines/reference/commentOnArrayElement12.js
Normal file
11
tests/baselines/reference/commentOnArrayElement12.js
Normal file
@@ -0,0 +1,11 @@
|
||||
//// [commentOnArrayElement12.ts]
|
||||
const array = [
|
||||
,, /* comment */
|
||||
];
|
||||
|
||||
|
||||
//// [commentOnArrayElement12.js]
|
||||
var array = [
|
||||
,
|
||||
, /* comment */
|
||||
];
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement12.ts ===
|
||||
const array = [
|
||||
>array : Symbol(array, Decl(commentOnArrayElement12.ts, 0, 5))
|
||||
|
||||
,, /* comment */
|
||||
];
|
||||
|
||||
11
tests/baselines/reference/commentOnArrayElement12.types
Normal file
11
tests/baselines/reference/commentOnArrayElement12.types
Normal file
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement12.ts ===
|
||||
const array = [
|
||||
>array : any[]
|
||||
>[ ,, /* comment */] : undefined[]
|
||||
|
||||
,, /* comment */
|
||||
> : undefined
|
||||
> : undefined
|
||||
|
||||
];
|
||||
|
||||
6
tests/baselines/reference/commentOnArrayElement13.js
Normal file
6
tests/baselines/reference/commentOnArrayElement13.js
Normal file
@@ -0,0 +1,6 @@
|
||||
//// [commentOnArrayElement13.ts]
|
||||
const array = [/* comment */];
|
||||
|
||||
|
||||
//// [commentOnArrayElement13.js]
|
||||
var array = [ /* comment */];
|
||||
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement13.ts ===
|
||||
const array = [/* comment */];
|
||||
>array : Symbol(array, Decl(commentOnArrayElement13.ts, 0, 5))
|
||||
|
||||
5
tests/baselines/reference/commentOnArrayElement13.types
Normal file
5
tests/baselines/reference/commentOnArrayElement13.types
Normal file
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement13.ts ===
|
||||
const array = [/* comment */];
|
||||
>array : any[]
|
||||
>[/* comment */] : undefined[]
|
||||
|
||||
6
tests/baselines/reference/commentOnArrayElement14.js
Normal file
6
tests/baselines/reference/commentOnArrayElement14.js
Normal file
@@ -0,0 +1,6 @@
|
||||
//// [commentOnArrayElement14.ts]
|
||||
const array = [1 /* comment */];
|
||||
|
||||
|
||||
//// [commentOnArrayElement14.js]
|
||||
var array = [1 /* comment */];
|
||||
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement14.ts ===
|
||||
const array = [1 /* comment */];
|
||||
>array : Symbol(array, Decl(commentOnArrayElement14.ts, 0, 5))
|
||||
|
||||
6
tests/baselines/reference/commentOnArrayElement14.types
Normal file
6
tests/baselines/reference/commentOnArrayElement14.types
Normal file
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement14.ts ===
|
||||
const array = [1 /* comment */];
|
||||
>array : number[]
|
||||
>[1 /* comment */] : number[]
|
||||
>1 : 1
|
||||
|
||||
6
tests/baselines/reference/commentOnArrayElement15.js
Normal file
6
tests/baselines/reference/commentOnArrayElement15.js
Normal file
@@ -0,0 +1,6 @@
|
||||
//// [commentOnArrayElement15.ts]
|
||||
const array = [/* comment */ 1 /* comment */];
|
||||
|
||||
|
||||
//// [commentOnArrayElement15.js]
|
||||
var array = [/* comment */ 1 /* comment */];
|
||||
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement15.ts ===
|
||||
const array = [/* comment */ 1 /* comment */];
|
||||
>array : Symbol(array, Decl(commentOnArrayElement15.ts, 0, 5))
|
||||
|
||||
6
tests/baselines/reference/commentOnArrayElement15.types
Normal file
6
tests/baselines/reference/commentOnArrayElement15.types
Normal file
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement15.ts ===
|
||||
const array = [/* comment */ 1 /* comment */];
|
||||
>array : number[]
|
||||
>[/* comment */ 1 /* comment */] : number[]
|
||||
>1 : 1
|
||||
|
||||
16
tests/baselines/reference/commentOnArrayElement16.js
Normal file
16
tests/baselines/reference/commentOnArrayElement16.js
Normal file
@@ -0,0 +1,16 @@
|
||||
//// [commentOnArrayElement16.ts]
|
||||
const array = [
|
||||
// comment start
|
||||
1,
|
||||
2,
|
||||
// comment end
|
||||
];
|
||||
|
||||
|
||||
//// [commentOnArrayElement16.js]
|
||||
var array = [
|
||||
// comment start
|
||||
1,
|
||||
2,
|
||||
// comment end
|
||||
];
|
||||
10
tests/baselines/reference/commentOnArrayElement16.symbols
Normal file
10
tests/baselines/reference/commentOnArrayElement16.symbols
Normal file
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement16.ts ===
|
||||
const array = [
|
||||
>array : Symbol(array, Decl(commentOnArrayElement16.ts, 0, 5))
|
||||
|
||||
// comment start
|
||||
1,
|
||||
2,
|
||||
// comment end
|
||||
];
|
||||
|
||||
15
tests/baselines/reference/commentOnArrayElement16.types
Normal file
15
tests/baselines/reference/commentOnArrayElement16.types
Normal file
@@ -0,0 +1,15 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement16.ts ===
|
||||
const array = [
|
||||
>array : number[]
|
||||
>[ // comment start 1, 2, // comment end] : number[]
|
||||
|
||||
// comment start
|
||||
1,
|
||||
>1 : 1
|
||||
|
||||
2,
|
||||
>2 : 2
|
||||
|
||||
// comment end
|
||||
];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//// [commentOnArrayElement2.ts]
|
||||
var array = [
|
||||
const array = [
|
||||
/* element 1*/
|
||||
1 /* end of element 1 */,
|
||||
2
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement2.ts ===
|
||||
var array = [
|
||||
>array : Symbol(array, Decl(commentOnArrayElement2.ts, 0, 3))
|
||||
const array = [
|
||||
>array : Symbol(array, Decl(commentOnArrayElement2.ts, 0, 5))
|
||||
|
||||
/* element 1*/
|
||||
1 /* end of element 1 */,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement2.ts ===
|
||||
var array = [
|
||||
const array = [
|
||||
>array : number[]
|
||||
>[ /* element 1*/ 1 /* end of element 1 */, 2 /* end of element 2 */] : number[]
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//// [commentOnArrayElement3.ts]
|
||||
var array = [
|
||||
const array = [
|
||||
/* element 1*/
|
||||
1
|
||||
/* end of element 1 */,
|
||||
@@ -16,4 +16,5 @@ var array = [
|
||||
2
|
||||
/* end of element 2 */ ,
|
||||
,
|
||||
/* extra comment */
|
||||
];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement3.ts ===
|
||||
var array = [
|
||||
>array : Symbol(array, Decl(commentOnArrayElement3.ts, 0, 3))
|
||||
const array = [
|
||||
>array : Symbol(array, Decl(commentOnArrayElement3.ts, 0, 5))
|
||||
|
||||
/* element 1*/
|
||||
1
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement3.ts ===
|
||||
var array = [
|
||||
const array = [
|
||||
>array : number[]
|
||||
>[ /* element 1*/ 1 /* end of element 1 */, 2 /* end of element 2 */, , /* extra comment */] : number[]
|
||||
|
||||
|
||||
14
tests/baselines/reference/commentOnArrayElement4.js
Normal file
14
tests/baselines/reference/commentOnArrayElement4.js
Normal file
@@ -0,0 +1,14 @@
|
||||
//// [commentOnArrayElement4.ts]
|
||||
const array = [
|
||||
/* element 1 */
|
||||
1,
|
||||
/* end of element 1 */
|
||||
];
|
||||
|
||||
|
||||
//// [commentOnArrayElement4.js]
|
||||
var array = [
|
||||
/* element 1 */
|
||||
1,
|
||||
/* end of element 1 */
|
||||
];
|
||||
9
tests/baselines/reference/commentOnArrayElement4.symbols
Normal file
9
tests/baselines/reference/commentOnArrayElement4.symbols
Normal file
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement4.ts ===
|
||||
const array = [
|
||||
>array : Symbol(array, Decl(commentOnArrayElement4.ts, 0, 5))
|
||||
|
||||
/* element 1 */
|
||||
1,
|
||||
/* end of element 1 */
|
||||
];
|
||||
|
||||
12
tests/baselines/reference/commentOnArrayElement4.types
Normal file
12
tests/baselines/reference/commentOnArrayElement4.types
Normal file
@@ -0,0 +1,12 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement4.ts ===
|
||||
const array = [
|
||||
>array : number[]
|
||||
>[ /* element 1 */ 1, /* end of element 1 */] : number[]
|
||||
|
||||
/* element 1 */
|
||||
1,
|
||||
>1 : 1
|
||||
|
||||
/* end of element 1 */
|
||||
];
|
||||
|
||||
16
tests/baselines/reference/commentOnArrayElement5.js
Normal file
16
tests/baselines/reference/commentOnArrayElement5.js
Normal file
@@ -0,0 +1,16 @@
|
||||
//// [commentOnArrayElement5.ts]
|
||||
const array = [
|
||||
/* element 1 */
|
||||
1,
|
||||
/* end of element 1 */
|
||||
/* extra comment */
|
||||
];
|
||||
|
||||
|
||||
//// [commentOnArrayElement5.js]
|
||||
var array = [
|
||||
/* element 1 */
|
||||
1,
|
||||
/* end of element 1 */
|
||||
/* extra comment */
|
||||
];
|
||||
10
tests/baselines/reference/commentOnArrayElement5.symbols
Normal file
10
tests/baselines/reference/commentOnArrayElement5.symbols
Normal file
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement5.ts ===
|
||||
const array = [
|
||||
>array : Symbol(array, Decl(commentOnArrayElement5.ts, 0, 5))
|
||||
|
||||
/* element 1 */
|
||||
1,
|
||||
/* end of element 1 */
|
||||
/* extra comment */
|
||||
];
|
||||
|
||||
13
tests/baselines/reference/commentOnArrayElement5.types
Normal file
13
tests/baselines/reference/commentOnArrayElement5.types
Normal file
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement5.ts ===
|
||||
const array = [
|
||||
>array : number[]
|
||||
>[ /* element 1 */ 1, /* end of element 1 */ /* extra comment */] : number[]
|
||||
|
||||
/* element 1 */
|
||||
1,
|
||||
>1 : 1
|
||||
|
||||
/* end of element 1 */
|
||||
/* extra comment */
|
||||
];
|
||||
|
||||
6
tests/baselines/reference/commentOnArrayElement6.js
Normal file
6
tests/baselines/reference/commentOnArrayElement6.js
Normal file
@@ -0,0 +1,6 @@
|
||||
//// [commentOnArrayElement6.ts]
|
||||
const array = [1, /* comment */];
|
||||
|
||||
|
||||
//// [commentOnArrayElement6.js]
|
||||
var array = [1, /* comment */];
|
||||
4
tests/baselines/reference/commentOnArrayElement6.symbols
Normal file
4
tests/baselines/reference/commentOnArrayElement6.symbols
Normal file
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement6.ts ===
|
||||
const array = [1, /* comment */];
|
||||
>array : Symbol(array, Decl(commentOnArrayElement6.ts, 0, 5))
|
||||
|
||||
6
tests/baselines/reference/commentOnArrayElement6.types
Normal file
6
tests/baselines/reference/commentOnArrayElement6.types
Normal file
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement6.ts ===
|
||||
const array = [1, /* comment */];
|
||||
>array : number[]
|
||||
>[1, /* comment */] : number[]
|
||||
>1 : 1
|
||||
|
||||
6
tests/baselines/reference/commentOnArrayElement7.js
Normal file
6
tests/baselines/reference/commentOnArrayElement7.js
Normal file
@@ -0,0 +1,6 @@
|
||||
//// [commentOnArrayElement7.ts]
|
||||
const array = [/* element 1 */ 1, /* end of element 1 */];
|
||||
|
||||
|
||||
//// [commentOnArrayElement7.js]
|
||||
var array = [/* element 1 */ 1, /* end of element 1 */];
|
||||
4
tests/baselines/reference/commentOnArrayElement7.symbols
Normal file
4
tests/baselines/reference/commentOnArrayElement7.symbols
Normal file
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement7.ts ===
|
||||
const array = [/* element 1 */ 1, /* end of element 1 */];
|
||||
>array : Symbol(array, Decl(commentOnArrayElement7.ts, 0, 5))
|
||||
|
||||
6
tests/baselines/reference/commentOnArrayElement7.types
Normal file
6
tests/baselines/reference/commentOnArrayElement7.types
Normal file
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement7.ts ===
|
||||
const array = [/* element 1 */ 1, /* end of element 1 */];
|
||||
>array : number[]
|
||||
>[/* element 1 */ 1, /* end of element 1 */] : number[]
|
||||
>1 : 1
|
||||
|
||||
10
tests/baselines/reference/commentOnArrayElement8.js
Normal file
10
tests/baselines/reference/commentOnArrayElement8.js
Normal file
@@ -0,0 +1,10 @@
|
||||
//// [commentOnArrayElement8.ts]
|
||||
const array = [
|
||||
1, /* comment */
|
||||
];
|
||||
|
||||
|
||||
//// [commentOnArrayElement8.js]
|
||||
var array = [
|
||||
1, /* comment */
|
||||
];
|
||||
7
tests/baselines/reference/commentOnArrayElement8.symbols
Normal file
7
tests/baselines/reference/commentOnArrayElement8.symbols
Normal file
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement8.ts ===
|
||||
const array = [
|
||||
>array : Symbol(array, Decl(commentOnArrayElement8.ts, 0, 5))
|
||||
|
||||
1, /* comment */
|
||||
];
|
||||
|
||||
10
tests/baselines/reference/commentOnArrayElement8.types
Normal file
10
tests/baselines/reference/commentOnArrayElement8.types
Normal file
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement8.ts ===
|
||||
const array = [
|
||||
>array : number[]
|
||||
>[ 1, /* comment */] : number[]
|
||||
|
||||
1, /* comment */
|
||||
>1 : 1
|
||||
|
||||
];
|
||||
|
||||
10
tests/baselines/reference/commentOnArrayElement9.js
Normal file
10
tests/baselines/reference/commentOnArrayElement9.js
Normal file
@@ -0,0 +1,10 @@
|
||||
//// [commentOnArrayElement9.ts]
|
||||
const array = [
|
||||
/* element 1 */ 1, /* end of element 1 */
|
||||
];
|
||||
|
||||
|
||||
//// [commentOnArrayElement9.js]
|
||||
var array = [
|
||||
/* element 1 */ 1, /* end of element 1 */
|
||||
];
|
||||
7
tests/baselines/reference/commentOnArrayElement9.symbols
Normal file
7
tests/baselines/reference/commentOnArrayElement9.symbols
Normal file
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement9.ts ===
|
||||
const array = [
|
||||
>array : Symbol(array, Decl(commentOnArrayElement9.ts, 0, 5))
|
||||
|
||||
/* element 1 */ 1, /* end of element 1 */
|
||||
];
|
||||
|
||||
10
tests/baselines/reference/commentOnArrayElement9.types
Normal file
10
tests/baselines/reference/commentOnArrayElement9.types
Normal file
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/commentOnArrayElement9.ts ===
|
||||
const array = [
|
||||
>array : number[]
|
||||
>[ /* element 1 */ 1, /* end of element 1 */] : number[]
|
||||
|
||||
/* element 1 */ 1, /* end of element 1 */
|
||||
>1 : 1
|
||||
|
||||
];
|
||||
|
||||
@@ -26,7 +26,7 @@ var x = {
|
||||
\u0061: "ss",
|
||||
a: {
|
||||
c: 1,
|
||||
"c": 56,
|
||||
"c": 56, // Duplicate
|
||||
}
|
||||
};
|
||||
var y = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var array = [
|
||||
const array = [
|
||||
/* element 1*/
|
||||
1
|
||||
/* end of element 1 */,
|
||||
|
||||
1
tests/cases/compiler/commentOnArrayElement10.ts
Normal file
1
tests/cases/compiler/commentOnArrayElement10.ts
Normal file
@@ -0,0 +1 @@
|
||||
const array = [,, /* comment */];
|
||||
3
tests/cases/compiler/commentOnArrayElement11.ts
Normal file
3
tests/cases/compiler/commentOnArrayElement11.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
const array = [
|
||||
, /* comment */
|
||||
];
|
||||
3
tests/cases/compiler/commentOnArrayElement12.ts
Normal file
3
tests/cases/compiler/commentOnArrayElement12.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
const array = [
|
||||
,, /* comment */
|
||||
];
|
||||
1
tests/cases/compiler/commentOnArrayElement13.ts
Normal file
1
tests/cases/compiler/commentOnArrayElement13.ts
Normal file
@@ -0,0 +1 @@
|
||||
const array = [/* comment */];
|
||||
1
tests/cases/compiler/commentOnArrayElement14.ts
Normal file
1
tests/cases/compiler/commentOnArrayElement14.ts
Normal file
@@ -0,0 +1 @@
|
||||
const array = [1 /* comment */];
|
||||
1
tests/cases/compiler/commentOnArrayElement15.ts
Normal file
1
tests/cases/compiler/commentOnArrayElement15.ts
Normal file
@@ -0,0 +1 @@
|
||||
const array = [/* comment */ 1 /* comment */];
|
||||
6
tests/cases/compiler/commentOnArrayElement16.ts
Normal file
6
tests/cases/compiler/commentOnArrayElement16.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
const array = [
|
||||
// comment start
|
||||
1,
|
||||
2,
|
||||
// comment end
|
||||
];
|
||||
@@ -1,4 +1,4 @@
|
||||
var array = [
|
||||
const array = [
|
||||
/* element 1*/
|
||||
1 /* end of element 1 */,
|
||||
2
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var array = [
|
||||
const array = [
|
||||
/* element 1*/
|
||||
1
|
||||
/* end of element 1 */,
|
||||
|
||||
5
tests/cases/compiler/commentOnArrayElement4.ts
Normal file
5
tests/cases/compiler/commentOnArrayElement4.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
const array = [
|
||||
/* element 1 */
|
||||
1,
|
||||
/* end of element 1 */
|
||||
];
|
||||
6
tests/cases/compiler/commentOnArrayElement5.ts
Normal file
6
tests/cases/compiler/commentOnArrayElement5.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
const array = [
|
||||
/* element 1 */
|
||||
1,
|
||||
/* end of element 1 */
|
||||
/* extra comment */
|
||||
];
|
||||
1
tests/cases/compiler/commentOnArrayElement6.ts
Normal file
1
tests/cases/compiler/commentOnArrayElement6.ts
Normal file
@@ -0,0 +1 @@
|
||||
const array = [1, /* comment */];
|
||||
1
tests/cases/compiler/commentOnArrayElement7.ts
Normal file
1
tests/cases/compiler/commentOnArrayElement7.ts
Normal file
@@ -0,0 +1 @@
|
||||
const array = [/* element 1 */ 1, /* end of element 1 */];
|
||||
3
tests/cases/compiler/commentOnArrayElement8.ts
Normal file
3
tests/cases/compiler/commentOnArrayElement8.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
const array = [
|
||||
1, /* comment */
|
||||
];
|
||||
3
tests/cases/compiler/commentOnArrayElement9.ts
Normal file
3
tests/cases/compiler/commentOnArrayElement9.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
const array = [
|
||||
/* element 1 */ 1, /* end of element 1 */
|
||||
];
|
||||
Reference in New Issue
Block a user