Emit pinned/tripleslash reference comments of signatures

Fixes #501
This commit is contained in:
Sheetal Nandi
2014-08-22 14:40:47 -07:00
parent e6cd3e15b0
commit 85b892fd6a
5 changed files with 168 additions and 12 deletions

View File

@@ -1,11 +1,51 @@
//// [commentOnSignature1.ts]
//// [tests/cases/compiler/commentOnSignature1.ts] ////
//// [a.ts]
/*! Keep this pinned comment */
function foo(n: number): void;
// Don't keep this comment.
function foo(s: string): void;
function foo(a: any): void {
}
class c {
// dont keep this comment
constructor(a: string);
/*! keep this pinned comment */
constructor(a: number);
constructor(a: any) {
}
// dont keep this comment
foo(a: string);
/*! keep this pinned comment */
foo(a: number);
foo(a: any) {
}
}
//// [b.ts]
///<reference path='a.ts'/>
function foo2(n: number): void;
// Don't keep this comment.
function foo2(s: string): void;
function foo2(a: any): void {
}
//// [commentOnSignature1.js]
//// [a.js]
/*! Keep this pinned comment */
function foo(a) {
}
var c = (function () {
/*! keep this pinned comment */
function c(a) {
}
/*! keep this pinned comment */
c.prototype.foo = function (a) {
};
return c;
})();
//// [b.js]
///<reference path='a.ts'/>
function foo2(a) {
}

View File

@@ -1,4 +1,19 @@
=== tests/cases/compiler/commentOnSignature1.ts ===
=== tests/cases/compiler/b.ts ===
///<reference path='a.ts'/>
function foo2(n: number): void;
>foo2 : { (n: number): void; (s: string): void; }
>n : number
// Don't keep this comment.
function foo2(s: string): void;
>foo2 : { (n: number): void; (s: string): void; }
>s : string
function foo2(a: any): void {
>foo2 : { (n: number): void; (s: string): void; }
>a : any
}
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
function foo(n: number): void;
>foo : { (n: number): void; (s: string): void; }
@@ -13,3 +28,35 @@ function foo(a: any): void {
>foo : { (n: number): void; (s: string): void; }
>a : any
}
class c {
>c : c
// dont keep this comment
constructor(a: string);
>a : string
/*! keep this pinned comment */
constructor(a: number);
>a : number
constructor(a: any) {
>a : any
}
// dont keep this comment
foo(a: string);
>foo : { (a: string): any; (a: number): any; }
>a : string
/*! keep this pinned comment */
foo(a: number);
>foo : { (a: string): any; (a: number): any; }
>a : number
foo(a: any) {
>foo : { (a: string): any; (a: number): any; }
>a : any
}
}

View File

@@ -1,6 +1,31 @@
// @filename: a.ts
/*! Keep this pinned comment */
function foo(n: number): void;
// Don't keep this comment.
function foo(s: string): void;
function foo(a: any): void {
}
class c {
// dont keep this comment
constructor(a: string);
/*! keep this pinned comment */
constructor(a: number);
constructor(a: any) {
}
// dont keep this comment
foo(a: string);
/*! keep this pinned comment */
foo(a: number);
foo(a: any) {
}
}
//@filename:b.ts
///<reference path='a.ts'/>
function foo2(n: number): void;
// Don't keep this comment.
function foo2(s: string): void;
function foo2(a: any): void {
}