Emit pinned/tripleslash reference comments of interfaces

Fixes #501
This commit is contained in:
Sheetal Nandi 2014-08-22 14:17:52 -07:00
parent 85b892fd6a
commit 393464eb18
5 changed files with 32 additions and 3 deletions

View File

@ -1682,6 +1682,10 @@ module ts {
}
}
function emitInterfaceDeclaration(node: InterfaceDeclaration) {
emitPinnedOrTripleSlashComments(node);
}
function emitEnumDeclaration(node: EnumDeclaration) {
emitLeadingComments(node);
if (!(node.flags & NodeFlags.Export)) {
@ -2089,6 +2093,8 @@ module ts {
return emitVariableDeclaration(<VariableDeclaration>node);
case SyntaxKind.ClassDeclaration:
return emitClassDeclaration(<ClassDeclaration>node);
case SyntaxKind.InterfaceDeclaration:
return emitInterfaceDeclaration(<InterfaceDeclaration>node);
case SyntaxKind.EnumDeclaration:
return emitEnumDeclaration(<EnumDeclaration>node);
case SyntaxKind.ModuleDeclaration:

View File

@ -16,3 +16,4 @@ interface Third extends JQueryEventObjectTest, SecondEvent {}
//// [app.js]
///<reference path='jquery.d.ts' />

View File

@ -1,10 +1,20 @@
//// [commentOnInterface1.ts]
//// [tests/cases/compiler/commentOnInterface1.ts] ////
//// [a.ts]
/*! Keep this pinned comment */
interface I {
}
// Don't keep this comment.
interface I2 {
}
//// [b.ts]
///<reference path='a.ts'/>
interface I3 {
}
//// [commentOnInterface1.js]
//// [a.js]
/*! Keep this pinned comment */
//// [b.js]
///<reference path='a.ts'/>

View File

@ -1,4 +1,9 @@
=== tests/cases/compiler/commentOnInterface1.ts ===
=== tests/cases/compiler/b.ts ===
///<reference path='a.ts'/>
interface I3 {
>I3 : I3
}
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
interface I {
>I : I
@ -8,3 +13,4 @@ interface I {
interface I2 {
>I2 : I2
}

View File

@ -1,7 +1,13 @@
//@filename: a.ts
/*! Keep this pinned comment */
interface I {
}
// Don't keep this comment.
interface I2 {
}
//@filename: b.ts
///<reference path='a.ts'/>
interface I3 {
}