Skip to content

Commit 393464e

Browse files
committed
Emit pinned/tripleslash reference comments of interfaces
Fixes #501
1 parent 85b892f commit 393464e

File tree

5 files changed

+32
-3
lines changed

5 files changed

+32
-3
lines changed

src/compiler/emitter.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,6 +1682,10 @@ module ts {
16821682
}
16831683
}
16841684

1685+
function emitInterfaceDeclaration(node: InterfaceDeclaration) {
1686+
emitPinnedOrTripleSlashComments(node);
1687+
}
1688+
16851689
function emitEnumDeclaration(node: EnumDeclaration) {
16861690
emitLeadingComments(node);
16871691
if (!(node.flags & NodeFlags.Export)) {
@@ -2089,6 +2093,8 @@ module ts {
20892093
return emitVariableDeclaration(<VariableDeclaration>node);
20902094
case SyntaxKind.ClassDeclaration:
20912095
return emitClassDeclaration(<ClassDeclaration>node);
2096+
case SyntaxKind.InterfaceDeclaration:
2097+
return emitInterfaceDeclaration(<InterfaceDeclaration>node);
20922098
case SyntaxKind.EnumDeclaration:
20932099
return emitEnumDeclaration(<EnumDeclaration>node);
20942100
case SyntaxKind.ModuleDeclaration:

tests/baselines/reference/checkInterfaceBases.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ interface Third extends JQueryEventObjectTest, SecondEvent {}
1616

1717

1818
//// [app.js]
19+
///<reference path='jquery.d.ts' />
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
//// [commentOnInterface1.ts]
1+
//// [tests/cases/compiler/commentOnInterface1.ts] ////
2+
3+
//// [a.ts]
24
/*! Keep this pinned comment */
35
interface I {
46
}
57

68
// Don't keep this comment.
79
interface I2 {
10+
}
11+
12+
//// [b.ts]
13+
///<reference path='a.ts'/>
14+
interface I3 {
815
}
916

10-
//// [commentOnInterface1.js]
17+
//// [a.js]
18+
/*! Keep this pinned comment */
19+
//// [b.js]
20+
///<reference path='a.ts'/>

tests/baselines/reference/commentOnInterface1.types

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
=== tests/cases/compiler/commentOnInterface1.ts ===
1+
=== tests/cases/compiler/b.ts ===
2+
///<reference path='a.ts'/>
3+
interface I3 {
4+
>I3 : I3
5+
}
6+
=== tests/cases/compiler/a.ts ===
27
/*! Keep this pinned comment */
38
interface I {
49
>I : I
@@ -8,3 +13,4 @@ interface I {
813
interface I2 {
914
>I2 : I2
1015
}
16+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
//@filename: a.ts
12
/*! Keep this pinned comment */
23
interface I {
34
}
45

56
// Don't keep this comment.
67
interface I2 {
8+
}
9+
10+
//@filename: b.ts
11+
///<reference path='a.ts'/>
12+
interface I3 {
713
}

0 commit comments

Comments
 (0)