File tree Expand file tree Collapse file tree 18 files changed +222
-4
lines changed Expand file tree Collapse file tree 18 files changed +222
-4
lines changed Original file line number Diff line number Diff line change @@ -1989,7 +1989,14 @@ module ts {
1989
1989
}
1990
1990
1991
1991
function emitNode ( node : Node ) {
1992
- if ( ! node || node . flags & NodeFlags . Ambient ) return ;
1992
+ if ( ! node ) {
1993
+ return ;
1994
+ }
1995
+
1996
+ if ( node . flags & NodeFlags . Ambient ) {
1997
+ return emitPinnedOrTripleSlashComments ( node ) ;
1998
+ }
1999
+
1993
2000
switch ( node . kind ) {
1994
2001
case SyntaxKind . Identifier :
1995
2002
return emitIdentifier ( < Identifier > node ) ;
Original file line number Diff line number Diff line change 1
- //// [commentOnAmbientClass1.ts]
1
+ //// [tests/cases/compiler/commentOnAmbientClass1.ts] ////
2
+
3
+ //// [a.ts]
2
4
/*! Keep this pinned comment */
3
5
declare class C {
4
6
}
5
7
6
8
// Don't keep this comment.
7
9
declare class D {
10
+ }
11
+
12
+ //// [b.ts]
13
+ ///<reference path="a.ts"/>
14
+ declare class E extends C {
8
15
}
9
16
10
- //// [commentOnAmbientClass1.js]
17
+ //// [a.js]
18
+ /*! Keep this pinned comment */
19
+ //// [b.js]
20
+ ///<reference path="a.ts"/>
Original file line number Diff line number Diff line change 1
- === tests/cases/compiler/commentOnAmbientClass1.ts ===
1
+ === tests/cases/compiler/b.ts ===
2
+ ///<reference path="a.ts"/>
3
+ declare class E extends C {
4
+ >E : E
5
+ >C : C
6
+ }
7
+ === tests/cases/compiler/a.ts ===
2
8
/*! Keep this pinned comment */
3
9
declare class C {
4
10
>C : C
@@ -8,3 +14,4 @@ declare class C {
8
14
declare class D {
9
15
>D : D
10
16
}
17
+
Original file line number Diff line number Diff line change
1
+ //// [tests/cases/compiler/commentOnAmbientEnum.ts] ////
2
+
3
+ //// [a.ts]
4
+ /*! Keep this pinned comment */
5
+ declare enum C {
6
+ a ,
7
+ b ,
8
+ c
9
+ }
10
+
11
+ // Don't keep this comment.
12
+ declare enum D {
13
+ }
14
+
15
+ //// [b.ts]
16
+ ///<reference path="a.ts"/>
17
+ declare enum E {
18
+ }
19
+
20
+ //// [a.js]
21
+ /*! Keep this pinned comment */
22
+ //// [b.js]
23
+ ///<reference path="a.ts"/>
Original file line number Diff line number Diff line change
1
+ === tests/cases/compiler/b.ts ===
2
+ ///<reference path="a.ts"/>
3
+ declare enum E {
4
+ >E : E
5
+ }
6
+ === tests/cases/compiler/a.ts ===
7
+ /*! Keep this pinned comment */
8
+ declare enum C {
9
+ >C : C
10
+
11
+ a,
12
+ >a : C
13
+
14
+ b,
15
+ >b : C
16
+
17
+ c
18
+ >c : C
19
+ }
20
+
21
+ // Don't keep this comment.
22
+ declare enum D {
23
+ >D : D
24
+ }
25
+
Original file line number Diff line number Diff line change
1
+ //// [tests/cases/compiler/commentOnAmbientModule.ts] ////
2
+
3
+ //// [a.ts]
4
+ /*! Keep this pinned comment */
5
+ declare module C {
6
+ function foo ( ) ;
7
+ }
8
+
9
+ // Don't keep this comment.
10
+ declare module D {
11
+ class bar { }
12
+ }
13
+
14
+ //// [b.ts]
15
+ ///<reference path="a.ts"/>
16
+ declare module E {
17
+ class foobar extends D . bar {
18
+ foo ( ) ;
19
+ }
20
+ }
21
+
22
+ //// [a.js]
23
+ /*! Keep this pinned comment */
24
+ //// [b.js]
25
+ ///<reference path="a.ts"/>
Original file line number Diff line number Diff line change
1
+ === tests/cases/compiler/b.ts ===
2
+ ///<reference path="a.ts"/>
3
+ declare module E {
4
+ >E : typeof E
5
+
6
+ class foobar extends D.bar {
7
+ >foobar : foobar
8
+ >D : D
9
+ >bar : bar
10
+
11
+ foo();
12
+ >foo : () => any
13
+ }
14
+ }
15
+ === tests/cases/compiler/a.ts ===
16
+ /*! Keep this pinned comment */
17
+ declare module C {
18
+ >C : typeof C
19
+
20
+ function foo();
21
+ >foo : () => any
22
+ }
23
+
24
+ // Don't keep this comment.
25
+ declare module D {
26
+ >D : typeof D
27
+
28
+ class bar { }
29
+ >bar : bar
30
+ }
31
+
Original file line number Diff line number Diff line change @@ -6,3 +6,4 @@ declare var v: number;
6
6
declare var y: number ;
7
7
8
8
//// [commentOnAmbientVariable1.js]
9
+ /*! Keep this pinned comment */
Original file line number Diff line number Diff line change 11
11
//// [commentOnAmbientVariable2_1.js]
12
12
var y = 1 ;
13
13
//// [commentOnAmbientVariable2_2.js]
14
+ /// <reference path='commentOnAmbientVariable2_1.ts'/>
14
15
x = 2 ;
Original file line number Diff line number Diff line change
1
+ //// [tests/cases/compiler/commentOnAmbientfunction.ts] ////
2
+
3
+ //// [a.ts]
4
+ /*! Keep this pinned comment */
5
+ declare function foo ( ) ;
6
+
7
+ // Don't keep this comment.
8
+ declare function bar ( ) ;
9
+
10
+ //// [b.ts]
11
+ ///<reference path="a.ts"/>
12
+ declare function foobar ( a : typeof foo ) : typeof bar ;
13
+
14
+ //// [a.js]
15
+ /*! Keep this pinned comment */
16
+ //// [b.js]
17
+ ///<reference path="a.ts"/>
You can’t perform that action at this time.
0 commit comments