Merge remote-tracking branch 'origin/master' into fourslashCleanup

Conflicts:
	src/harness/harnessLanguageService.ts
This commit is contained in:
Mohamed Hegazy
2015-02-09 09:31:19 -08:00
880 changed files with 3798 additions and 6891 deletions
+75 -50
View File
@@ -2713,7 +2713,21 @@ module ts {
emit(node.whenFalse);
}
function isSingleLineBlock(node: Node) {
if (node && node.kind === SyntaxKind.Block) {
var block = <Block>node;
return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block);
}
}
function emitBlock(node: Block) {
if (isSingleLineBlock(node)) {
emitToken(SyntaxKind.OpenBraceToken, node.pos);
write(" ");
emitToken(SyntaxKind.CloseBraceToken, node.statements.end);
return;
}
emitToken(SyntaxKind.OpenBraceToken, node.pos);
increaseIndent();
scopeEmitStart(node.parent);
@@ -2886,6 +2900,11 @@ module ts {
getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos));
}
function nodeEndIsOnSameLineAsNodeStart(node1: Node, node2: Node) {
return getLineOfLocalPosition(currentSourceFile, node1.end) ===
getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos));
}
function emitCaseOrDefaultClause(node: CaseOrDefaultClause) {
if (node.kind === SyntaxKind.CaseClause) {
write("case ");
@@ -3385,73 +3404,79 @@ module ts {
emitSignatureParameters(node);
}
write(" {");
scopeEmitStart(node);
if (!node.body) {
writeLine();
write("}");
if (isSingleLineBlock(node.body)) {
write(" { }");
}
else {
increaseIndent();
write(" {");
scopeEmitStart(node);
emitDetachedComments(node.body.kind === SyntaxKind.Block ? (<Block>node.body).statements : node.body);
var startIndex = 0;
if (node.body.kind === SyntaxKind.Block) {
startIndex = emitDirectivePrologues((<Block>node.body).statements, /*startWithNewLine*/ true);
}
var outPos = writer.getTextPos();
emitCaptureThisForNodeIfNecessary(node);
emitDefaultValueAssignments(node);
emitRestParameter(node);
if (node.body.kind !== SyntaxKind.Block && outPos === writer.getTextPos()) {
decreaseIndent();
write(" ");
emitStart(node.body);
write("return ");
// Don't emit comments on this body. We'll have already taken care of it above
// when we called emitDetachedComments.
emitNode(node.body, /*disableComments:*/ true);
emitEnd(node.body);
write(";");
emitTempDeclarations(/*newLine*/ false);
write(" ");
emitStart(node.body);
if (!node.body) {
writeLine();
write("}");
emitEnd(node.body);
}
else {
increaseIndent();
emitDetachedComments(node.body.kind === SyntaxKind.Block ? (<Block>node.body).statements : node.body);
var startIndex = 0;
if (node.body.kind === SyntaxKind.Block) {
emitLinesStartingAt((<Block>node.body).statements, startIndex);
startIndex = emitDirectivePrologues((<Block>node.body).statements, /*startWithNewLine*/ true);
}
else {
writeLine();
emitLeadingComments(node.body);
var outPos = writer.getTextPos();
emitCaptureThisForNodeIfNecessary(node);
emitDefaultValueAssignments(node);
emitRestParameter(node);
if (node.body.kind !== SyntaxKind.Block && outPos === writer.getTextPos()) {
decreaseIndent();
write(" ");
emitStart(node.body);
write("return ");
emit(node.body, /*disableComments:*/ true);
// Don't emit comments on this body. We'll have already taken care of it above
// when we called emitDetachedComments.
emitNode(node.body, /*disableComments:*/ true);
emitEnd(node.body);
write(";");
emitTrailingComments(node.body);
}
emitTempDeclarations(/*newLine*/ true);
writeLine();
if (node.body.kind === SyntaxKind.Block) {
emitLeadingCommentsOfPosition((<Block>node.body).statements.end);
decreaseIndent();
emitToken(SyntaxKind.CloseBraceToken, (<Block>node.body).statements.end);
}
else {
decreaseIndent();
emitTempDeclarations(/*newLine*/ false);
write(" ");
emitStart(node.body);
write("}");
emitEnd(node.body);
}
else {
if (node.body.kind === SyntaxKind.Block) {
emitLinesStartingAt((<Block>node.body).statements, startIndex);
}
else {
writeLine();
emitLeadingComments(node.body);
write("return ");
emit(node.body, /*disableComments:*/ true);
write(";");
emitTrailingComments(node.body);
}
emitTempDeclarations(/*newLine*/ true);
writeLine();
if (node.body.kind === SyntaxKind.Block) {
emitLeadingCommentsOfPosition((<Block>node.body).statements.end);
decreaseIndent();
emitToken(SyntaxKind.CloseBraceToken, (<Block>node.body).statements.end);
}
else {
decreaseIndent();
emitStart(node.body);
write("}");
emitEnd(node.body);
}
}
}
scopeEmitEnd();
}
scopeEmitEnd();
if (node.flags & NodeFlags.Export) {
writeLine();
emitStart(node);
+109 -22
View File
@@ -336,11 +336,16 @@ module ts {
}
function fixupParentReferences(sourceFile: SourceFile) {
// normally parent references are set during binding.
// however here SourceFile data is used only for syntactic features so running the whole binding process is an overhead.
// walk over the nodes and set parent references
// normally parent references are set during binding. However, for clients that only need
// a syntax tree, and no semantic features, then the binding process is an unnecessary
// overhead. This functions allows us to set all the parents, without all the expense of
// binding.
var parent: Node = sourceFile;
function walk(n: Node): void {
forEachChild(sourceFile, visitNode);
return;
function visitNode(n: Node): void {
// walk down setting parents that differ from the parent we think it should be. This
// allows us to quickly bail out of setting parents for subtrees during incremental
// parsing
@@ -349,30 +354,49 @@ module ts {
var saveParent = parent;
parent = n;
forEachChild(n, walk);
forEachChild(n, visitNode);
parent = saveParent;
}
}
forEachChild(sourceFile, walk);
}
function moveElementEntirelyPastChangeRange(element: IncrementalElement, delta: number) {
function shouldCheckNode(node: Node) {
switch (node.kind) {
case SyntaxKind.StringLiteral:
case SyntaxKind.NumericLiteral:
case SyntaxKind.Identifier:
return true;
}
return false;
}
function moveElementEntirelyPastChangeRange(element: IncrementalElement, delta: number, oldText: string, newText: string, aggressiveChecks: boolean) {
if (element.length) {
visitArray(<IncrementalNodeArray>element);
}
else {
visitNode(<IncrementalNode>element);
}
return;
function visitNode(node: IncrementalNode) {
if (aggressiveChecks && shouldCheckNode(node)) {
var text = oldText.substring(node.pos, node.end);
}
// Ditch any existing LS children we may have created. This way we can avoid
// moving them forward.
node._children = undefined;
node.pos += delta;
node.end += delta;
if (aggressiveChecks && shouldCheckNode(node)) {
Debug.assert(text === newText.substring(node.pos, node.end));
}
forEachChild(node, visitNode, visitArray);
checkNodePositions(node, aggressiveChecks);
}
function visitArray(array: IncrementalNodeArray) {
@@ -459,14 +483,35 @@ module ts {
}
}
function updateTokenPositionsAndMarkElements(node: IncrementalNode, changeStart: number, changeRangeOldEnd: number, changeRangeNewEnd: number, delta: number): void {
visitNode(node);
function checkNodePositions(node: Node, aggressiveChecks: boolean) {
if (aggressiveChecks) {
var pos = node.pos;
forEachChild(node, child => {
Debug.assert(child.pos >= pos);
pos = child.end;
});
Debug.assert(pos <= node.end);
}
}
function updateTokenPositionsAndMarkElements(
sourceFile: IncrementalNode,
changeStart: number,
changeRangeOldEnd: number,
changeRangeNewEnd: number,
delta: number,
oldText: string,
newText: string,
aggressiveChecks: boolean): void {
visitNode(sourceFile);
return;
function visitNode(child: IncrementalNode) {
if (child.pos > changeRangeOldEnd) {
// Node is entirely past the change range. We need to move both its pos and
// end, forward or backward appropriately.
moveElementEntirelyPastChangeRange(child, delta);
moveElementEntirelyPastChangeRange(child, delta, oldText, newText, aggressiveChecks);
return;
}
@@ -480,6 +525,8 @@ module ts {
// Adjust the pos or end (or both) of the intersecting element accordingly.
adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
forEachChild(child, visitNode, visitArray);
checkNodePositions(child, aggressiveChecks);
return;
}
@@ -490,7 +537,7 @@ module ts {
if (array.pos > changeRangeOldEnd) {
// Array is entirely after the change range. We need to move it, and move any of
// its children.
moveElementEntirelyPastChangeRange(array, delta);
moveElementEntirelyPastChangeRange(array, delta, oldText, newText, aggressiveChecks);
}
else {
// Check if the element intersects the change range. If it does, then it is not
@@ -513,7 +560,6 @@ module ts {
}
}
function extendToAffectedRange(sourceFile: SourceFile, changeRange: TextChangeRange): TextChangeRange {
// Consider the following code:
// void foo() { /; }
@@ -534,6 +580,7 @@ module ts {
// start of the tree.
for (var i = 0; start > 0 && i <= maxLookahead; i++) {
var nearestNode = findNearestNodeStartingBeforeOrAtPosition(sourceFile, start);
Debug.assert(nearestNode.pos <= start);
var position = nearestNode.pos;
start = Math.max(0, position - 1);
@@ -640,6 +687,22 @@ module ts {
}
}
function checkChangeRange(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks: boolean) {
var oldText = sourceFile.text;
if (textChangeRange) {
Debug.assert((oldText.length - textChangeRange.span.length + textChangeRange.newLength) === newText.length);
if (aggressiveChecks || Debug.shouldAssert(AssertionLevel.VeryAggressive)) {
var oldTextPrefix = oldText.substr(0, textChangeRange.span.start);
var newTextPrefix = newText.substr(0, textChangeRange.span.start);
Debug.assert(oldTextPrefix === newTextPrefix);
var oldTextSuffix = oldText.substring(textSpanEnd(textChangeRange.span), oldText.length);
var newTextSuffix = newText.substring(textSpanEnd(textChangeRangeNewSpan(textChangeRange)), newText.length);
Debug.assert(oldTextSuffix === newTextSuffix);
}
}
}
// Produces a new SourceFile for the 'newText' provided. The 'textChangeRange' parameter
// indicates what changed between the 'text' that this SourceFile has and the 'newText'.
@@ -650,7 +713,10 @@ module ts {
// from this SourceFile that are being held onto may change as a result (including
// becoming detached from any SourceFile). It is recommended that this SourceFile not
// be used once 'update' is called on it.
export function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile {
export function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile {
aggressiveChecks = aggressiveChecks || Debug.shouldAssert(AssertionLevel.Aggressive);
checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks);
if (textChangeRangeIsUnchanged(textChangeRange)) {
// if the text didn't change, then we can just return our current source file as-is.
return sourceFile;
@@ -659,14 +725,22 @@ module ts {
if (sourceFile.statements.length === 0) {
// If we don't have any statements in the current source file, then there's no real
// way to incrementally parse. So just do a full parse instead.
return parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion,/*syntaxCursor*/ undefined, /*setNodeParents*/ true)
return parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setNodeParents*/ true)
}
var oldText = sourceFile.text;
var syntaxCursor = createSyntaxCursor(sourceFile);
// Make the actual change larger so that we know to reparse anything whose lookahead
// might have intersected the change.
var changeRange = extendToAffectedRange(sourceFile, textChangeRange);
checkChangeRange(sourceFile, newText, changeRange, aggressiveChecks);
// Ensure that extending the affected range only moved the start of the change range
// earlier in the file.
Debug.assert(changeRange.span.start <= textChangeRange.span.start);
Debug.assert(textSpanEnd(changeRange.span) === textSpanEnd(textChangeRange.span));
Debug.assert(textSpanEnd(textChangeRangeNewSpan(changeRange)) === textSpanEnd(textChangeRangeNewSpan(textChangeRange)));
// The is the amount the nodes after the edit range need to be adjusted. It can be
// positive (if the edit added characters), negative (if the edit deleted characters)
@@ -674,8 +748,8 @@ module ts {
var delta = textChangeRangeNewSpan(changeRange).length - changeRange.span.length;
// If we added or removed characters during the edit, then we need to go and adjust all
// the nodes after the edit. Those nodes may move forward down (if we inserted chars)
// or they may move backward (if we deleted chars).
// the nodes after the edit. Those nodes may move forward (if we inserted chars) or they
// may move backward (if we deleted chars).
//
// Doing this helps us out in two ways. First, it means that any nodes/tokens we want
// to reuse are already at the appropriate position in the new text. That way when we
@@ -693,7 +767,7 @@ module ts {
// Also, mark any syntax elements that intersect the changed span. We know, up front,
// that we cannot reuse these elements.
updateTokenPositionsAndMarkElements(<IncrementalNode><Node>sourceFile,
changeRange.span.start, textSpanEnd(changeRange.span), textSpanEnd(textChangeRangeNewSpan(changeRange)), delta);
changeRange.span.start, textSpanEnd(changeRange.span), textSpanEnd(textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks);
// Now that we've set up our internal incremental state just proceed and parse the
// source file in the normal fashion. When possible the parser will retrieve and
@@ -863,7 +937,6 @@ module ts {
var identifiers: Map<string> = {};
var identifierCount = 0;
var nodeCount = 0;
var scanner: Scanner;
var token: SyntaxKind;
var sourceFile = <SourceFile>createNode(SyntaxKind.SourceFile, /*pos*/ 0);
@@ -956,7 +1029,7 @@ module ts {
var parseErrorBeforeNextFinishedNode: boolean = false;
// Create and prime the scanner before parsing the source elements.
scanner = createScanner(languageVersion, /*skipTrivia*/ true, sourceText, scanError);
var scanner = createScanner(languageVersion, /*skipTrivia*/ true, sourceText, scanError);
token = nextToken();
processReferenceComments(sourceFile);
@@ -975,6 +1048,7 @@ module ts {
fixupParentReferences(sourceFile);
}
syntaxCursor = undefined;
return sourceFile;
function setContextFlag(val: Boolean, flag: ParserContextFlags) {
@@ -1878,7 +1952,7 @@ module ts {
}
// Parses a comma-delimited list of elements
function parseDelimitedList<T extends Node>(kind: ParsingContext, parseElement: () => T): NodeArray<T> {
function parseDelimitedList<T extends Node>(kind: ParsingContext, parseElement: () => T, considerSemicolonAsDelimeter?: boolean): NodeArray<T> {
var saveParsingContext = parsingContext;
parsingContext |= 1 << kind;
var result = <NodeArray<T>>[];
@@ -1892,11 +1966,24 @@ module ts {
if (parseOptional(SyntaxKind.CommaToken)) {
continue;
}
commaStart = -1; // Back to the state where the last token was not a comma
if (isListTerminator(kind)) {
break;
}
// We didn't get a comma, and the list wasn't terminated, explicitly parse
// out a comma so we give a good error message.
parseExpected(SyntaxKind.CommaToken);
// If the token was a semicolon, and the caller allows that, then skip it and
// continue. This ensures we get back on track and don't result in tons of
// parse errors. For example, this can happen when people do things like use
// a semicolon to delimit object literal members. Note: we'll have already
// reported an error when we called parseExpected above.
if (considerSemicolonAsDelimeter && token === SyntaxKind.SemicolonToken && !scanner.hasPrecedingLineBreak()) {
nextToken();
}
continue;
}
@@ -3598,7 +3685,7 @@ module ts {
node.flags |= NodeFlags.MultiLine;
}
node.properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralElement);
node.properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralElement, /*considerSemicolonAsDelimeter:*/ true);
parseExpected(SyntaxKind.CloseBraceToken);
return finishNode(node);
}
+2 -19
View File
@@ -1624,31 +1624,14 @@ module ts {
export var disableIncrementalParsing = false;
export function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile {
if (textChangeRange && Debug.shouldAssert(AssertionLevel.Normal)) {
var oldText = sourceFile.scriptSnapshot;
var newText = scriptSnapshot;
Debug.assert((oldText.getLength() - textChangeRange.span.length + textChangeRange.newLength) === newText.getLength());
if (Debug.shouldAssert(AssertionLevel.VeryAggressive)) {
var oldTextPrefix = oldText.getText(0, textChangeRange.span.start);
var newTextPrefix = newText.getText(0, textChangeRange.span.start);
Debug.assert(oldTextPrefix === newTextPrefix);
var oldTextSuffix = oldText.getText(textSpanEnd(textChangeRange.span), oldText.getLength());
var newTextSuffix = newText.getText(textSpanEnd(textChangeRangeNewSpan(textChangeRange)), newText.getLength());
Debug.assert(oldTextSuffix === newTextSuffix);
}
}
export function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile {
// If we were given a text change range, and our version or open-ness changed, then
// incrementally parse this file.
if (textChangeRange) {
if (version !== sourceFile.version) {
// Once incremental parsing is ready, then just call into this function.
if (!disableIncrementalParsing) {
var newSourceFile = updateSourceFile(sourceFile, scriptSnapshot.getText(0, scriptSnapshot.getLength()), textChangeRange);
var newSourceFile = updateSourceFile(sourceFile, scriptSnapshot.getText(0, scriptSnapshot.getLength()), textChangeRange, aggressiveChecks);
setSourceFileFields(newSourceFile, scriptSnapshot, version);
// after incremental parsing nameTable might not be up-to-date
// drop it so it can be lazily recreated later
@@ -1404,7 +1404,7 @@ declare module "typescript" {
function createNode(kind: SyntaxKind): Node;
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
function modifierToFlag(token: SyntaxKind): NodeFlags;
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile;
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
function isEvalOrArgumentsIdentifier(node: Node): boolean;
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile;
function isLeftHandSideExpression(expr: Expression): boolean;
@@ -1895,7 +1895,7 @@ declare module "typescript" {
}
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
var disableIncrementalParsing: boolean;
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile;
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
function createDocumentRegistry(): DocumentRegistry;
function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo;
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
@@ -4484,13 +4484,14 @@ declare module "typescript" {
>SyntaxKind : SyntaxKind
>NodeFlags : NodeFlags
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile;
>updateSourceFile : (sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange) => SourceFile
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
>updateSourceFile : (sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean) => SourceFile
>sourceFile : SourceFile
>SourceFile : SourceFile
>newText : string
>textChangeRange : TextChangeRange
>TextChangeRange : TextChangeRange
>aggressiveChecks : boolean
>SourceFile : SourceFile
function isEvalOrArgumentsIdentifier(node: Node): boolean;
@@ -5895,8 +5896,8 @@ declare module "typescript" {
var disableIncrementalParsing: boolean;
>disableIncrementalParsing : boolean
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile;
>updateLanguageServiceSourceFile : (sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
>updateLanguageServiceSourceFile : (sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean) => SourceFile
>sourceFile : SourceFile
>SourceFile : SourceFile
>scriptSnapshot : IScriptSnapshot
@@ -5904,6 +5905,7 @@ declare module "typescript" {
>version : string
>textChangeRange : TextChangeRange
>TextChangeRange : TextChangeRange
>aggressiveChecks : boolean
>SourceFile : SourceFile
function createDocumentRegistry(): DocumentRegistry;
@@ -1435,7 +1435,7 @@ declare module "typescript" {
function createNode(kind: SyntaxKind): Node;
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
function modifierToFlag(token: SyntaxKind): NodeFlags;
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile;
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
function isEvalOrArgumentsIdentifier(node: Node): boolean;
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile;
function isLeftHandSideExpression(expr: Expression): boolean;
@@ -1926,7 +1926,7 @@ declare module "typescript" {
}
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
var disableIncrementalParsing: boolean;
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile;
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
function createDocumentRegistry(): DocumentRegistry;
function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo;
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
@@ -4628,13 +4628,14 @@ declare module "typescript" {
>SyntaxKind : SyntaxKind
>NodeFlags : NodeFlags
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile;
>updateSourceFile : (sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange) => SourceFile
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
>updateSourceFile : (sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean) => SourceFile
>sourceFile : SourceFile
>SourceFile : SourceFile
>newText : string
>textChangeRange : TextChangeRange
>TextChangeRange : TextChangeRange
>aggressiveChecks : boolean
>SourceFile : SourceFile
function isEvalOrArgumentsIdentifier(node: Node): boolean;
@@ -6039,8 +6040,8 @@ declare module "typescript" {
var disableIncrementalParsing: boolean;
>disableIncrementalParsing : boolean
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile;
>updateLanguageServiceSourceFile : (sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
>updateLanguageServiceSourceFile : (sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean) => SourceFile
>sourceFile : SourceFile
>SourceFile : SourceFile
>scriptSnapshot : IScriptSnapshot
@@ -6048,6 +6049,7 @@ declare module "typescript" {
>version : string
>textChangeRange : TextChangeRange
>TextChangeRange : TextChangeRange
>aggressiveChecks : boolean
>SourceFile : SourceFile
function createDocumentRegistry(): DocumentRegistry;
@@ -1436,7 +1436,7 @@ declare module "typescript" {
function createNode(kind: SyntaxKind): Node;
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
function modifierToFlag(token: SyntaxKind): NodeFlags;
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile;
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
function isEvalOrArgumentsIdentifier(node: Node): boolean;
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile;
function isLeftHandSideExpression(expr: Expression): boolean;
@@ -1927,7 +1927,7 @@ declare module "typescript" {
}
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
var disableIncrementalParsing: boolean;
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile;
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
function createDocumentRegistry(): DocumentRegistry;
function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo;
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
@@ -4580,13 +4580,14 @@ declare module "typescript" {
>SyntaxKind : SyntaxKind
>NodeFlags : NodeFlags
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile;
>updateSourceFile : (sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange) => SourceFile
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
>updateSourceFile : (sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean) => SourceFile
>sourceFile : SourceFile
>SourceFile : SourceFile
>newText : string
>textChangeRange : TextChangeRange
>TextChangeRange : TextChangeRange
>aggressiveChecks : boolean
>SourceFile : SourceFile
function isEvalOrArgumentsIdentifier(node: Node): boolean;
@@ -5991,8 +5992,8 @@ declare module "typescript" {
var disableIncrementalParsing: boolean;
>disableIncrementalParsing : boolean
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile;
>updateLanguageServiceSourceFile : (sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
>updateLanguageServiceSourceFile : (sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean) => SourceFile
>sourceFile : SourceFile
>SourceFile : SourceFile
>scriptSnapshot : IScriptSnapshot
@@ -6000,6 +6001,7 @@ declare module "typescript" {
>version : string
>textChangeRange : TextChangeRange
>TextChangeRange : TextChangeRange
>aggressiveChecks : boolean
>SourceFile : SourceFile
function createDocumentRegistry(): DocumentRegistry;
@@ -1473,7 +1473,7 @@ declare module "typescript" {
function createNode(kind: SyntaxKind): Node;
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
function modifierToFlag(token: SyntaxKind): NodeFlags;
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile;
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
function isEvalOrArgumentsIdentifier(node: Node): boolean;
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile;
function isLeftHandSideExpression(expr: Expression): boolean;
@@ -1964,7 +1964,7 @@ declare module "typescript" {
}
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
var disableIncrementalParsing: boolean;
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile;
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
function createDocumentRegistry(): DocumentRegistry;
function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo;
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
@@ -4753,13 +4753,14 @@ declare module "typescript" {
>SyntaxKind : SyntaxKind
>NodeFlags : NodeFlags
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile;
>updateSourceFile : (sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange) => SourceFile
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
>updateSourceFile : (sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean) => SourceFile
>sourceFile : SourceFile
>SourceFile : SourceFile
>newText : string
>textChangeRange : TextChangeRange
>TextChangeRange : TextChangeRange
>aggressiveChecks : boolean
>SourceFile : SourceFile
function isEvalOrArgumentsIdentifier(node: Node): boolean;
@@ -6164,8 +6165,8 @@ declare module "typescript" {
var disableIncrementalParsing: boolean;
>disableIncrementalParsing : boolean
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile;
>updateLanguageServiceSourceFile : (sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
>updateLanguageServiceSourceFile : (sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean) => SourceFile
>sourceFile : SourceFile
>SourceFile : SourceFile
>scriptSnapshot : IScriptSnapshot
@@ -6173,6 +6174,7 @@ declare module "typescript" {
>version : string
>textChangeRange : TextChangeRange
>TextChangeRange : TextChangeRange
>aggressiveChecks : boolean
>SourceFile : SourceFile
function createDocumentRegistry(): DocumentRegistry;
@@ -2,5 +2,4 @@
var v = (public x: string) => { };
//// [ArrowFunctionExpression1.js]
var v = function (x) {
};
var v = function (x) { };
@@ -58,8 +58,7 @@ var clodule1 = (function () {
})();
var clodule1;
(function (clodule1) {
function f(x) {
}
function f(x) { }
})(clodule1 || (clodule1 = {}));
var clodule2 = (function () {
function clodule2() {
@@ -19,8 +19,7 @@ module clodule {
var clodule = (function () {
function clodule() {
}
clodule.fn = function (id) {
};
clodule.fn = function (id) { };
return clodule;
})();
var clodule;
@@ -19,8 +19,7 @@ module clodule {
var clodule = (function () {
function clodule() {
}
clodule.fn = function (id) {
};
clodule.fn = function (id) { };
return clodule;
})();
var clodule;
@@ -8,7 +8,6 @@ class C {
var C = (function () {
function C() {
}
C.prototype.foo = function () {
};
C.prototype.foo = function () { };
return C;
})();
@@ -8,7 +8,6 @@ class C {
var C = (function () {
function C() {
}
C.prototype.bar = function () {
};
C.prototype.bar = function () { };
return C;
})();
@@ -8,7 +8,6 @@ class C {
var C = (function () {
function C() {
}
C.prototype[1] = function () {
};
C.prototype[1] = function () { };
return C;
})();
@@ -8,7 +8,6 @@ class C {
var C = (function () {
function C() {
}
C.prototype["bar"] = function () {
};
C.prototype["bar"] = function () { };
return C;
})();
@@ -2,5 +2,4 @@
var v = function * yield() { }
//// [FunctionDeclaration12_es6.js]
var v = , yield = function () {
};
var v = , yield = function () { };
@@ -3,5 +3,4 @@ function foo();
function bar() { }
//// [FunctionDeclaration4.js]
function bar() {
}
function bar() { }
@@ -6,6 +6,5 @@
//// [FunctionDeclaration6.js]
{
function bar() {
}
function bar() { }
}
@@ -2,5 +2,4 @@
var v = function * () { }
//// [FunctionExpression1_es6.js]
var v = function () {
};
var v = function () { };
@@ -2,5 +2,4 @@
var v = function * foo() { }
//// [FunctionExpression2_es6.js]
var v = function foo() {
};
var v = function foo() { };
@@ -2,5 +2,4 @@
var v = { *foo() { } }
//// [FunctionPropertyAssignments1_es6.js]
var v = { foo: function () {
} };
var v = { foo: function () { } };
@@ -2,5 +2,4 @@
var v = { *() { } }
//// [FunctionPropertyAssignments2_es6.js]
var v = { : function () {
} };
var v = { : function () { } };
@@ -2,5 +2,4 @@
var v = { *{ } }
//// [FunctionPropertyAssignments3_es6.js]
var v = { : function () {
} };
var v = { : function () { } };
@@ -2,5 +2,4 @@
var v = { *[foo()]() { } }
//// [FunctionPropertyAssignments5_es6.js]
var v = { [foo()]: function () {
} };
var v = { [foo()]: function () { } };
@@ -2,5 +2,4 @@
var v = { *<T>() { } }
//// [FunctionPropertyAssignments6_es6.js]
var v = { : function () {
} };
var v = { : function () { } };
@@ -8,8 +8,7 @@ var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "Foo", {
set: function (a) {
},
set: function (a) { },
enumerable: true,
configurable: true
});
@@ -7,7 +7,6 @@ class C {
var C = (function () {
function C() {
}
C.prototype.foo = function () {
};
C.prototype.foo = function () { };
return C;
})();
@@ -7,7 +7,6 @@ class C {
var C = (function () {
function C() {
}
C.prototype.foo = function () {
};
C.prototype.foo = function () { };
return C;
})();
@@ -7,7 +7,6 @@ class C {
var C = (function () {
function C() {
}
C.prototype[foo] = function () {
};
C.prototype[foo] = function () { };
return C;
})();
@@ -7,7 +7,6 @@ class C {
var C = (function () {
function C() {
}
C.prototype. = function () {
};
C.prototype. = function () { };
return C;
})();
@@ -7,7 +7,6 @@ class C {
var C = (function () {
function C() {
}
C.prototype.foo = function () {
};
C.prototype.foo = function () { };
return C;
})();
+1 -2
View File
@@ -7,7 +7,6 @@ class C {
var C = (function () {
function C() {
}
C.prototype.m = function () {
};
C.prototype.m = function () { };
return C;
})();
+1 -2
View File
@@ -7,7 +7,6 @@ class C {
var C = (function () {
function C() {
}
C.m = function () {
};
C.m = function () { };
return C;
})();
+1 -2
View File
@@ -7,7 +7,6 @@ class C {
var C = (function () {
function C() {
}
C.m = function () {
};
C.m = function () { };
return C;
})();
+1 -2
View File
@@ -7,7 +7,6 @@ class C {
var C = (function () {
function C() {
}
C.prototype.m = function () {
};
C.prototype.m = function () { };
return C;
})();
@@ -50,8 +50,7 @@ class E {
var C = (function () {
function C() {
}
C.privateMethod = function () {
};
C.privateMethod = function () { };
Object.defineProperty(C, "privateGetter", {
get: function () {
return 0;
@@ -60,13 +59,11 @@ var C = (function () {
configurable: true
});
Object.defineProperty(C, "privateSetter", {
set: function (a) {
},
set: function (a) { },
enumerable: true,
configurable: true
});
C.protectedMethod = function () {
};
C.protectedMethod = function () { };
Object.defineProperty(C, "protectedGetter", {
get: function () {
return 0;
@@ -75,13 +72,11 @@ var C = (function () {
configurable: true
});
Object.defineProperty(C, "protectedSetter", {
set: function (a) {
},
set: function (a) { },
enumerable: true,
configurable: true
});
C.publicMethod = function () {
};
C.publicMethod = function () { };
Object.defineProperty(C, "publicGetter", {
get: function () {
return 0;
@@ -90,8 +85,7 @@ var C = (function () {
configurable: true
});
Object.defineProperty(C, "publicSetter", {
set: function (a) {
},
set: function (a) { },
enumerable: true,
configurable: true
});
@@ -101,8 +95,7 @@ var C = (function () {
var D = (function () {
function D() {
}
D.privateMethod = function () {
};
D.privateMethod = function () { };
Object.defineProperty(D, "privateGetter", {
get: function () {
return 0;
@@ -111,13 +104,11 @@ var D = (function () {
configurable: true
});
Object.defineProperty(D, "privateSetter", {
set: function (a) {
},
set: function (a) { },
enumerable: true,
configurable: true
});
D.protectedMethod = function () {
};
D.protectedMethod = function () { };
Object.defineProperty(D, "protectedGetter", {
get: function () {
return 0;
@@ -126,13 +117,11 @@ var D = (function () {
configurable: true
});
Object.defineProperty(D, "protectedSetter", {
set: function (a) {
},
set: function (a) { },
enumerable: true,
configurable: true
});
D.publicMethod = function () {
};
D.publicMethod = function () { };
Object.defineProperty(D, "publicGetter", {
get: function () {
return 0;
@@ -141,8 +130,7 @@ var D = (function () {
configurable: true
});
Object.defineProperty(D, "publicSetter", {
set: function (a) {
},
set: function (a) { },
enumerable: true,
configurable: true
});
@@ -152,8 +140,7 @@ var D = (function () {
var E = (function () {
function E() {
}
E.prototype.method = function () {
};
E.prototype.method = function () { };
Object.defineProperty(E.prototype, "getter", {
get: function () {
return 0;
@@ -162,8 +149,7 @@ var E = (function () {
configurable: true
});
Object.defineProperty(E.prototype, "setter", {
set: function (a) {
},
set: function (a) { },
enumerable: true,
configurable: true
});
@@ -10,14 +10,12 @@ var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "X", {
set: function (v) {
},
set: function (v) { },
enumerable: true,
configurable: true
});
Object.defineProperty(C, "X", {
set: function (v2) {
},
set: function (v2) { },
enumerable: true,
configurable: true
});
+1 -2
View File
@@ -52,6 +52,5 @@ var x = {
}
};
var y = {
set b(v) {
}
set b(v) { }
};
+1 -2
View File
@@ -49,6 +49,5 @@ var x = {
}
};
var y = {
set b(v) {
}
set b(v) { }
};
@@ -10,16 +10,12 @@ var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "X", {
set: function (v) {
if (v === void 0) { v = 0; }
},
set: function (v) { },
enumerable: true,
configurable: true
});
Object.defineProperty(C, "X", {
set: function (v2) {
if (v2 === void 0) { v2 = 0; }
},
set: function (v2) { },
enumerable: true,
configurable: true
});
@@ -10,22 +10,12 @@ var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "X", {
set: function () {
var v = [];
for (var _i = 0; _i < arguments.length; _i++) {
v[_i - 0] = arguments[_i];
}
},
set: function () { },
enumerable: true,
configurable: true
});
Object.defineProperty(C, "X", {
set: function () {
var v2 = [];
for (var _i = 0; _i < arguments.length; _i++) {
v2[_i - 0] = arguments[_i];
}
},
set: function () { },
enumerable: true,
configurable: true
});
@@ -21,8 +21,7 @@ var LanguageSpec_section_4_5_error_cases = (function () {
get: function () {
return "";
},
set: function (a) {
},
set: function (a) { },
enumerable: true,
configurable: true
});
@@ -30,8 +29,7 @@ var LanguageSpec_section_4_5_error_cases = (function () {
get: function () {
return "";
},
set: function (a) {
},
set: function (a) { },
enumerable: true,
configurable: true
});
@@ -50,8 +50,7 @@ var LanguageSpec_section_4_5_inference = (function () {
get: function () {
return new B();
},
set: function (a) {
},
set: function (a) { },
enumerable: true,
configurable: true
});
@@ -59,8 +58,7 @@ var LanguageSpec_section_4_5_inference = (function () {
get: function () {
return new B();
},
set: function (a) {
},
set: function (a) { },
enumerable: true,
configurable: true
});
@@ -68,8 +66,7 @@ var LanguageSpec_section_4_5_inference = (function () {
get: function () {
return new B();
},
set: function (a) {
},
set: function (a) { },
enumerable: true,
configurable: true
});
@@ -77,8 +74,7 @@ var LanguageSpec_section_4_5_inference = (function () {
get: function () {
return new B();
},
set: function (a) {
},
set: function (a) { },
enumerable: true,
configurable: true
});
@@ -86,8 +82,7 @@ var LanguageSpec_section_4_5_inference = (function () {
get: function () {
return new B();
},
set: function (a) {
},
set: function (a) { },
enumerable: true,
configurable: true
});
@@ -95,8 +90,7 @@ var LanguageSpec_section_4_5_inference = (function () {
get: function () {
return new B();
},
set: function (a) {
},
set: function (a) { },
enumerable: true,
configurable: true
});
@@ -40,13 +40,11 @@ var r19 = a + { a: '' };
var r20 = a + ((a: string) => { return a });
//// [additionOperatorWithAnyAndEveryType.js]
function foo() {
}
function foo() { }
var C = (function () {
function C() {
}
C.foo = function () {
};
C.foo = function () { };
return C;
})();
var E;
@@ -41,13 +41,11 @@ var r19 = E.a + C.foo();
var r20 = E.a + M;
//// [additionOperatorWithInvalidOperands.js]
function foo() {
}
function foo() { }
var C = (function () {
function C() {
}
C.foo = function () {
};
C.foo = function () { };
return C;
})();
var E;
@@ -44,5 +44,4 @@ var r7 = null + d;
var r8 = null + true;
var r9 = null + { a: '' };
var r10 = null + foo();
var r11 = null + (function () {
});
var r11 = null + (function () { });
@@ -74,7 +74,6 @@ function foo(t, u) {
var r16 = t + undefined;
var r17 = t + t;
var r18 = t + u;
var r19 = t + (function () {
});
var r19 = t + (function () { });
var r20 = t + [];
}
@@ -44,5 +44,4 @@ var r7 = undefined + d;
var r8 = undefined + true;
var r9 = undefined + { a: '' };
var r10 = undefined + foo();
var r11 = undefined + (function () {
});
var r11 = undefined + (function () { });
@@ -118,8 +118,7 @@ var E;
E[E["A"] = 0] = "A";
})(E || (E = {}));
var r3 = foo3(a); // any
function f() {
}
function f() { }
var f;
(function (f) {
f.bar = 1;
@@ -146,8 +146,7 @@ var E;
(function (E) {
E[E["A"] = 0] = "A";
})(E || (E = {}));
function f() {
}
function f() { }
var f;
(function (f) {
f.bar = 1;
+1 -2
View File
@@ -10,6 +10,5 @@ module myMod {
var myMod;
(function (myMod) {
var myFn;
function myFn() {
}
function myFn() { }
})(myMod || (myMod = {}));
@@ -13,8 +13,7 @@ class C {
}
//// [anyIdenticalToItself.js]
function foo(x, y) {
}
function foo(x, y) { }
var C = (function () {
function C() {
}
@@ -44,10 +44,8 @@ var Elephant = (function () {
}
return Elephant;
})();
function foo(animals) {
}
function bar(animals) {
}
function foo(animals) { }
function bar(animals) { }
foo([
new Giraffe(),
new Elephant()
@@ -5,10 +5,5 @@ panic([], 'one', 'two');
//// [arrayLiteralInNonVarArgParameter.js]
function panic(val) {
var opt = [];
for (var _i = 1; _i < arguments.length; _i++) {
opt[_i - 1] = arguments[_i];
}
}
function panic(val) { }
panic([], 'one', 'two');
@@ -28,8 +28,7 @@ var r7 = r6(''); // any not string
//// [arrayOfFunctionTypes3.js]
// valid uses of arrays of function types
var x = [function () { return 1; }, function () {
}];
var x = [function () { return 1; }, function () { }];
var r2 = x[0]();
var C = (function () {
function C() {
@@ -7,7 +7,6 @@ class X {
var X = (function () {
function X() {
}
X.prototype.f = function (a) {
};
X.prototype.f = function (a) { };
return X;
})();
@@ -138,8 +138,7 @@ function someOtherFn() {
// Arrow function used in nested function in function
function outerFn() {
function innerFn() {
var arrowFn = function () {
};
var arrowFn = function () { };
var p = arrowFn();
var p;
}
@@ -69,16 +69,11 @@ module okay {
//// [arrowFunctionsMissingTokens.js]
var missingArrowsWithCurly;
(function (missingArrowsWithCurly) {
var a = function () {
};
var b = function () {
};
var c = function (x) {
};
var d = function (x, y) {
};
var e = function (x, y) {
};
var a = function () { };
var b = function () { };
var c = function (x) { };
var d = function (x, y) { };
var e = function (x, y) { };
})(missingArrowsWithCurly || (missingArrowsWithCurly = {}));
var missingCurliesWithArrow;
(function (missingCurliesWithArrow) {
@@ -127,14 +122,9 @@ var ce_nEst_pas_une_arrow_function;
})(ce_nEst_pas_une_arrow_function || (ce_nEst_pas_une_arrow_function = {}));
var okay;
(function (okay) {
var a = function () {
};
var b = function () {
};
var c = function (x) {
};
var d = function (x, y) {
};
var e = function (x, y) {
};
var a = function () { };
var b = function () { };
var c = function (x) { };
var d = function (x, y) { };
var e = function (x, y) { };
})(okay || (okay = {}));
@@ -10,8 +10,7 @@ fn(function (a, b) { return true; })
//// [assignLambdaToNominalSubtypeOfFunction.js]
function fn(cb) {
}
function fn(cb) { }
fn(function (a, b) { return true; });
fn(function (a, b) {
return true;
@@ -53,8 +53,7 @@ var C = (function () {
});
return C;
})();
function foo(test) {
}
function foo(test) { }
var x;
var y;
foo(x);
@@ -12,17 +12,13 @@ foo3((n) => { return; });
//// [assignmentCompatBug5.js]
function foo1(x) {
}
function foo1(x) { }
foo1({ b: 5 });
function foo2(x) {
}
function foo2(x) { }
foo2(["s", "t"]);
function foo3(x) {
}
function foo3(x) { }
;
foo3(function (s) {
});
foo3(function (s) { });
foo3(function (n) {
return;
});
@@ -20,10 +20,8 @@ Biz(new Foo());
var Foo = (function () {
function Foo() {
}
Foo.prototype.Boz = function () {
};
Foo.prototype.Boz = function () { };
return Foo;
})();
function Biz(map) {
}
function Biz(map) { }
Biz(new Foo());
@@ -13,6 +13,5 @@ var Foo = (function () {
return Foo;
})();
;
function bar(x) {
}
function bar(x) { }
bar(Foo); // Error, but should be allowed
@@ -39,17 +39,14 @@ x = [''];
x = 4;
x = {};
// Should work
function f() {
}
function f() { }
;
x = f;
function fn(c) {
}
function fn(c) { }
// Should Fail
fn('');
fn(['']);
fn(4);
fn({});
// Should work
fn(function (a) {
});
fn(function (a) { });
@@ -39,17 +39,14 @@ x = [''];
x = 4;
x = {};
// Should work
function f() {
}
function f() { }
;
x = f;
function fn(c) {
}
function fn(c) { }
// Should Fail
fn('');
fn(['']);
fn(4);
fn({});
// Should work
fn(function (a) {
});
fn(function (a) { });
@@ -138,11 +138,9 @@ var Derived = (function (_super) {
return Derived;
})(C);
// function expression
function bar() {
}
function bar() { }
value;
(function () {
});
(function () { });
value;
// function calls
foo() = value;
@@ -159,6 +157,5 @@ foo() = value;
(/d+/) = value;
({}) = value;
([]) = value;
(function baz() {
}) = value;
(function baz() { }) = value;
(foo()) = value;
@@ -13,7 +13,6 @@ g(1, "")
var f = function (x, y) {
x = y;
};
var g = function (x, y) {
};
var g = function (x, y) { };
g = f;
g(1, "");
@@ -11,8 +11,7 @@ module foo {
}
//// [assignmentToFunction.js]
function fn() {
}
function fn() { }
fn = function () { return 3; };
var foo;
(function (foo) {
@@ -37,24 +37,20 @@ var goodObj = {
}
}; // Ok, because toString is a subtype of Object's toString
var errFun = {}; // Error for no call signature
function foo() {
}
function foo() { }
var foo;
(function (foo) {
foo.boom = 0;
})(foo || (foo = {}));
var goodFundule = foo; // ok
function bar() {
}
function bar() { }
var bar;
(function (bar) {
function apply(thisArg, argArray) {
}
function apply(thisArg, argArray) { }
bar.apply = apply;
})(bar || (bar = {}));
var goodFundule2 = bar; // ok
function bad() {
}
function bad() { }
var bad;
(function (bad) {
bad.apply = 0;
@@ -103,8 +103,7 @@ M2.M3 = { x: 3 }; // OK
M2.M3 = { x: '' }; // Error
(M2).M3 = { x: '' }; // Error
(M2.M3) = { x: '' }; // Error
function fn() {
}
function fn() { }
fn = function () { return 3; }; // Bug 823548: Should be error (fn is not a reference)
(fn) = function () { return 3; }; // Should be error
function fn2(x, y) {
@@ -36,8 +36,7 @@ var E;
(function (E) {
})(E || (E = {}));
E = null;
function f() {
}
function f() { }
f = null;
var x = 1;
x = null;
+1 -2
View File
@@ -53,8 +53,7 @@ var E;
})(E || (E = {}));
E = null; // Error
0 /* A */ = null; // OK per spec, Error per implementation (509581)
function fn() {
}
function fn() { }
fn = null; // Should be error
var v;
v = null; // OK
@@ -23,7 +23,6 @@ var v2: {
//// [augmentedTypeAssignmentCompatIndexSignature.js]
var o = {};
var f = function () {
};
var f = function () { };
var v1 = o; // Should be allowed
var v2 = f; // Should be allowed
@@ -15,5 +15,4 @@ var b = (() => { })[0]; // Should be Bar
//// [augmentedTypeBracketAccessIndexSignature.js]
var a = {}[0]; // Should be Foo
var b = (function () {
})[0]; // Should be Bar
var b = (function () { })[0]; // Should be Bar
@@ -15,8 +15,7 @@ var r4 = f['data']; // Should be number
//// [augmentedTypeBracketNamedPropertyAccess.js]
var o = {};
var f = function () {
};
var f = function () { };
var r1 = o['data']; // Should be number
var r2 = o['functionData']; // Should be any (no property found)
var r3 = f['functionData']; // Should be string
@@ -12,8 +12,7 @@ enum c4 { One } // error
var c1 = (function () {
function c1() {
}
c1.prototype.foo = function () {
};
c1.prototype.foo = function () { };
return c1;
})();
var c1 = 1; // error
@@ -21,8 +20,7 @@ var c1 = 1; // error
var c4 = (function () {
function c4() {
}
c4.prototype.foo = function () {
};
c4.prototype.foo = function () { };
return c4;
})();
var c4;
@@ -9,11 +9,8 @@ var c2 = () => { }
var c2 = (function () {
function c2() {
}
c2.prototype.foo = function () {
};
c2.prototype.foo = function () { };
return c2;
})(); // error
function c2() {
} // error
var c2 = function () {
};
function c2() { } // error
var c2 = function () { };
@@ -18,15 +18,13 @@ class c5c { public foo() { } }
var c5 = (function () {
function c5() {
}
c5.prototype.foo = function () {
};
c5.prototype.foo = function () { };
return c5;
})();
var c5a = (function () {
function c5a() {
}
c5a.prototype.foo = function () {
};
c5a.prototype.foo = function () { };
return c5a;
})();
var c5a;
@@ -36,8 +34,7 @@ var c5a;
var c5b = (function () {
function c5b() {
}
c5b.prototype.foo = function () {
};
c5b.prototype.foo = function () { };
return c5b;
})();
var c5b;
@@ -48,8 +45,7 @@ var c5b;
var c5c = (function () {
function c5c() {
}
c5c.prototype.foo = function () {
};
c5c.prototype.foo = function () { };
return c5c;
})();
//import c5c = require('');
@@ -9,14 +9,12 @@ class c3 { public bar() { } } // error
var c3 = (function () {
function c3() {
}
c3.prototype.foo = function () {
};
c3.prototype.foo = function () { };
return c3;
})(); // error
var c3 = (function () {
function c3() {
}
c3.prototype.bar = function () {
};
c3.prototype.bar = function () { };
return c3;
})(); // error
@@ -47,14 +47,12 @@ var e2;
(function (e2) {
e2[e2["One"] = 0] = "One";
})(e2 || (e2 = {})); // error
function e2() {
} // error
function e2() { } // error
var e3;
(function (e3) {
e3[e3["One"] = 0] = "One";
})(e3 || (e3 = {})); // error
var e3 = function () {
}; // error
var e3 = function () { }; // error
// enum then class
var e4;
(function (e4) {
@@ -63,8 +61,7 @@ var e4;
var e4 = (function () {
function e4() {
}
e4.prototype.foo = function () {
};
e4.prototype.foo = function () { };
return e4;
})(); // error
// enum then enum
@@ -9,8 +9,7 @@ define(["require", "exports"], function (require, exports) {
var c5 = (function () {
function c5() {
}
c5.prototype.foo = function () {
};
c5.prototype.foo = function () { };
return c5;
})();
});
@@ -40,59 +40,46 @@ module y5c { export interface I { foo(): void } } // should be an error
//// [augmentedTypesFunction.js]
// function then var
function y1() {
} // error
function y1() { } // error
var y1 = 1; // error
// function then function
function y2() {
} // error
function y2() {
} // error
function y2a() {
} // error
var y2a = function () {
}; // error
function y2() { } // error
function y2() { } // error
function y2a() { } // error
var y2a = function () { }; // error
// function then class
function y3() {
} // error
function y3() { } // error
var y3 = (function () {
function y3() {
}
return y3;
})(); // error
function y3a() {
} // error
function y3a() { } // error
var y3a = (function () {
function y3a() {
}
y3a.prototype.foo = function () {
};
y3a.prototype.foo = function () { };
return y3a;
})(); // error
// function then enum
function y4() {
} // error
function y4() { } // error
var y4;
(function (y4) {
y4[y4["One"] = 0] = "One";
})(y4 || (y4 = {})); // error
// function then internal module
function y5() {
}
function y5a() {
}
function y5() { }
function y5a() { }
var y5a;
(function (y5a) {
var y = 2;
})(y5a || (y5a = {})); // should be an error
function y5b() {
}
function y5b() { }
var y5b;
(function (y5b) {
y5b.y = 3;
})(y5b || (y5b = {})); // should be an error
function y5c() {
}
function y5c() { }
// function then import, messes with other errors
//function y6() { }
//import y6 = require('');
@@ -115,51 +115,43 @@ var m1d;
var I = (function () {
function I() {
}
I.prototype.foo = function () {
};
I.prototype.foo = function () { };
return I;
})();
m1d.I = I;
})(m1d || (m1d = {}));
var m1d = 1; // error
function m2() {
}
function m2() { }
; // ok since the module is not instantiated
var m2a;
(function (m2a) {
var y = 2;
})(m2a || (m2a = {}));
function m2a() {
}
function m2a() { }
; // error since the module is instantiated
var m2b;
(function (m2b) {
m2b.y = 2;
})(m2b || (m2b = {}));
function m2b() {
}
function m2b() { }
; // error since the module is instantiated
// should be errors to have function first
function m2c() {
}
function m2c() { }
;
var m2c;
(function (m2c) {
m2c.y = 2;
})(m2c || (m2c = {}));
function m2f() {
}
function m2f() { }
;
function m2g() {
}
function m2g() { }
;
var m2g;
(function (m2g) {
var C = (function () {
function C() {
}
C.prototype.foo = function () {
};
C.prototype.foo = function () { };
return C;
})();
m2g.C = C;
@@ -176,15 +168,13 @@ var m3a;
var m3a = (function () {
function m3a() {
}
m3a.prototype.foo = function () {
};
m3a.prototype.foo = function () { };
return m3a;
})(); // error, class isn't ambient or declared before the module
var m3b = (function () {
function m3b() {
}
m3b.prototype.foo = function () {
};
m3b.prototype.foo = function () { };
return m3b;
})();
var m3b;
@@ -194,8 +184,7 @@ var m3b;
var m3c = (function () {
function m3c() {
}
m3c.prototype.foo = function () {
};
m3c.prototype.foo = function () { };
return m3c;
})();
var m3c;
@@ -215,8 +204,7 @@ var m3g;
var C = (function () {
function C() {
}
C.prototype.foo = function () {
};
C.prototype.foo = function () { };
return C;
})();
m3g.C = C;
@@ -249,8 +237,7 @@ var m4d;
var C = (function () {
function C() {
}
C.prototype.foo = function () {
};
C.prototype.foo = function () { };
return C;
})();
})(m4d || (m4d = {}));
@@ -29,25 +29,21 @@ module m2g { export class C { foo() { } } }
//// [augmentedTypesModules2.js]
function m2() {
}
function m2() { }
; // ok since the module is not instantiated
var m2a;
(function (m2a) {
var y = 2;
})(m2a || (m2a = {}));
function m2a() {
}
function m2a() { }
; // error since the module is instantiated
var m2b;
(function (m2b) {
m2b.y = 2;
})(m2b || (m2b = {}));
function m2b() {
}
function m2b() { }
; // error since the module is instantiated
function m2c() {
}
function m2c() { }
;
var m2c;
(function (m2c) {
@@ -57,22 +53,18 @@ var m2cc;
(function (m2cc) {
m2cc.y = 2;
})(m2cc || (m2cc = {}));
function m2cc() {
}
function m2cc() { }
; // error to have module first
function m2f() {
}
function m2f() { }
;
function m2g() {
}
function m2g() { }
;
var m2g;
(function (m2g) {
var C = (function () {
function C() {
}
C.prototype.foo = function () {
};
C.prototype.foo = function () { };
return C;
})();
m2g.C = C;
@@ -19,7 +19,6 @@ var m3a;
var m3a = (function () {
function m3a() {
}
m3a.prototype.foo = function () {
};
m3a.prototype.foo = function () { };
return m3a;
})(); // error, class isn't ambient or declared before the module
@@ -22,8 +22,7 @@ module m3g { export class C { foo() { } } }
var m3b = (function () {
function m3b() {
}
m3b.prototype.foo = function () {
};
m3b.prototype.foo = function () { };
return m3b;
})();
var m3b;
@@ -33,8 +32,7 @@ var m3b;
var m3c = (function () {
function m3c() {
}
m3c.prototype.foo = function () {
};
m3c.prototype.foo = function () { };
return m3c;
})();
var m3c;
@@ -54,8 +52,7 @@ var m3g;
var C = (function () {
function C() {
}
C.prototype.foo = function () {
};
C.prototype.foo = function () { };
return C;
})();
m3g.C = C;
@@ -51,8 +51,7 @@ var m4d;
var C = (function () {
function C() {
}
C.prototype.foo = function () {
};
C.prototype.foo = function () { };
return C;
})();
})(m4d || (m4d = {}));
@@ -42,11 +42,9 @@ var x1 = 1;
var x1 = 2;
// var then function
var x2 = 1; // error
function x2() {
} // error
function x2() { } // error
var x3 = 1;
var x3 = function () {
}; // error
var x3 = function () { }; // error
// var then class
var x4 = 1; // error
var x4 = (function () {
@@ -58,8 +56,7 @@ var x4a = 1; // error
var x4a = (function () {
function x4a() {
}
x4a.prototype.foo = function () {
};
x4a.prototype.foo = function () { };
return x4a;
})(); // error
// var then enum
+1 -2
View File
@@ -33,8 +33,7 @@ b.foo();
//// [autolift3.js]
var B = (function () {
function B() {
function foo() {
}
function foo() { }
foo();
var a = 0;
var inner = (function () {
@@ -20,11 +20,6 @@ interface Base2 {
var Derived2 = (function () {
function Derived2() {
}
Derived2.prototype.method = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
};
Derived2.prototype.method = function () { };
return Derived2;
})();
@@ -63,15 +63,9 @@ var r = true ? 1 : 2;
var r3 = true ? 1 : {};
var r4 = true ? a : b; // typeof a
var r5 = true ? b : a; // typeof b
var r6 = true ? function (x) {
} : function (x) {
}; // returns number => void
var r7 = true ? function (x) {
} : function (x) {
};
var r8 = true ? function (x) {
} : function (x) {
}; // returns Object => void
var r6 = true ? function (x) { } : function (x) { }; // returns number => void
var r7 = true ? function (x) { } : function (x) { };
var r8 = true ? function (x) { } : function (x) { }; // returns Object => void
var r10 = true ? derived : derived2; // no error since we use the contextual type in BCT
var r11 = true ? base : derived2;
function foo5(t, u) {
@@ -68,8 +68,7 @@ var ANY;
var ANY1;
var ANY2 = ["", ""];
var obj;
var obj1 = { x: "", y: function () {
} };
var obj1 = { x: "", y: function () { } };
function foo() {
var a;
return a;
+1 -2
View File
@@ -22,8 +22,7 @@ var Foo = (function () {
function Foo(x) {
// WScript.Echo("Constructor function has executed");
}
Foo.prototype.bar1 = function () {
};
Foo.prototype.bar1 = function () { };
return Foo;
})();
function F1(a) {
+1 -2
View File
@@ -30,8 +30,7 @@ var Foo = (function () {
function Foo(x) {
// WScript.Echo("Constructor function has executed");
}
Foo.prototype.bar1 = function () {
};
Foo.prototype.bar1 = function () { };
return Foo;
})();
function F1(s) {
+1 -2
View File
@@ -23,8 +23,7 @@ var Foo = (function () {
function Foo(x) {
// WScript.Echo("Constructor function has executed");
}
Foo.prototype.bar1 = function () {
};
Foo.prototype.bar1 = function () { };
return Foo;
})();
//class Foo(s: String);
+1 -2
View File
@@ -23,8 +23,7 @@ var Foo = (function () {
function Foo(x) {
// WScript.Echo("Constructor function has executed");
}
Foo.prototype.bar1 = function () {
};
Foo.prototype.bar1 = function () { };
return Foo;
})();
var f1 = new Foo("hey");

Some files were not shown because too many files have changed in this diff Show More