Merge branch 'master' into typeBaselines

This commit is contained in:
Jason Freeman 2014-08-28 17:24:45 -07:00
commit ad27af1a33
32 changed files with 1223 additions and 13725 deletions

File diff suppressed because one or more lines are too long

View file

@ -125,7 +125,7 @@ var ts;
Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1 /* Error */, key: "Import declarations in an internal module cannot reference an external module." },
Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1 /* Error */, key: "Cannot compile external modules unless the '--module' flag is provided." },
Filename_0_differs_from_already_included_filename_1_only_in_casing: { code: 1149, category: 1 /* Error */, key: "Filename '{0}' differs from already included filename '{1}' only in casing" },
new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 2068, category: 1 /* Error */, key: "'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead." },
new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1 /* Error */, key: "'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead." },
Duplicate_identifier_0: { code: 2300, category: 1 /* Error */, key: "Duplicate identifier '{0}'." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1 /* Error */, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1 /* Error */, key: "Static members cannot reference class type parameters." },
@ -402,7 +402,8 @@ var ts;
Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1 /* Error */, key: "Index signature of object type implicitly has an 'any' type." },
Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1 /* Error */, key: "Object literal's property '{0}' implicitly has an '{1}' type." },
Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1 /* Error */, key: "Rest parameter '{0}' implicitly has an 'any[]' type." },
Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1 /* Error */, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }
Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1 /* Error */, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." },
You_cannot_rename_this_element: { code: 8000, category: 1 /* Error */, key: "You cannot rename this element." }
};
})(ts || (ts = {}));
var ts;
@ -1938,9 +1939,9 @@ var ts;
if (ts.localizedDiagnosticMessages) {
message = ts.localizedDiagnosticMessages[message];
}
Debug.assert(message, "Diagnostic message does not exist in locale map.");
return message;
}
ts.getLocaleSpecificMessage = getLocaleSpecificMessage;
function createFileDiagnostic(file, start, length, message) {
var text = getLocaleSpecificMessage(message.key);
if (arguments.length > 4) {
@ -2247,7 +2248,7 @@ var ts;
(function (Debug) {
var currentAssertionLevel = 0 /* None */;
function shouldAssert(level) {
return this.currentAssertionLevel >= level;
return currentAssertionLevel >= level;
}
Debug.shouldAssert = shouldAssert;
function assert(expression, message, verboseDebugInfo) {
@ -2823,7 +2824,6 @@ var ts;
ControlBlockContext[ControlBlockContext["CrossingFunctionBoundary"] = 2] = "CrossingFunctionBoundary";
})(ControlBlockContext || (ControlBlockContext = {}));
function createSourceFile(filename, sourceText, languageVersion, version, isOpen) {
if (version === void 0) { version = 0; }
if (isOpen === void 0) { isOpen = false; }
var file;
var scanner;
@ -4331,8 +4331,6 @@ var ts;
function parseBreakOrContinueStatement(kind) {
var node = createNode(kind);
var errorCountBeforeStatement = file.syntacticErrors.length;
var keywordStart = scanner.getTokenPos();
var keywordLength = scanner.getTextPos() - keywordStart;
parseExpected(kind === 153 /* BreakStatement */ ? 56 /* BreakKeyword */ : 61 /* ContinueKeyword */);
if (!canParseSemicolon())
node.label = parseIdentifier();
@ -6056,6 +6054,8 @@ var ts;
} : emitLeadingDeclarationComments;
var emitTrailingComments = compilerOptions.removeComments ? function (node) {
} : emitTrailingDeclarationComments;
var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) {
} : emitLeadingCommentsOfLocalPosition;
var detachedCommentsInfo;
var emitDetachedComments = compilerOptions.removeComments ? function (node) {
} : emitDetachedCommentsAtPosition;
@ -6923,12 +6923,14 @@ var ts;
write(";");
emitTrailingComments(node.body);
}
decreaseIndent();
writeLine();
if (node.body.kind === 168 /* FunctionBlock */) {
emitLeadingCommentsOfPosition(node.body.statements.end);
decreaseIndent();
emitToken(6 /* CloseBraceToken */, node.body.statements.end);
}
else {
decreaseIndent();
emitStart(node.body);
write("}");
emitEnd(node.body);
@ -7176,8 +7178,11 @@ var ts;
statements = statements.slice(1);
emitLines(statements);
}
decreaseIndent();
writeLine();
if (ctor) {
emitLeadingCommentsOfPosition(ctor.body.statements.end);
}
decreaseIndent();
emitToken(6 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end);
scopeEmitEnd();
emitEnd(ctor || node);
@ -7438,6 +7443,7 @@ var ts;
}
function emitSourceFile(node) {
currentSourceFile = node;
writeLine();
emitDetachedComments(node);
var startIndex = emitDirectivePrologues(node.statements, false);
if (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8 /* EmitExtends */) {
@ -7586,20 +7592,27 @@ var ts;
return emitSourceFile(node);
}
}
function hasDetachedComments(pos) {
return detachedCommentsInfo !== undefined && detachedCommentsInfo[detachedCommentsInfo.length - 1].nodePos === pos;
}
function getLeadingCommentsWithoutDetachedComments() {
var leadingComments = ts.getLeadingComments(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos);
if (detachedCommentsInfo.length - 1) {
detachedCommentsInfo.pop();
}
else {
detachedCommentsInfo = undefined;
}
return leadingComments;
}
function emitLeadingDeclarationComments(node) {
if (node.parent.kind === 177 /* SourceFile */ || node.pos !== node.parent.pos) {
var leadingComments;
if (detachedCommentsInfo === undefined || detachedCommentsInfo[detachedCommentsInfo.length - 1].nodePos !== node.pos) {
leadingComments = ts.getLeadingCommentsOfNode(node, currentSourceFile);
if (hasDetachedComments(node.pos)) {
leadingComments = getLeadingCommentsWithoutDetachedComments();
}
else {
leadingComments = ts.getLeadingComments(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos);
if (detachedCommentsInfo.length - 1) {
detachedCommentsInfo.pop();
}
else {
detachedCommentsInfo = undefined;
}
leadingComments = ts.getLeadingCommentsOfNode(node, currentSourceFile);
}
emitNewLineBeforeLeadingComments(node, leadingComments, writer);
emitComments(leadingComments, true, writer, writeComment);
@ -7611,6 +7624,17 @@ var ts;
emitComments(trailingComments, false, writer, writeComment);
}
}
function emitLeadingCommentsOfLocalPosition(pos) {
var leadingComments;
if (hasDetachedComments(pos)) {
leadingComments = getLeadingCommentsWithoutDetachedComments();
}
else {
leadingComments = ts.getLeadingComments(currentSourceFile.text, pos);
}
emitNewLineBeforeLeadingComments({ pos: pos, end: pos }, leadingComments, writer);
emitComments(leadingComments, true, writer, writeComment);
}
function emitDetachedCommentsAtPosition(node) {
var leadingComments = ts.getLeadingComments(currentSourceFile.text, node.pos);
if (leadingComments) {
@ -9561,7 +9585,7 @@ var ts;
function getTypeOfFuncClassEnumModule(symbol) {
var links = getSymbolLinks(symbol);
if (!links.type) {
var type = links.type = createObjectType(8192 /* Anonymous */, symbol);
links.type = createObjectType(8192 /* Anonymous */, symbol);
}
return links.type;
}
@ -10233,6 +10257,7 @@ var ts;
return emptyObjectType;
}
var type = getDeclaredTypeOfSymbol(symbol);
var name = symbol.name;
if (!(type.flags & ts.TypeFlags.ObjectType)) {
error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, name);
return emptyObjectType;
@ -14465,13 +14490,14 @@ var ts;
return diagnostic.messageText;
}
function reportDiagnostic(diagnostic) {
var output = "";
if (diagnostic.file) {
var loc = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start);
sys.write(diagnostic.file.filename + "(" + loc.line + "," + loc.character + "): " + diagnostic.messageText + sys.newLine);
}
else {
sys.write(diagnostic.messageText + sys.newLine);
output += diagnostic.file.filename + "(" + loc.line + "," + loc.character + "): ";
}
var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();
output += category + " TS" + diagnostic.code + ": " + diagnostic.messageText + sys.newLine;
sys.write(output);
}
function reportDiagnostics(diagnostics) {
for (var i = 0; i < diagnostics.length; i++) {
@ -14512,7 +14538,7 @@ var ts;
}
text = "";
}
return text !== undefined ? ts.createSourceFile(filename, text, languageVersion) : undefined;
return text !== undefined ? ts.createSourceFile(filename, text, languageVersion, "0") : undefined;
}
function writeFile(fileName, data, writeByteOrderMark, onError) {
function directoryExists(directoryPath) {

File diff suppressed because it is too large Load diff

View file

@ -336,6 +336,9 @@ module ts {
/** Emit detached comments of the node */
var emitDetachedComments = compilerOptions.removeComments ? (node: TextRange) => { } : emitDetachedCommentsAtPosition;
/** Emits /// or pinned which is comment starting with /*! comments */
var emitPinnedOrTripleSlashComments = compilerOptions.removeComments ? (node: Node) => { } : emitPinnedOrTripleSlashCommentsOfNode;
var writeComment = writeCommentRange;
/** Emit a node */
@ -1318,7 +1321,10 @@ module ts {
}
function emitFunctionDeclaration(node: FunctionDeclaration) {
if (!node.body) return;
if (!node.body) {
return emitPinnedOrTripleSlashComments(node);
}
if (node.kind !== SyntaxKind.Method) {
// Methods will emit the comments as part of emitting method declaration
emitLeadingComments(node);
@ -1488,7 +1494,10 @@ module ts {
function emitMemberFunctions(node: ClassDeclaration) {
forEach(node.members, member => {
if (member.kind === SyntaxKind.Method) {
if (!(<MethodDeclaration>member).body) return;
if (!(<MethodDeclaration>member).body) {
return emitPinnedOrTripleSlashComments(member);
}
writeLine();
emitLeadingComments(member);
emitStart(member);
@ -1611,6 +1620,13 @@ module ts {
emitTrailingComments(node);
function emitConstructorOfClass() {
// Emit the constructor overload pinned comments
forEach(node.members, member => {
if (member.kind === SyntaxKind.Constructor && !(<ConstructorDeclaration>member).body) {
emitPinnedOrTripleSlashComments(member);
}
});
var ctor = getFirstConstructorWithBody(node);
if (ctor) {
emitLeadingComments(ctor);
@ -1666,6 +1682,10 @@ module ts {
}
}
function emitInterfaceDeclaration(node: InterfaceDeclaration) {
emitPinnedOrTripleSlashComments(node);
}
function emitEnumDeclaration(node: EnumDeclaration) {
emitLeadingComments(node);
if (!(node.flags & NodeFlags.Export)) {
@ -1741,7 +1761,10 @@ module ts {
}
function emitModuleDeclaration(node: ModuleDeclaration) {
if (!isInstantiated(node)) return;
if (!isInstantiated(node)) {
return emitPinnedOrTripleSlashComments(node);
}
emitLeadingComments(node);
if (!(node.flags & NodeFlags.Export)) {
emitStart(node);
@ -1969,7 +1992,14 @@ module ts {
}
function emitNode(node: Node) {
if (!node || node.flags & NodeFlags.Ambient) return;
if (!node) {
return;
}
if (node.flags & NodeFlags.Ambient) {
return emitPinnedOrTripleSlashComments(node);
}
switch (node.kind) {
case SyntaxKind.Identifier:
return emitIdentifier(<Identifier>node);
@ -2073,6 +2103,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:
@ -2101,7 +2133,7 @@ module ts {
return leadingComments;
}
function emitLeadingDeclarationComments(node: Node) {
function getLeadingCommentsToEmit(node: Node) {
// Emit the leading comments only if the parent's pos doesnt match because parent should take care of emitting these comments
if (node.parent.kind === SyntaxKind.SourceFile || node.pos !== node.parent.pos) {
var leadingComments: Comment[];
@ -2113,12 +2145,17 @@ module ts {
// get the leading comments from the node
leadingComments = getLeadingCommentsOfNode(node, currentSourceFile);
}
emitNewLineBeforeLeadingComments(node, leadingComments, writer);
// Leading comments are emitted at /*leading comment1 */space/*leading comment*/space
emitComments(leadingComments, /*trailingSeparator*/ true, writer, writeComment);
return leadingComments;
}
}
function emitLeadingDeclarationComments(node: Node) {
var leadingComments = getLeadingCommentsToEmit(node);
emitNewLineBeforeLeadingComments(node, leadingComments, writer);
// Leading comments are emitted at /*leading comment1 */space/*leading comment*/space
emitComments(leadingComments, /*trailingSeparator*/ true, writer, writeComment);
}
function emitTrailingDeclarationComments(node: Node) {
// Emit the trailing comments only if the parent's end doesnt match
if (node.parent.kind === SyntaxKind.SourceFile || node.end !== node.parent.end) {
@ -2166,7 +2203,7 @@ module ts {
lastComment = comment;
});
if (detachedComments && detachedComments.length) {
if (detachedComments.length) {
// All comments look like they could have been part of the copyright header. Make
// sure there is at least one blank line between it and the node. If not, it's not
// a copyright header.
@ -2188,6 +2225,28 @@ module ts {
}
}
function emitPinnedOrTripleSlashCommentsOfNode(node: Node) {
var pinnedComments = ts.filter(getLeadingCommentsToEmit(node), isPinnedOrTripleSlashComment);
function isPinnedOrTripleSlashComment(comment: Comment) {
if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) {
return currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.exclamation;
}
// Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text
// so that we dont end up computing comment string and doing match for all // comments
else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.slash &&
comment.pos + 2 < comment.end &&
currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.slash &&
currentSourceFile.text.substring(comment.pos, comment.end).match(fullTripleSlashReferencePathRegEx)) {
return true;
}
}
emitNewLineBeforeLeadingComments(node, pinnedComments, writer);
// Leading comments are emitted at /*leading comment1 */space/*leading comment*/space
emitComments(pinnedComments, /*trailingSeparator*/ true, writer, writeComment);
}
if (compilerOptions.sourceMap) {
initializeEmitterWithSourceMaps();
}

View file

@ -165,6 +165,8 @@ module ts {
}
}
export var fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)('|")(.+?)\2.*?\/>/
// Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes
// stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise,
// embedded arrays are flattened and the 'cbNode' callback is invoked for each element. If a callback returns
@ -3506,8 +3508,7 @@ module ts {
file.hasNoDefaultLib = true;
}
else {
var fullReferenceRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
var matchResult = fullReferenceRegEx.exec(comment);
var matchResult = fullTripleSlashReferencePathRegEx.exec(comment);
if (!matchResult) {
var start = range.pos;
var length = range.end - start;

View file

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

View file

@ -1,10 +1,20 @@
//// [commentOnAmbientClass1.ts]
//// [tests/cases/compiler/commentOnAmbientClass1.ts] ////
//// [a.ts]
/*! Keep this pinned comment */
declare class C {
}
// Don't keep this comment.
declare class D {
}
//// [b.ts]
///<reference path="a.ts"/>
declare class E extends C {
}
//// [commentOnAmbientClass1.js]
//// [a.js]
/*! Keep this pinned comment */
//// [b.js]
///<reference path="a.ts"/>

View file

@ -1,4 +1,10 @@
=== tests/cases/compiler/commentOnAmbientClass1.ts ===
=== tests/cases/compiler/b.ts ===
///<reference path="a.ts"/>
declare class E extends C {
>E : E
>C : C
}
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
declare class C {
>C : C
@ -8,3 +14,4 @@ declare class C {
declare class D {
>D : D
}

View file

@ -0,0 +1,23 @@
//// [tests/cases/compiler/commentOnAmbientEnum.ts] ////
//// [a.ts]
/*! Keep this pinned comment */
declare enum C {
a,
b,
c
}
// Don't keep this comment.
declare enum D {
}
//// [b.ts]
///<reference path="a.ts"/>
declare enum E {
}
//// [a.js]
/*! Keep this pinned comment */
//// [b.js]
///<reference path="a.ts"/>

View file

@ -0,0 +1,25 @@
=== tests/cases/compiler/b.ts ===
///<reference path="a.ts"/>
declare enum E {
>E : E
}
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
declare enum C {
>C : C
a,
>a : C
b,
>b : C
c
>c : C
}
// Don't keep this comment.
declare enum D {
>D : D
}

View file

@ -0,0 +1,25 @@
//// [tests/cases/compiler/commentOnAmbientModule.ts] ////
//// [a.ts]
/*! Keep this pinned comment */
declare module C {
function foo();
}
// Don't keep this comment.
declare module D {
class bar { }
}
//// [b.ts]
///<reference path="a.ts"/>
declare module E {
class foobar extends D.bar {
foo();
}
}
//// [a.js]
/*! Keep this pinned comment */
//// [b.js]
///<reference path="a.ts"/>

View file

@ -0,0 +1,31 @@
=== tests/cases/compiler/b.ts ===
///<reference path="a.ts"/>
declare module E {
>E : typeof E
class foobar extends D.bar {
>foobar : foobar
>D : D
>bar : bar
foo();
>foo : () => any
}
}
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
declare module C {
>C : typeof C
function foo();
>foo : () => any
}
// Don't keep this comment.
declare module D {
>D : typeof D
class bar { }
>bar : bar
}

View file

@ -6,3 +6,4 @@ declare var v: number;
declare var y: number;
//// [commentOnAmbientVariable1.js]
/*! Keep this pinned comment */

View file

@ -11,4 +11,5 @@ x = 2;
//// [commentOnAmbientVariable2_1.js]
var y = 1;
//// [commentOnAmbientVariable2_2.js]
/// <reference path='commentOnAmbientVariable2_1.ts'/>
x = 2;

View file

@ -0,0 +1,17 @@
//// [tests/cases/compiler/commentOnAmbientfunction.ts] ////
//// [a.ts]
/*! Keep this pinned comment */
declare function foo();
// Don't keep this comment.
declare function bar();
//// [b.ts]
///<reference path="a.ts"/>
declare function foobar(a: typeof foo): typeof bar;
//// [a.js]
/*! Keep this pinned comment */
//// [b.js]
///<reference path="a.ts"/>

View file

@ -0,0 +1,17 @@
=== tests/cases/compiler/b.ts ===
///<reference path="a.ts"/>
declare function foobar(a: typeof foo): typeof bar;
>foobar : (a: () => any) => () => any
>a : () => any
>foo : () => any
>bar : () => any
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
declare function foo();
>foo : () => any
// Don't keep this comment.
declare function bar();
>bar : () => any

View file

@ -1,10 +1,20 @@
//// [commentOnElidedModule1.ts]
//// [tests/cases/compiler/commentOnElidedModule1.ts] ////
//// [a.ts]
/*! Keep this pinned comment */
module ElidedModule {
}
// Don't keep this comment.
module ElidedModule2 {
}
//// [b.ts]
///<reference path="a.ts"/>
module ElidedModule3 {
}
//// [commentOnElidedModule1.js]
//// [a.js]
/*! Keep this pinned comment */
//// [b.js]
///<reference path="a.ts"/>

View file

@ -1,4 +1,9 @@
=== tests/cases/compiler/commentOnElidedModule1.ts ===
=== tests/cases/compiler/b.ts ===
///<reference path="a.ts"/>
module ElidedModule3 {
>ElidedModule3 : ElidedModule3
}
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
module ElidedModule {
>ElidedModule : unknown
@ -8,3 +13,4 @@ module ElidedModule {
module ElidedModule2 {
>ElidedModule2 : unknown
}

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,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

@ -22,3 +22,4 @@ interface C {
var q1;
var x = q1.each(function (x) { return c.log(x); });
//// [file2.js]
///<reference path='file1.ts'/>

View file

@ -49,6 +49,8 @@ var Microsoft;
/// <reference path="emitMemberAccessExpression_file3.ts" />
"use strict";
//// [emitMemberAccessExpression_file3.js]
/// <reference path="emitMemberAccessExpression_file2.ts" />
/// <reference path="emitMemberAccessExpression_file1.ts" />
var Microsoft;
(function (Microsoft) {
(function (PeopleAtWork) {

View file

@ -17,6 +17,7 @@ module bar {
//// [reuseInnerModuleMember_0.js]
//// [reuseInnerModuleMember_1.js]
///<reference path='reuseInnerModuleMember_0.ts'/>
var bar;
(function (bar) {
var x;

View file

@ -1,7 +1,13 @@
//@filename: a.ts
/*! Keep this pinned comment */
declare class C {
}
// Don't keep this comment.
declare class D {
}
//@filename: b.ts
///<reference path="a.ts"/>
declare class E extends C {
}

View file

@ -0,0 +1,16 @@
//@filename: a.ts
/*! Keep this pinned comment */
declare enum C {
a,
b,
c
}
// Don't keep this comment.
declare enum D {
}
//@filename: b.ts
///<reference path="a.ts"/>
declare enum E {
}

View file

@ -0,0 +1,18 @@
//@filename: a.ts
/*! Keep this pinned comment */
declare module C {
function foo();
}
// Don't keep this comment.
declare module D {
class bar { }
}
//@filename: b.ts
///<reference path="a.ts"/>
declare module E {
class foobar extends D.bar {
foo();
}
}

View file

@ -0,0 +1,10 @@
//@filename: a.ts
/*! Keep this pinned comment */
declare function foo();
// Don't keep this comment.
declare function bar();
//@filename: b.ts
///<reference path="a.ts"/>
declare function foobar(a: typeof foo): typeof bar;

View file

@ -1,7 +1,13 @@
//@filename: a.ts
/*! Keep this pinned comment */
module ElidedModule {
}
// Don't keep this comment.
module ElidedModule2 {
}
//@filename: b.ts
///<reference path="a.ts"/>
module ElidedModule3 {
}

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 {
}

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 {
}