diff --git a/Jakefile b/Jakefile index 34879a56691..64394c2d60e 100644 --- a/Jakefile +++ b/Jakefile @@ -55,6 +55,7 @@ var servicesSources = [ ].map(function (f) { return path.join(compilerDirectory, f); }).concat([ + "breakpoints.ts", "services.ts", "shims.ts", "signatureHelp.ts", diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b1e256f1300..7a959c0dbfc 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7945,77 +7945,6 @@ module ts { return node.parent && node.parent.kind === SyntaxKind.TypeReference; } - function isExpression(node: Node): boolean { - switch (node.kind) { - case SyntaxKind.ThisKeyword: - case SyntaxKind.SuperKeyword: - case SyntaxKind.NullKeyword: - case SyntaxKind.TrueKeyword: - case SyntaxKind.FalseKeyword: - case SyntaxKind.RegularExpressionLiteral: - case SyntaxKind.ArrayLiteral: - case SyntaxKind.ObjectLiteral: - case SyntaxKind.PropertyAccess: - case SyntaxKind.IndexedAccess: - case SyntaxKind.CallExpression: - case SyntaxKind.NewExpression: - case SyntaxKind.TypeAssertion: - case SyntaxKind.ParenExpression: - case SyntaxKind.FunctionExpression: - case SyntaxKind.ArrowFunction: - case SyntaxKind.PrefixOperator: - case SyntaxKind.PostfixOperator: - case SyntaxKind.BinaryExpression: - case SyntaxKind.ConditionalExpression: - case SyntaxKind.OmittedExpression: - return true; - case SyntaxKind.QualifiedName: - while (node.parent.kind === SyntaxKind.QualifiedName) node = node.parent; - return node.parent.kind === SyntaxKind.TypeQuery; - case SyntaxKind.Identifier: - if (node.parent.kind === SyntaxKind.TypeQuery) { - return true; - } - // Fall through - case SyntaxKind.NumericLiteral: - case SyntaxKind.StringLiteral: - var parent = node.parent; - switch (parent.kind) { - case SyntaxKind.VariableDeclaration: - case SyntaxKind.Parameter: - case SyntaxKind.Property: - case SyntaxKind.EnumMember: - case SyntaxKind.PropertyAssignment: - return (parent).initializer === node; - case SyntaxKind.ExpressionStatement: - case SyntaxKind.IfStatement: - case SyntaxKind.DoStatement: - case SyntaxKind.WhileStatement: - case SyntaxKind.ReturnStatement: - case SyntaxKind.WithStatement: - case SyntaxKind.SwitchStatement: - case SyntaxKind.CaseClause: - case SyntaxKind.ThrowStatement: - case SyntaxKind.SwitchStatement: - return (parent).expression === node; - case SyntaxKind.ForStatement: - return (parent).initializer === node || - (parent).condition === node || - (parent).iterator === node; - case SyntaxKind.ForInStatement: - return (parent).variable === node || - (parent).expression === node; - case SyntaxKind.TypeAssertion: - return node === (parent).operand; - default: - if (isExpression(parent)) { - return true; - } - } - } - return false; - } - function isTypeNode(node: Node): boolean { if (SyntaxKind.FirstTypeNode <= node.kind && node.kind <= SyntaxKind.LastTypeNode) { return true; diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 79140cff165..15383a0031b 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -67,6 +67,77 @@ module ts { return identifier.kind === SyntaxKind.Missing ? "(Missing)" : getTextOfNode(identifier); } + export function isExpression(node: Node): boolean { + switch (node.kind) { + case SyntaxKind.ThisKeyword: + case SyntaxKind.SuperKeyword: + case SyntaxKind.NullKeyword: + case SyntaxKind.TrueKeyword: + case SyntaxKind.FalseKeyword: + case SyntaxKind.RegularExpressionLiteral: + case SyntaxKind.ArrayLiteral: + case SyntaxKind.ObjectLiteral: + case SyntaxKind.PropertyAccess: + case SyntaxKind.IndexedAccess: + case SyntaxKind.CallExpression: + case SyntaxKind.NewExpression: + case SyntaxKind.TypeAssertion: + case SyntaxKind.ParenExpression: + case SyntaxKind.FunctionExpression: + case SyntaxKind.ArrowFunction: + case SyntaxKind.PrefixOperator: + case SyntaxKind.PostfixOperator: + case SyntaxKind.BinaryExpression: + case SyntaxKind.ConditionalExpression: + case SyntaxKind.OmittedExpression: + return true; + case SyntaxKind.QualifiedName: + while (node.parent.kind === SyntaxKind.QualifiedName) node = node.parent; + return node.parent.kind === SyntaxKind.TypeQuery; + case SyntaxKind.Identifier: + if (node.parent.kind === SyntaxKind.TypeQuery) { + return true; + } + // Fall through + case SyntaxKind.NumericLiteral: + case SyntaxKind.StringLiteral: + var parent = node.parent; + switch (parent.kind) { + case SyntaxKind.VariableDeclaration: + case SyntaxKind.Parameter: + case SyntaxKind.Property: + case SyntaxKind.EnumMember: + case SyntaxKind.PropertyAssignment: + return (parent).initializer === node; + case SyntaxKind.ExpressionStatement: + case SyntaxKind.IfStatement: + case SyntaxKind.DoStatement: + case SyntaxKind.WhileStatement: + case SyntaxKind.ReturnStatement: + case SyntaxKind.WithStatement: + case SyntaxKind.SwitchStatement: + case SyntaxKind.CaseClause: + case SyntaxKind.ThrowStatement: + case SyntaxKind.SwitchStatement: + return (parent).expression === node; + case SyntaxKind.ForStatement: + return (parent).initializer === node || + (parent).condition === node || + (parent).iterator === node; + case SyntaxKind.ForInStatement: + return (parent).variable === node || + (parent).expression === node; + case SyntaxKind.TypeAssertion: + return node === (parent).operand; + default: + if (isExpression(parent)) { + return true; + } + } + } + return false; + } + export function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic { node = getErrorSpanForNode(node); var file = getSourceFileOfNode(node); diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index c290d9d1811..33f435ce76b 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -985,15 +985,85 @@ module FourSlash { return item.parameters[currentParam]; } + private alignmentForExtraInfo = 50; + + private spanInfoToString(pos: number, spanInfo: TypeScript.TextSpan, prefixString: string) { + var resultString = "SpanInfo: " + JSON.stringify(spanInfo); + if (spanInfo) { + var spanString = this.activeFile.content.substr(spanInfo.start(), spanInfo.length()); + var spanLineMap = ts.getLineStarts(spanString); + for (var i = 0; i < spanLineMap.length; i++) { + if (!i) { + resultString += "\n"; + } + resultString += prefixString + spanString.substring(spanLineMap[i], spanLineMap[i + 1]); + } + resultString += "\n" + prefixString + ":=> (" + this.getLineColStringAtPosition(spanInfo.start()) + ") to (" + this.getLineColStringAtPosition(spanInfo.end()) + ")"; + } + + return resultString; + } + + private baselineCurrentFileLocations(getSpanAtPos: (pos: number) => TypeScript.TextSpan): string { + var fileLineMap = ts.getLineStarts(this.activeFile.content); + var nextLine = 0; + var resultString = ""; + var currentLine: string; + var previousSpanInfo: string; + var startColumn: number; + var length: number; + var prefixString = " >"; + + var addSpanInfoString = () => { + if (previousSpanInfo) { + resultString += currentLine; + var thisLineMarker = repeatString(startColumn, " ") + repeatString(length, "~"); + thisLineMarker += repeatString(this.alignmentForExtraInfo - thisLineMarker.length - prefixString.length + 1, " "); + resultString += thisLineMarker; + resultString += "=> Pos: (" + (pos - length) + " to " + (pos - 1) + ") "; + resultString += " " + previousSpanInfo; + previousSpanInfo = undefined; + } + }; + + for (var pos = 0; pos < this.activeFile.content.length; pos++) { + if (pos === 0 || pos === fileLineMap[nextLine]) { + nextLine++; + addSpanInfoString(); + if (resultString.length) { + resultString += "\n--------------------------------"; + } + currentLine = "\n" + nextLine.toString() + repeatString(3 - nextLine.toString().length, " ") + ">" + this.activeFile.content.substring(pos, fileLineMap[nextLine]) + "\n "; + startColumn = 0; + length = 0; + } + var spanInfo = this.spanInfoToString(pos, getSpanAtPos(pos), prefixString); + if (previousSpanInfo && previousSpanInfo !== spanInfo) { + addSpanInfoString(); + previousSpanInfo = spanInfo; + startColumn = startColumn + length; + length = 1; + } + else { + previousSpanInfo = spanInfo; + length++; + } + } + addSpanInfoString(); + return resultString; + + function repeatString(count: number, char: string) { + var result = ""; + for (var i = 0; i < count; i++) { + result += char; + } + return result; + } + } + public getBreakpointStatementLocation(pos: number) { this.taoInvalidReason = 'getBreakpointStatementLocation NYI'; - - var spanInfo = this.languageService.getBreakpointStatementAtPosition(this.activeFile.fileName, pos); - var resultString = "\n**Pos: " + pos + " SpanInfo: " + JSON.stringify(spanInfo) + "\n** Statement: "; - if (spanInfo !== null) { - resultString = resultString + this.activeFile.content.substr(spanInfo.start(), spanInfo.length()); - } - return resultString; + return this.languageService.getBreakpointStatementAtPosition(this.activeFile.fileName, pos); } public baselineCurrentFileBreakpointLocations() { @@ -1003,12 +1073,7 @@ module FourSlash { "Breakpoint Locations for " + this.activeFile.fileName, this.testData.globalOptions[testOptMetadataNames.baselineFile], () => { - var fileLength = this.languageServiceShimHost.getScriptSnapshot(this.activeFile.fileName).getLength(); - var resultString = ""; - for (var pos = 0; pos < fileLength; pos++) { - resultString = resultString + this.getBreakpointStatementLocation(pos); - } - return resultString; + return this.baselineCurrentFileLocations(pos => this.getBreakpointStatementLocation(pos)); }, true /* run immediately */); } @@ -1056,7 +1121,7 @@ module FourSlash { } public printBreakpointLocation(pos: number) { - Harness.IO.log(this.getBreakpointStatementLocation(pos)); + Harness.IO.log("\n**Pos: " + pos + " " + this.spanInfoToString(pos, this.getBreakpointStatementLocation(pos), " ")); } public printBreakpointAtCurrentLocation() { @@ -1502,7 +1567,7 @@ module FourSlash { throw new Error('verifyCaretAtMarker failed - expected to be in file "' + pos.fileName + '", but was in file "' + this.activeFile.fileName + '"'); } if (pos.position !== this.currentCaretPosition) { - throw new Error('verifyCaretAtMarker failed - expected to be at marker "/*' + markerName + '*/, but was at position ' + this.currentCaretPosition + '(' + this.getLineColStringAtCaret() + ')'); + throw new Error('verifyCaretAtMarker failed - expected to be at marker "/*' + markerName + '*/, but was at position ' + this.currentCaretPosition + '(' + this.getLineColStringAtPosition(this.currentCaretPosition) + ')'); } } @@ -1566,10 +1631,10 @@ module FourSlash { this.taoInvalidReason = 'verifyCurrentNameOrDottedNameSpanText NYI'; var span = this.languageService.getNameOrDottedNameSpan(this.activeFile.fileName, this.currentCaretPosition, this.currentCaretPosition); - if (span === null) { + if (!span) { this.raiseError('verifyCurrentNameOrDottedNameSpanText\n' + '\tExpected: "' + text + '"\n' + - '\t Actual: null'); + '\t Actual: undefined'); } var actual = this.languageServiceShimHost.getScriptSnapshot(this.activeFile.fileName).getText(span.start(), span.end()); @@ -1581,12 +1646,8 @@ module FourSlash { } private getNameOrDottedNameSpan(pos: number) { - var spanInfo = this.languageService.getNameOrDottedNameSpan(this.activeFile.fileName, pos, pos); - var resultString = "\n**Pos: " + pos + " SpanInfo: " + JSON.stringify(spanInfo) + "\n** Statement: "; - if (spanInfo !== null) { - resultString = resultString + this.languageServiceShimHost.getScriptSnapshot(this.activeFile.fileName).getText(spanInfo.start(), spanInfo.end()); - } - return resultString; + this.taoInvalidReason = 'getNameOrDottedNameSpan NYI'; + return this.languageService.getNameOrDottedNameSpan(this.activeFile.fileName, pos, pos); } public baselineCurrentFileNameOrDottedNameSpans() { @@ -1596,18 +1657,14 @@ module FourSlash { "Name OrDottedNameSpans for " + this.activeFile.fileName, this.testData.globalOptions[testOptMetadataNames.baselineFile], () => { - var fileLength = this.languageServiceShimHost.getScriptSnapshot(this.activeFile.fileName).getLength(); - var resultString = ""; - for (var pos = 0; pos < fileLength; pos++) { - resultString = resultString + this.getNameOrDottedNameSpan(pos); - } - return resultString; + return this.baselineCurrentFileLocations(pos => + this.getNameOrDottedNameSpan(pos)); }, true /* run immediately */); } public printNameOrDottedNameSpans(pos: number) { - Harness.IO.log(this.getNameOrDottedNameSpan(pos)); + Harness.IO.log(this.spanInfoToString(pos, this.getNameOrDottedNameSpan(pos), "**")); } private verifyClassifications(expected: { classificationType: string; text: string; textSpan?: TextSpan }[], actual: ts.ClassifiedSpan[]) { @@ -2114,8 +2171,8 @@ module FourSlash { return this.languageServiceShimHost.positionToZeroBasedLineCol(this.activeFile.fileName, this.currentCaretPosition).line + 1; } - private getLineColStringAtCaret() { - var pos = this.languageServiceShimHost.positionToZeroBasedLineCol(this.activeFile.fileName, this.currentCaretPosition); + private getLineColStringAtPosition(position: number) { + var pos = this.languageServiceShimHost.positionToZeroBasedLineCol(this.activeFile.fileName, position); return 'line ' + (pos.line + 1) + ', col ' + pos.character; } diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 923458c144d..3a72ee9bfa6 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -1,1085 +1,503 @@ // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. -module TypeScript.Services.Breakpoints { - function createBreakpointSpanInfo(parentElement: TypeScript.ISyntaxElement, ...childElements: TypeScript.ISyntaxElement[]): TextSpan { - if (!parentElement) { - return null; +/// + +module ts.BreakpointResolver { + /** + * Get the breakpoint span in given sourceFile + */ + export function spanInSourceFileAtLocation(sourceFile: SourceFile, position: number) { + // Cannot set breakpoint in dts file + if (sourceFile.flags & NodeFlags.DeclarationFile) { + return undefined; } - if (childElements.length == 0) { - return TextSpan.fromBounds(TypeScript.start(parentElement), TypeScript.end(parentElement)); - } + var tokenAtLocation = getTokenAtPosition(sourceFile, position); + var lineOfPosition = sourceFile.getLineAndCharacterFromPosition(position).line; + if (sourceFile.getLineAndCharacterFromPosition(tokenAtLocation.getStart()).line > lineOfPosition) { + // Get previous token if the token is returned starts on new line + // eg: var x =10; |--- curser is here + // var y = 10; + // token at position will return var keyword on second line as the token but we would like to use + // token on same line if trailing trivia (comments or white spaces on same line) part of the last token on that line + tokenAtLocation = findPrecedingToken(tokenAtLocation.pos, sourceFile); - var start: number; - var end: number; - for (var i = 0; i < childElements.length; i++) { - var element = childElements[i]; - if (element && !isShared(element)) { - if (start == undefined) { - start = TypeScript.start(element); - } - end = TypeScript.end(element); + // Its a blank line + if (!tokenAtLocation || sourceFile.getLineAndCharacterFromPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { + return undefined; } } - return TextSpan.fromBounds(start, end); - } - - function createBreakpointSpanInfoWithLimChar(startElement: TypeScript.ISyntaxElement, limChar: number): TextSpan { - return TextSpan.fromBounds(start(startElement), limChar); - } - - class BreakpointResolver { - constructor(private posLine: number, private lineMap: TypeScript.LineMap) { + // Cannot set breakpoint in ambient declarations + if (isInAmbientContext(tokenAtLocation)) { + return undefined; } - private breakpointSpanOfToken(positionedToken: TypeScript.ISyntaxToken): TextSpan { - switch (positionedToken.kind()) { - case TypeScript.SyntaxKind.OpenBraceToken: - return this.breakpointSpanOfOpenBrace(positionedToken); + // Get the span in the node based on its syntax + return spanInNode(tokenAtLocation); - case TypeScript.SyntaxKind.CloseBraceToken: - return this.breakpointSpanOfCloseBrace(positionedToken); + function textSpan(startNode: Node, endNode?: Node) { + return TypeScript.TextSpan.fromBounds(startNode.getStart(), (endNode || startNode).getEnd()); + } - case TypeScript.SyntaxKind.CommaToken: - return this.breakpointSpanOfComma(positionedToken); + function spanInNodeIfStartsOnSameLine(node: Node, otherwiseOnNode?: Node): TypeScript.TextSpan { + if (node && lineOfPosition === sourceFile.getLineAndCharacterFromPosition(node.getStart()).line) { + return spanInNode(node); + } + return spanInNode(otherwiseOnNode); + } - case TypeScript.SyntaxKind.SemicolonToken: - case TypeScript.SyntaxKind.EndOfFileToken: - return this.breakpointSpanIfStartsOnSameLine(previousToken(positionedToken)); + function spanInPreviousNode(node: Node): TypeScript.TextSpan { + return spanInNode(findPrecedingToken(node.pos, sourceFile)); + } - case TypeScript.SyntaxKind.CloseParenToken: - return this.breakpointSpanOfCloseParen(positionedToken); + function spanInNextNode(node: Node): TypeScript.TextSpan { + return spanInNode(findNextToken(node, node.parent)); + } - case TypeScript.SyntaxKind.DoKeyword: - var parentElement = positionedToken.parent; - if (parentElement && parentElement.kind() == TypeScript.SyntaxKind.DoStatement) { - return this.breakpointSpanIfStartsOnSameLine(nextToken(positionedToken)); + function spanInNode(node: Node): TypeScript.TextSpan { + if (node) { + if (isExpression(node)) { + if (node.parent.kind === SyntaxKind.DoStatement) { + // Set span as if on while keyword + return spanInPreviousNode(node); } - break; - } - return this.breakpointSpanOfContainingNode(positionedToken); - } + if (node.parent.kind === SyntaxKind.ForStatement) { + // For now lets set the span on this expression, fix it later + return textSpan(node); + } - private breakpointSpanOfOpenBrace(openBraceToken: TypeScript.ISyntaxToken): TextSpan { - var container = Syntax.containingNode(openBraceToken); - if (container) { - var originalContainer = container; - if (container && container.kind() == TypeScript.SyntaxKind.Block) { - // We have to check the parent and decide what to do with the breakpoint - container = Syntax.containingNode(container); - if (!container) { - container = originalContainer; + if (node.parent.kind === SyntaxKind.BinaryExpression && (node.parent).operator === SyntaxKind.CommaToken) { + // if this is comma expression, the breakpoint is possible in this expression + return textSpan(node); + } + + if (node.parent.kind == SyntaxKind.ArrowFunction && (node.parent).body == node) { + // If this is body of arrow function, it is allowed to have the breakpoint + return textSpan(node); } } - switch (container.kind()) { - case TypeScript.SyntaxKind.Block: - if (!this.canHaveBreakpointInBlock(container)) { - return null; - } - return this.breakpointSpanOfFirstStatementInBlock(container); - break; + switch (node.kind) { + case SyntaxKind.VariableStatement: + // Span on first variable declaration + return spanInVariableDeclaration((node).declarations[0]); - case TypeScript.SyntaxKind.ModuleDeclaration: - case TypeScript.SyntaxKind.ClassDeclaration: - case TypeScript.SyntaxKind.FunctionDeclaration: - case TypeScript.SyntaxKind.ConstructorDeclaration: - case TypeScript.SyntaxKind.MemberFunctionDeclaration: - case TypeScript.SyntaxKind.GetAccessor: - case TypeScript.SyntaxKind.SetAccessor: - case TypeScript.SyntaxKind.FunctionExpression: - case TypeScript.SyntaxKind.ParenthesizedArrowFunctionExpression: - case TypeScript.SyntaxKind.SimpleArrowFunctionExpression: - if (!this.canHaveBreakpointInDeclaration(container)) { - return null; + case SyntaxKind.VariableDeclaration: + case SyntaxKind.Property: + return spanInVariableDeclaration(node); + + case SyntaxKind.Parameter: + return spanInParameterDeclaration(node); + + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.Method: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.Constructor: + case SyntaxKind.FunctionExpression: + case SyntaxKind.ArrowFunction: + return spanInFunctionDeclaration(node); + + case SyntaxKind.FunctionBlock: + return spanInFunctionBlock(node); + + case SyntaxKind.Block: + case SyntaxKind.TryBlock: + case SyntaxKind.CatchBlock: + case SyntaxKind.FinallyBlock: + case SyntaxKind.ModuleBlock: + return spanInBlock(node); + + case SyntaxKind.ExpressionStatement: + // span on the expression + return textSpan((node).expression); + + case SyntaxKind.ReturnStatement: + // span on return keyword and expression if present + return textSpan(node.getChildAt(0), (node).expression); + + case SyntaxKind.WhileStatement: + // Span on while(...) + return textSpan(node, findNextToken((node).expression, node)); + + case SyntaxKind.DoStatement: + // span in statement of the do statement + return spanInNode((node).statement); + + case SyntaxKind.DebuggerStatement: + // span on debugger keyword + return textSpan(node.getChildAt(0)); + + case SyntaxKind.IfStatement: + // set on if(..) span + return textSpan(node, findNextToken((node).expression, node)); + + case SyntaxKind.LabeledStatement: + // span in statement + return spanInNode((node).statement); + + case SyntaxKind.BreakStatement: + case SyntaxKind.ContinueStatement: + // On break or continue keyword and label if present + return textSpan(node.getChildAt(0), (node).label); + + case SyntaxKind.ForStatement: + return spanInForStatement(node); + + case SyntaxKind.ForInStatement: + // span on for (a in ...) + return textSpan(node, findNextToken((node).expression, node)); + + case SyntaxKind.SwitchStatement: + // span on switch(...) + return textSpan(node, findNextToken((node).expression, node)); + + case SyntaxKind.CaseClause: + case SyntaxKind.DefaultClause: + // span in first statement of the clause + return spanInNode((node).statements[0]); + + case SyntaxKind.TryStatement: + // span in try block + return spanInBlock((node).tryBlock); + + case SyntaxKind.ThrowStatement: + // span in throw ... + return textSpan(node, (node).expression); + + case SyntaxKind.ExportAssignment: + // span on export = id + return textSpan(node, (node).exportName); + + case SyntaxKind.ImportDeclaration: + // import statement without including semicolon + return textSpan(node, (node).entityName || (node).externalModuleName); + + case SyntaxKind.ModuleDeclaration: + // span on complete module if it is instantiated + if (!isInstantiated(node)) { + return undefined; } - if (this.posLine != this.lineMap.getLineNumberFromPosition(start(container))) { - return this.breakpointSpanOfFirstChildOfSyntaxList(this.getSyntaxListOfDeclarationWithElements(container)); + + case SyntaxKind.ClassDeclaration: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.EnumMember: + case SyntaxKind.CallExpression: + case SyntaxKind.NewExpression: + // span on complete node + return textSpan(node); + + case SyntaxKind.WithStatement: + // span in statement + return spanInNode((node).statement); + + // No breakpoint in interface + case SyntaxKind.InterfaceDeclaration: + return undefined; + + // Tokens: + case SyntaxKind.SemicolonToken: + case SyntaxKind.EndOfFileToken: + return spanInNodeIfStartsOnSameLine(findPrecedingToken(node.pos, sourceFile)); + + case SyntaxKind.CommaToken: + return spanInPreviousNode(node) + + case SyntaxKind.OpenBraceToken: + return spanInOpenBraceToken(node); + + case SyntaxKind.CloseBraceToken: + return spanInCloseBraceToken(node); + + case SyntaxKind.OpenParenToken: + return spanInOpenParenToken(node); + + case SyntaxKind.CloseParenToken: + return spanInCloseParenToken(node); + + case SyntaxKind.ColonToken: + return spanInColonToken(node); + + case SyntaxKind.GreaterThanToken: + case SyntaxKind.LessThanToken: + return spanInGreaterThanOrLessThanToken(node); + + // Keywords: + case SyntaxKind.WhileKeyword: + return spanInWhileKeyword(node); + + case SyntaxKind.ElseKeyword: + case SyntaxKind.CatchKeyword: + case SyntaxKind.FinallyKeyword: + return spanInNextNode(node); + + default: + // If this is name of property assignment, set breakpoint in the initializer + if (node.parent.kind === SyntaxKind.PropertyAssignment && (node.parent).name === node) { + return spanInNode((node.parent).initializer); + } + + // Breakpoint in type assertion goes to its operand + if (node.parent.kind === SyntaxKind.TypeAssertion && (node.parent).type === node) { + return spanInNode((node.parent).operand); + } + + // return type of function go to previous token + if (isAnyFunction(node.parent) && (node.parent).type === node) { + return spanInPreviousNode(node); + } + + // Default go to parent to set the breakpoint + return spanInNode(node.parent); + } + } + + function spanInVariableDeclaration(variableDeclaration: VariableDeclaration): TypeScript.TextSpan { + // If declaration of for in statement, just set the span in parent + if (variableDeclaration.parent.kind === SyntaxKind.ForInStatement) { + return spanInNode(variableDeclaration.parent); + } + + var isParentVariableStatement = variableDeclaration.parent.kind === SyntaxKind.VariableStatement; + var isDeclarationOfForStatement = variableDeclaration.parent.kind === SyntaxKind.ForStatement && contains((variableDeclaration.parent).declarations, variableDeclaration); + var declarations = isParentVariableStatement + ? (variableDeclaration.parent).declarations + : isDeclarationOfForStatement + ? (variableDeclaration.parent).declarations + : undefined; + + // Breakpoint is possible in variableDeclaration only if there is initialization + if (variableDeclaration.initializer || (variableDeclaration.flags & NodeFlags.Export)) { + if (declarations && declarations[0] === variableDeclaration) { + if (isParentVariableStatement) { + // First declaration - include var keyword + return textSpan(variableDeclaration.parent, variableDeclaration); } else { - return this.breakpointSpanOf(container); + Debug.assert(isDeclarationOfForStatement); + // Include var keyword from for statement declarations in the span + return textSpan(findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); } - - case TypeScript.SyntaxKind.EnumDeclaration: - if (!this.canHaveBreakpointInDeclaration(container)) { - return null; - } - if (this.posLine != this.lineMap.getLineNumberFromPosition(start(container))) { - return this.breakpointSpanOfFirstEnumElement(container); - } - else { - return this.breakpointSpanOf(container); - } - - case TypeScript.SyntaxKind.IfStatement: - case TypeScript.SyntaxKind.ForInStatement: - case TypeScript.SyntaxKind.WhileStatement: - case TypeScript.SyntaxKind.CatchClause: - if (this.posLine != this.lineMap.getLineNumberFromPosition(start(container))) { - return this.breakpointSpanOfFirstStatementInBlock(originalContainer); - } - else { - return this.breakpointSpanOf(container); - } - - case TypeScript.SyntaxKind.DoStatement: - return this.breakpointSpanOfFirstStatementInBlock(originalContainer); - - case TypeScript.SyntaxKind.ForStatement: - if (this.posLine != this.lineMap.getLineNumberFromPosition(start(container))) { - return this.breakpointSpanOfFirstStatementInBlock(originalContainer); - } - else { - return this.breakpointSpanOf(previousToken(openBraceToken)); - } - - case TypeScript.SyntaxKind.ElseClause: - case TypeScript.SyntaxKind.CaseSwitchClause: - case TypeScript.SyntaxKind.DefaultSwitchClause: - case TypeScript.SyntaxKind.WithStatement: - case TypeScript.SyntaxKind.TryStatement: - case TypeScript.SyntaxKind.FinallyClause: - return this.breakpointSpanOfFirstStatementInBlock(originalContainer); - - case TypeScript.SyntaxKind.SwitchStatement: - if (this.posLine != this.lineMap.getLineNumberFromPosition(start(container))) { - return this.breakpointSpanOfFirstStatementOfFirstCaseClause(container); - } - else { - return this.breakpointSpanOf(container); - } - } - } - - return null; - } - - private breakpointSpanOfCloseBrace(closeBraceToken: TypeScript.ISyntaxToken): TextSpan { - var container = Syntax.containingNode(closeBraceToken); - if (container) { - var originalContainer = container; - if (container.kind() == TypeScript.SyntaxKind.Block) { - // We have to check the parent and decide what to do with the breakpoint - container = Syntax.containingNode(container); - if (!container) { - container = originalContainer; - } - } - - switch (container.kind()) { - case TypeScript.SyntaxKind.Block: - if (!this.canHaveBreakpointInBlock(container)) { - return null; - } - return this.breakpointSpanOfLastStatementInBlock(container); - break; - - case TypeScript.SyntaxKind.ModuleDeclaration: - if (!this.canHaveBreakpointInDeclaration(container)) { - return null; - } - var moduleSyntax = container; - if (moduleSyntax.moduleElements && moduleSyntax.moduleElements.length > 0) { - return createBreakpointSpanInfo(closeBraceToken); - } - else { - return null; - } - - case TypeScript.SyntaxKind.ClassDeclaration: - case TypeScript.SyntaxKind.FunctionDeclaration: - case TypeScript.SyntaxKind.ConstructorDeclaration: - case TypeScript.SyntaxKind.MemberFunctionDeclaration: - case TypeScript.SyntaxKind.GetAccessor: - case TypeScript.SyntaxKind.SetAccessor: - case TypeScript.SyntaxKind.FunctionExpression: - if (!this.canHaveBreakpointInDeclaration(container)) { - return null; - } - return createBreakpointSpanInfo(closeBraceToken); - - case TypeScript.SyntaxKind.EnumDeclaration: - if (!this.canHaveBreakpointInDeclaration(container)) { - return null; - } - return createBreakpointSpanInfo(closeBraceToken); - - case TypeScript.SyntaxKind.IfStatement: - case TypeScript.SyntaxKind.ElseClause: - case TypeScript.SyntaxKind.ForInStatement: - case TypeScript.SyntaxKind.ForStatement: - case TypeScript.SyntaxKind.WhileStatement: - case TypeScript.SyntaxKind.DoStatement: - case TypeScript.SyntaxKind.CaseSwitchClause: - case TypeScript.SyntaxKind.DefaultSwitchClause: - case TypeScript.SyntaxKind.WithStatement: - case TypeScript.SyntaxKind.TryStatement: - case TypeScript.SyntaxKind.CatchClause: - case TypeScript.SyntaxKind.FinallyClause: - case TypeScript.SyntaxKind.ParenthesizedArrowFunctionExpression: - case TypeScript.SyntaxKind.SimpleArrowFunctionExpression: - return this.breakpointSpanOfLastStatementInBlock(originalContainer); - - case TypeScript.SyntaxKind.SwitchStatement: - return this.breakpointSpanOfLastStatementOfLastCaseClause(container); - } - } - - return null; - } - - - private breakpointSpanOfComma(commaToken: TypeScript.ISyntaxToken): TextSpan { - var commaParent = commaToken.parent; - if (isSeparatedList(commaParent)) { - var grandParent = commaParent.parent; - if (grandParent) { - switch (grandParent.kind()) { - case TypeScript.SyntaxKind.VariableDeclaration: - case TypeScript.SyntaxKind.EnumDeclaration: - case TypeScript.SyntaxKind.ParameterList: - var index = Syntax.childIndex(commaParent, commaToken); - // Use the previous child - if (index > 0) { - var child = childAt(commaParent, index - 1); - return this.breakpointSpanOf(child); - } - - // If we cant set breakpoint on enum element, just dont set breakpoint - if (grandParent.kind() == TypeScript.SyntaxKind.EnumDeclaration) { - return null; - } - break; - } - } - } - - return this.breakpointSpanOfContainingNode(commaToken); - } - - private breakpointSpanOfCloseParen(closeParenToken: TypeScript.ISyntaxToken): TextSpan { - var closeParenParent = closeParenToken.parent; - if (closeParenParent) { - switch (closeParenParent.kind()) { - case TypeScript.SyntaxKind.ForStatement: - case TypeScript.SyntaxKind.ParameterList: - return this.breakpointSpanOf(previousToken(closeParenToken)); - } - } - - return this.breakpointSpanOfContainingNode(closeParenToken); - } - - private canHaveBreakpointInBlock(blockNode: TypeScript.ISyntaxNode) { - if (!blockNode || TypeScript.SyntaxUtilities.isAmbientDeclarationSyntax(blockNode)) { - return false; - } - - var blockSyntax = blockNode; - return blockSyntax.statements && blockSyntax.statements.length != 0; - } - - private breakpointSpanOfFirstStatementInBlock(blockNode: TypeScript.ISyntaxNode): TextSpan { - if (!blockNode) { - return null; - } - - var blockSyntax = blockNode; - var statementsNode = blockSyntax.statements; - if (!statementsNode || statementsNode.length == 0) { - return null; - } - - var firstStatement = childAt(statementsNode, 0); - if (firstStatement && firstStatement.kind() == TypeScript.SyntaxKind.Block) { - if (this.canHaveBreakpointInBlock(firstStatement)) { - return this.breakpointSpanOfFirstStatementInBlock(firstStatement); - } - return null; - } - else { - return this.breakpointSpanOf(firstStatement); - } - } - - private breakpointSpanOfLastStatementInBlock(blockNode: TypeScript.ISyntaxNode): TextSpan { - if (!blockNode) { - return null; - } - - var blockSyntax = blockNode; - var statementsNode = blockSyntax.statements; - if (!statementsNode || statementsNode.length == 0) { - return null; - } - - var lastStatement = childAt(statementsNode, statementsNode.length - 1); - if (lastStatement && lastStatement.kind() == TypeScript.SyntaxKind.Block) { - if (this.canHaveBreakpointInBlock(lastStatement)) { - return this.breakpointSpanOfLastStatementInBlock(lastStatement); - } - return null; - } - else { - return this.breakpointSpanOf(lastStatement); - } - } - - private breakpointSpanOfFirstChildOfSyntaxList(positionedList: TypeScript.ISyntaxNodeOrToken[]): TextSpan { - if (!positionedList) { - return null; - } - - // Find the first syntax element - var listSyntax = positionedList; - if (listSyntax.length == 0) { - return null; - } - - var firstStatement = childAt(positionedList, 0); - if (firstStatement && firstStatement.kind() == TypeScript.SyntaxKind.Block) { - if (this.canHaveBreakpointInBlock(firstStatement)) { - return this.breakpointSpanOfFirstStatementInBlock(firstStatement); - } - - return null; - } - else { - return this.breakpointSpanOf(firstStatement); - } - } - - private breakpointSpanOfLastChildOfSyntaxList(positionedList: TypeScript.ISyntaxNodeOrToken[]): TextSpan { - if (!positionedList) { - return null; - } - - // Find the first syntax element - var listSyntax = positionedList; - if (listSyntax.length == 0) { - return null; - } - var lastStatement = childAt(positionedList, 0); - if (lastStatement && lastStatement.kind() == TypeScript.SyntaxKind.Block) { - if (this.canHaveBreakpointInBlock(lastStatement)) { - return this.breakpointSpanOfLastStatementInBlock(lastStatement); - } - return null; - } - else { - return this.breakpointSpanOf(lastStatement); - } - } - - private breakpointSpanOfNode(positionedNode: ISyntaxNode): TextSpan { - var node = positionedNode; - switch (node.kind()) { - // Declarations with elements - case TypeScript.SyntaxKind.ModuleDeclaration: - case TypeScript.SyntaxKind.ClassDeclaration: - case TypeScript.SyntaxKind.FunctionDeclaration: - case TypeScript.SyntaxKind.ConstructorDeclaration: - case TypeScript.SyntaxKind.MemberFunctionDeclaration: - case TypeScript.SyntaxKind.GetAccessor: - case TypeScript.SyntaxKind.SetAccessor: - case TypeScript.SyntaxKind.FunctionExpression: - return this.breakpointSpanOfDeclarationWithElements(positionedNode); - - // Var, parameter and member variable declaration syntax - case TypeScript.SyntaxKind.VariableDeclarator: - return this.breakpointSpanOfVariableDeclarator(positionedNode); - - case TypeScript.SyntaxKind.VariableDeclaration: - return this.breakpointSpanOfVariableDeclaration(positionedNode); - - case TypeScript.SyntaxKind.VariableStatement: - return this.breakpointSpanOfVariableStatement(positionedNode); - - case TypeScript.SyntaxKind.Parameter: - return this.breakpointSpanOfParameter(positionedNode); - - case TypeScript.SyntaxKind.MemberVariableDeclaration: - return this.breakpointSpanOfMemberVariableDeclaration(positionedNode); - - case TypeScript.SyntaxKind.ImportDeclaration: - return this.breakpointSpanOfImportDeclaration(positionedNode); - - case TypeScript.SyntaxKind.EnumDeclaration: - return this.breakpointSpanOfEnumDeclaration(positionedNode); - - case TypeScript.SyntaxKind.EnumElement: - return this.breakpointSpanOfEnumElement(positionedNode); - - // Statements - case TypeScript.SyntaxKind.IfStatement: - return this.breakpointSpanOfIfStatement(positionedNode); - case TypeScript.SyntaxKind.ElseClause: - return this.breakpointSpanOfElseClause(positionedNode); - case TypeScript.SyntaxKind.ForInStatement: - return this.breakpointSpanOfForInStatement(positionedNode); - case TypeScript.SyntaxKind.ForStatement: - return this.breakpointSpanOfForStatement(positionedNode); - case TypeScript.SyntaxKind.WhileStatement: - return this.breakpointSpanOfWhileStatement(positionedNode); - case TypeScript.SyntaxKind.DoStatement: - return this.breakpointSpanOfDoStatement(positionedNode); - case TypeScript.SyntaxKind.SwitchStatement: - return this.breakpointSpanOfSwitchStatement(positionedNode); - case TypeScript.SyntaxKind.CaseSwitchClause: - return this.breakpointSpanOfCaseSwitchClause(positionedNode); - case TypeScript.SyntaxKind.DefaultSwitchClause: - return this.breakpointSpanOfDefaultSwitchClause(positionedNode); - case TypeScript.SyntaxKind.WithStatement: - return this.breakpointSpanOfWithStatement(positionedNode); - case TypeScript.SyntaxKind.TryStatement: - return this.breakpointSpanOfTryStatement(positionedNode); - case TypeScript.SyntaxKind.CatchClause: - return this.breakpointSpanOfCatchClause(positionedNode); - case TypeScript.SyntaxKind.FinallyClause: - return this.breakpointSpanOfFinallyClause(positionedNode); - - // Arrow expressions - case TypeScript.SyntaxKind.ParenthesizedArrowFunctionExpression: - return this.breakpointSpanOfParenthesizedArrowFunctionExpression(positionedNode); - - case TypeScript.SyntaxKind.SimpleArrowFunctionExpression: - return this.breakpointSpanOfSimpleArrowFunctionExpression(positionedNode); - - // Expressions or statements - default: - if (SyntaxUtilities.isStatement(node)) { - return this.breakpointSpanOfStatement(positionedNode); } else { - return this.breakpointOfExpression(positionedNode); + // Span only on this declaration + return textSpan(variableDeclaration); } - } - } - - private isExpressionOfArrowExpressions(expression: ISyntaxElement): boolean { - if (!expression) { - return false; - } - - var expressionParent = expression.parent; - if (expressionParent) { - if (expressionParent.kind() == TypeScript.SyntaxKind.ParenthesizedArrowFunctionExpression) { - var parenthesizedArrowExpression = expressionParent; - var expressionOfParenthesizedArrowExpression = parenthesizedArrowExpression.expression; - return expressionOfParenthesizedArrowExpression == expression; } - else if (expressionParent.kind() == TypeScript.SyntaxKind.SimpleArrowFunctionExpression) { - var simpleArrowExpression = expressionParent; - var expressionOfSimpleArrowExpression = simpleArrowExpression.expression; - return expressionOfSimpleArrowExpression == expression; - } - else if (expressionParent.kind() == TypeScript.SyntaxKind.CommaExpression) { - return this.isExpressionOfArrowExpressions(expressionParent); - } - } - return false; - } - - private isInitializerOfForStatement(expressionNode: TypeScript.ISyntaxNode): boolean { - if (!expressionNode) { - return false; - } - - var expressionParent = expressionNode.parent; - if (expressionParent && expressionParent.kind() == TypeScript.SyntaxKind.ForStatement) { - - var expression = expressionNode; - var forStatement = expressionParent; - var initializer = forStatement.initializer; - return initializer === expression; - } - else if (expressionParent && expressionParent.kind() == TypeScript.SyntaxKind.CommaExpression) { - return this.isInitializerOfForStatement(expressionParent); - } - - return false; - } - - private isConditionOfForStatement(expressionNode: TypeScript.ISyntaxNode): boolean { - if (!expressionNode) { - return false; - } - - var expressionParent = expressionNode.parent; - if (expressionParent && expressionParent.kind() == TypeScript.SyntaxKind.ForStatement) { - var expression = expressionNode; - var forStatement = expressionParent; - var condition = forStatement.condition; - return condition === expression; - } - else if (expressionParent && expressionParent.kind() == TypeScript.SyntaxKind.CommaExpression) { - return this.isConditionOfForStatement(expressionParent); - } - - return false; - } - - private isIncrememtorOfForStatement(expressionNode: TypeScript.ISyntaxNode): boolean { - if (!expressionNode) { - return false; - } - - var expressionParent = expressionNode.parent; - if (expressionParent && expressionParent.kind() == TypeScript.SyntaxKind.ForStatement) { - var expression = expressionNode; - var forStatement = expressionParent; - var incrementor = forStatement.incrementor; - return incrementor === expression; - } - else if (expressionParent && expressionParent.kind() == TypeScript.SyntaxKind.CommaExpression) { - return this.isIncrememtorOfForStatement(expressionParent); - } - - return false; - } - - private breakpointOfLeftOfCommaExpression(commaExpressionNode: TypeScript.ISyntaxNode): TextSpan { - var commaExpression = commaExpressionNode; - return this.breakpointSpanOf(commaExpression.left); - } - - private breakpointOfExpression(expressionNode: TypeScript.ISyntaxNode): TextSpan { - if (this.isInitializerOfForStatement(expressionNode) || - this.isConditionOfForStatement(expressionNode) || - this.isIncrememtorOfForStatement(expressionNode)) { - if (expressionNode.kind() == TypeScript.SyntaxKind.CommaExpression) { - return this.breakpointOfLeftOfCommaExpression(expressionNode); - } - return createBreakpointSpanInfo(expressionNode); - } - - if (this.isExpressionOfArrowExpressions(expressionNode)) { - if (expressionNode.kind() == TypeScript.SyntaxKind.CommaExpression) { - return this.breakpointOfLeftOfCommaExpression(expressionNode); - } - return createBreakpointSpanInfo(expressionNode); - } - - if (expressionNode.kind() == TypeScript.SyntaxKind.ExportAssignment) { - var exportAssignmentSyntax = expressionNode; - return createBreakpointSpanInfo(expressionNode, exportAssignmentSyntax.exportKeyword, exportAssignmentSyntax.equalsToken, exportAssignmentSyntax.identifier); - } - - return this.breakpointSpanOfContainingNode(expressionNode); - } - - private breakpointSpanOfStatement(statementNode: TypeScript.ISyntaxNode): TextSpan { - var statement = statementNode; - if (statement.kind() == TypeScript.SyntaxKind.EmptyStatement) { - return null; - } - - var containingNode = Syntax.containingNode(statementNode); - if (SyntaxUtilities.isStatement(containingNode)) { - // Check if not the declarations and the compound statements - var useNodeForBreakpoint = false; - switch (containingNode.kind()) { - // Declarations - case TypeScript.SyntaxKind.ModuleDeclaration: - case TypeScript.SyntaxKind.ClassDeclaration: - case TypeScript.SyntaxKind.FunctionDeclaration: - case TypeScript.SyntaxKind.ConstructorDeclaration: - case TypeScript.SyntaxKind.MemberFunctionDeclaration: - case TypeScript.SyntaxKind.GetAccessor: - case TypeScript.SyntaxKind.SetAccessor: - case TypeScript.SyntaxKind.Block: - - // Compound Statements - case TypeScript.SyntaxKind.IfStatement: - case TypeScript.SyntaxKind.ElseClause: - case TypeScript.SyntaxKind.ForInStatement: - case TypeScript.SyntaxKind.ForStatement: - case TypeScript.SyntaxKind.WhileStatement: - case TypeScript.SyntaxKind.DoStatement: - case TypeScript.SyntaxKind.SwitchStatement: - case TypeScript.SyntaxKind.CaseSwitchClause: - case TypeScript.SyntaxKind.DefaultSwitchClause: - case TypeScript.SyntaxKind.WithStatement: - case TypeScript.SyntaxKind.TryStatement: - case TypeScript.SyntaxKind.CatchClause: - case TypeScript.SyntaxKind.FinallyClause: - case TypeScript.SyntaxKind.Block: - useNodeForBreakpoint = true; - } - - if (!useNodeForBreakpoint) { - return this.breakpointSpanOfContainingNode(statementNode); + else if (declarations && declarations[0] !== variableDeclaration) { + // If we cant set breakpoint on this declaration, set it on previous one + var indexOfCurrentDeclaration = indexOf(declarations, variableDeclaration); + return spanInVariableDeclaration(declarations[indexOfCurrentDeclaration - 1]); } } - switch (statement.kind()) { - case TypeScript.SyntaxKind.ExpressionStatement: - var expressionSyntax = statement; - return createBreakpointSpanInfo(expressionSyntax.expression); - - case TypeScript.SyntaxKind.ReturnStatement: - var returnStatementSyntax = statement; - return createBreakpointSpanInfo(statementNode, returnStatementSyntax.returnKeyword, returnStatementSyntax.expression); - - case TypeScript.SyntaxKind.ThrowStatement: - var throwStatementSyntax = statement; - return createBreakpointSpanInfo(statementNode, throwStatementSyntax.throwKeyword, throwStatementSyntax.expression); - - case TypeScript.SyntaxKind.BreakStatement: - var breakStatementSyntax = statement; - return createBreakpointSpanInfo(statementNode, breakStatementSyntax.breakKeyword, breakStatementSyntax.identifier); - - case TypeScript.SyntaxKind.ContinueStatement: - var continueStatementSyntax = statement; - return createBreakpointSpanInfo(statementNode, continueStatementSyntax.continueKeyword, continueStatementSyntax.identifier); - - case TypeScript.SyntaxKind.DebuggerStatement: - var debuggerStatementSyntax = statement; - return createBreakpointSpanInfo(debuggerStatementSyntax.debuggerKeyword); - - case TypeScript.SyntaxKind.LabeledStatement: - var labeledStatementSyntax = statement; - return this.breakpointSpanOf(labeledStatementSyntax.statement); + function canHaveSpanInParameterDeclaration(parameter: ParameterDeclaration): boolean { + // Breakpoint is possible on parameter only if it has initializer, is a rest parameter, or has public or private modifier + return !!parameter.initializer || !!(parameter.flags & NodeFlags.Rest) || + !!(parameter.flags & NodeFlags.Public) || !!(parameter.flags & NodeFlags.Private); } - return null; - } - - private getSyntaxListOfDeclarationWithElements(positionedNode: TypeScript.ISyntaxNode) { - var node = positionedNode; - var elementsList: TypeScript.ISyntaxNodeOrToken[]; - var block: TypeScript.BlockSyntax; - - switch (node.kind()) { - case TypeScript.SyntaxKind.ModuleDeclaration: - elementsList = (node).moduleElements; - break; - - case TypeScript.SyntaxKind.ClassDeclaration: - elementsList = (node).classElements; - break; - - case TypeScript.SyntaxKind.FunctionDeclaration: - block = (node).block; - break; - - case TypeScript.SyntaxKind.ConstructorDeclaration: - block = (node).block; - break; - - case TypeScript.SyntaxKind.MemberFunctionDeclaration: - block = (node).block; - break; - - case TypeScript.SyntaxKind.GetAccessor: - block = (node).block; - break; - - case TypeScript.SyntaxKind.SetAccessor: - block = (node).block; - break; - - case TypeScript.SyntaxKind.FunctionExpression: - block = (node).block; - break; - - case TypeScript.SyntaxKind.ParenthesizedArrowFunctionExpression: - block = (node).block; - break; - - case TypeScript.SyntaxKind.SimpleArrowFunctionExpression: - block = (node).block; - break; - - default: - throw TypeScript.Errors.argument('positionNode', 'unknown node kind in getSyntaxListOfDeclarationWithElements'); - } - - var parentElement: TypeScript.ISyntaxElement = positionedNode; - if (block) { - parentElement = block; - elementsList = block.statements; - } - - return elementsList; - } - - private canHaveBreakpointInDeclaration(positionedNode: TypeScript.ISyntaxNode) { - return positionedNode && !TypeScript.SyntaxUtilities.isAmbientDeclarationSyntax(positionedNode); - } - - private breakpointSpanOfDeclarationWithElements(positionedNode: TypeScript.ISyntaxNode): TextSpan { - if (!this.canHaveBreakpointInDeclaration(positionedNode)) { - return null; - } - - // If inside another module the whole declaration is debuggable - var node = positionedNode; - var moduleSyntax = positionedNode; - if ((SyntaxUtilities.isModuleElement(node) && Syntax.containingNode(positionedNode).kind() != TypeScript.SyntaxKind.SourceUnit) || - SyntaxUtilities.isClassElement(node) || - (moduleSyntax.kind() == TypeScript.SyntaxKind.ModuleDeclaration && moduleSyntax.name - && moduleSyntax.name.kind() == TypeScript.SyntaxKind.QualifiedName)) { - return createBreakpointSpanInfo(positionedNode); - } - else { - // Try to get the breakpoint in first element declaration - return this.breakpointSpanOfFirstChildOfSyntaxList(this.getSyntaxListOfDeclarationWithElements(positionedNode)); - } - } - - private canHaveBreakpointInVariableDeclarator(varDeclaratorNode: TypeScript.ISyntaxNode) { - if (!varDeclaratorNode || TypeScript.SyntaxUtilities.isAmbientDeclarationSyntax(varDeclaratorNode)) { - return false; - } - - var varDeclaratorSyntax = varDeclaratorNode; - return !!varDeclaratorSyntax.equalsValueClause; - } - - private breakpointSpanOfVariableDeclarator(varDeclaratorNode: TypeScript.ISyntaxNode): TextSpan { - if (!this.canHaveBreakpointInVariableDeclarator(varDeclaratorNode)) { - return null; - } - - var container = Syntax.containingNode(varDeclaratorNode); - if (container && container.kind() == TypeScript.SyntaxKind.VariableDeclaration) { - var parentDeclaratorsList = varDeclaratorNode.parent; - // If this is the first declarator in the list use the declaration instead - if (parentDeclaratorsList && childAt(parentDeclaratorsList, 0) == varDeclaratorNode) { - return this.breakpointSpanOfVariableDeclaration(container); - } - - // Create breakpoint on this var declarator - if (this.canHaveBreakpointInVariableDeclarator(varDeclaratorNode)) { - return createBreakpointSpanInfo(varDeclaratorNode); + function spanInParameterDeclaration(parameter: ParameterDeclaration): TypeScript.TextSpan { + if (canHaveSpanInParameterDeclaration(parameter)) { + return textSpan(parameter); } else { - return null; - } - } - else if (container) { - // Member Variable syntax - return this.breakpointSpanOfMemberVariableDeclaration(container); - } - - return null; - } - - private canHaveBreakpointInVariableDeclaration(varDeclarationNode: TypeScript.ISyntaxNode) { - if (!varDeclarationNode || TypeScript.SyntaxUtilities.isAmbientDeclarationSyntax(varDeclarationNode)) { - return false; - } - - var varDeclarationSyntax = varDeclarationNode; - var containerChildren = varDeclarationSyntax.variableDeclarators; - if (!containerChildren || childCount(containerChildren) == 0) { - return false; - } - - var child = childAt(containerChildren, 0); - if (isNode(child)) { - return this.canHaveBreakpointInVariableDeclarator(child); - } - - return false; - } - - private breakpointSpanOfVariableDeclaration(varDeclarationNode: TypeScript.ISyntaxNode): TextSpan { - if (!this.canHaveBreakpointInDeclaration(varDeclarationNode)) { - return null; - } - - var container = Syntax.containingNode(varDeclarationNode); - var varDeclarationSyntax = varDeclarationNode; - var varDeclarators = varDeclarationSyntax.variableDeclarators; - - if (container && container.kind() == TypeScript.SyntaxKind.VariableStatement) { - return this.breakpointSpanOfVariableStatement(container); - } - - if (this.canHaveBreakpointInVariableDeclaration(varDeclarationNode)) { - return createBreakpointSpanInfoWithLimChar(varDeclarationNode, end(childAt(varDeclarators, 0))); - } - else { - return null; - } - } - - private canHaveBreakpointInVariableStatement(varStatementNode: TypeScript.ISyntaxNode) { - if (!varStatementNode || TypeScript.SyntaxUtilities.isAmbientDeclarationSyntax(varStatementNode)) { - return false; - } - - var variableStatement = varStatementNode; - return this.canHaveBreakpointInVariableDeclaration(variableStatement.variableDeclaration); - } - - private breakpointSpanOfVariableStatement(varStatementNode: TypeScript.ISyntaxNode): TextSpan { - if (!this.canHaveBreakpointInVariableStatement(varStatementNode)) { - return null; - } - - var variableStatement = varStatementNode; - var variableDeclaration = variableStatement.variableDeclaration; - var varDeclarationSyntax = variableDeclaration; - var varDeclarators = varDeclarationSyntax.variableDeclarators; - return createBreakpointSpanInfoWithLimChar(varStatementNode, end(childAt(varDeclarators, 0))); - } - - private breakpointSpanOfParameter(parameterNode: TypeScript.ISyntaxNode): TextSpan { - if (parameterNode.parent.kind() === SyntaxKind.SimpleArrowFunctionExpression) { - return this.breakpointSpanOfNode(parameterNode.parent); - } - - if (TypeScript.SyntaxUtilities.isAmbientDeclarationSyntax(parameterNode)) { - return null; - } - - var parameterSyntax = parameterNode; - if (parameterSyntax.dotDotDotToken || parameterSyntax.equalsValueClause || parameterSyntax.modifiers.length > 0) { - return createBreakpointSpanInfo(parameterNode); - } - else { - return null; - } - } - - private breakpointSpanOfMemberVariableDeclaration(memberVarDeclarationNode: TypeScript.ISyntaxNode): TextSpan { - if (TypeScript.SyntaxUtilities.isAmbientDeclarationSyntax(memberVarDeclarationNode)) { - return null; - } - - var memberVariableDeclaration = memberVarDeclarationNode; - if (this.canHaveBreakpointInVariableDeclarator(memberVariableDeclaration.variableDeclarator)) { - return createBreakpointSpanInfo(memberVarDeclarationNode, memberVariableDeclaration.modifiers, memberVariableDeclaration.variableDeclarator); - } - else { - return null; - } - } - - private breakpointSpanOfImportDeclaration(importDeclarationNode: TypeScript.ISyntaxNode): TextSpan { - if (TypeScript.SyntaxUtilities.isAmbientDeclarationSyntax(importDeclarationNode)) { - return null; - } - - var importSyntax = importDeclarationNode; - return createBreakpointSpanInfo(importDeclarationNode, importSyntax.modifiers, importSyntax.importKeyword, importSyntax.identifier, importSyntax.equalsToken, importSyntax.moduleReference); - } - - private breakpointSpanOfEnumDeclaration(enumDeclarationNode: TypeScript.ISyntaxNode): TextSpan { - if (!this.canHaveBreakpointInDeclaration(enumDeclarationNode)) { - return null; - } - - return createBreakpointSpanInfo(enumDeclarationNode); - } - - private breakpointSpanOfFirstEnumElement(enumDeclarationNode: TypeScript.ISyntaxNode): TextSpan { - var enumDeclarationSyntax = enumDeclarationNode; - var enumElements = enumDeclarationSyntax.enumElements; - if (enumElements && childCount(enumElements)) { - return this.breakpointSpanOf(childAt(enumElements, 0)); - } - - return null; - } - - private breakpointSpanOfEnumElement(enumElementNode: TypeScript.ISyntaxNode): TextSpan { - if (TypeScript.SyntaxUtilities.isAmbientDeclarationSyntax(enumElementNode)) { - return null; - } - - return createBreakpointSpanInfo(enumElementNode); - } - - private breakpointSpanOfIfStatement(ifStatementNode: TypeScript.ISyntaxNode): TextSpan { - var ifStatement = ifStatementNode; - return createBreakpointSpanInfo(ifStatementNode, ifStatement.ifKeyword, ifStatement.openParenToken, ifStatement.condition, ifStatement.closeParenToken); - } - - private breakpointSpanOfElseClause(elseClauseNode: TypeScript.ISyntaxNode): TextSpan { - var elseClause = elseClauseNode; - return this.breakpointSpanOf(elseClause.statement); - } - - private breakpointSpanOfForInStatement(forInStatementNode: TypeScript.ISyntaxNode): TextSpan { - var forInStatement = forInStatementNode; - return createBreakpointSpanInfo(forInStatementNode, forInStatement.forKeyword, forInStatement.openParenToken, forInStatement.variableDeclaration, - forInStatement.left, forInStatement.inKeyword, forInStatement.expression, forInStatement.closeParenToken); - } - - private breakpointSpanOfForStatement(forStatementNode: TypeScript.ISyntaxNode): TextSpan { - var forStatement = forStatementNode; - return this.breakpointSpanOf(forStatement.variableDeclaration - ? forStatement.variableDeclaration - : forStatement.initializer); - } - - private breakpointSpanOfWhileStatement(whileStatementNode: TypeScript.ISyntaxNode): TextSpan { - var whileStatement = whileStatementNode; - return createBreakpointSpanInfo(whileStatementNode, whileStatement.whileKeyword, whileStatement.openParenToken, whileStatement.condition, whileStatement.closeParenToken); - } - - private breakpointSpanOfDoStatement(doStatementNode: TypeScript.ISyntaxNode): TextSpan { - var doStatement = doStatementNode; - return createBreakpointSpanInfo(doStatementNode, doStatement.whileKeyword, doStatement.openParenToken, doStatement.condition, doStatement.closeParenToken); - } - - private breakpointSpanOfSwitchStatement(switchStatementNode: TypeScript.ISyntaxNode): TextSpan { - var switchStatement = switchStatementNode; - return createBreakpointSpanInfo(switchStatementNode, switchStatement.switchKeyword, switchStatement.openParenToken, switchStatement.expression, switchStatement.closeParenToken); - } - - private breakpointSpanOfFirstStatementOfFirstCaseClause(switchStatementNode: TypeScript.ISyntaxNode): TextSpan { - var switchStatement = switchStatementNode; - if (switchStatement.switchClauses && switchStatement.switchClauses.length == 0) { - return null; - } - - var switchClauses = switchStatement.switchClauses; - if (switchClauses.length == 0) { - return null; - } - - var firstCaseClause = switchClauses[0]; - var statements = firstCaseClause.statements; - - return this.breakpointSpanOfFirstChildOfSyntaxList(statements); - } - - private breakpointSpanOfLastStatementOfLastCaseClause(switchStatementNode: TypeScript.ISyntaxNode): TextSpan { - var switchStatement = switchStatementNode; - if (switchStatement.switchClauses && switchStatement.switchClauses.length == 0) { - return null; - } - - var switchClauses = switchStatement.switchClauses; - if (switchClauses.length == 0) { - return null; - } - - var lastClauseNode = switchClauses[switchClauses.length - 1]; - var statements = lastClauseNode.statements; - - return this.breakpointSpanOfLastChildOfSyntaxList(statements); - } - - private breakpointSpanOfCaseSwitchClause(caseClauseNode: TypeScript.ISyntaxNode): TextSpan { - var caseSwitchClause = caseClauseNode; - return this.breakpointSpanOfFirstChildOfSyntaxList(caseSwitchClause.statements); - } - - private breakpointSpanOfDefaultSwitchClause(defaultSwithClauseNode: TypeScript.ISyntaxNode): TextSpan { - var defaultSwitchClause = defaultSwithClauseNode; - return this.breakpointSpanOfFirstChildOfSyntaxList(defaultSwitchClause.statements); - } - - private breakpointSpanOfWithStatement(withStatementNode: TypeScript.ISyntaxNode): TextSpan { - var withStatement = withStatementNode; - return this.breakpointSpanOf(withStatement.statement); - } - - private breakpointSpanOfTryStatement(tryStatementNode: TypeScript.ISyntaxNode): TextSpan { - var tryStatement = tryStatementNode; - return this.breakpointSpanOfFirstStatementInBlock(tryStatement.block); - } - - private breakpointSpanOfCatchClause(catchClauseNode: TypeScript.ISyntaxNode): TextSpan { - var catchClause = catchClauseNode; - return createBreakpointSpanInfo(catchClauseNode, catchClause.catchKeyword, catchClause.openParenToken, catchClause.identifier, catchClause.typeAnnotation, catchClause.closeParenToken); - } - - private breakpointSpanOfFinallyClause(finallyClauseNode: TypeScript.ISyntaxNode): TextSpan { - var finallyClause = finallyClauseNode; - return this.breakpointSpanOfFirstStatementInBlock(finallyClause.block); - } - - private breakpointSpanOfParenthesizedArrowFunctionExpression(arrowFunctionExpression: ParenthesizedArrowFunctionExpressionSyntax): TextSpan { - if (arrowFunctionExpression.block) { - return this.breakpointSpanOfFirstStatementInBlock(arrowFunctionExpression.block); - } - else { - return this.breakpointSpanOf(arrowFunctionExpression.expression); - } - } - - private breakpointSpanOfSimpleArrowFunctionExpression(arrowFunctionExpression: SimpleArrowFunctionExpressionSyntax): TextSpan { - if (arrowFunctionExpression.block) { - return this.breakpointSpanOfFirstStatementInBlock(arrowFunctionExpression.block); - } - else { - return this.breakpointSpanOf(arrowFunctionExpression.expression); - } - } - - private breakpointSpanOfContainingNode(positionedElement: ISyntaxElement): TextSpan { - var current = positionedElement.parent; - while (!isNode(current)) { - current = current.parent; - } - - return this.breakpointSpanOf(current); - } - - private breakpointSpanIfStartsOnSameLine(positionedElement: TypeScript.ISyntaxElement): TextSpan { - if (positionedElement && this.posLine == this.lineMap.getLineNumberFromPosition(start(positionedElement))) { - return this.breakpointSpanOf(positionedElement); - } - - return null; - } - - public breakpointSpanOf(positionedElement: TypeScript.ISyntaxElement): TextSpan { - if (!positionedElement) { - return null; - } - - for (var containingNode = Syntax.containingNode(positionedElement); containingNode != null; containingNode = Syntax.containingNode(containingNode)) { - if (containingNode.kind() == TypeScript.SyntaxKind.TypeAnnotation) { - return this.breakpointSpanIfStartsOnSameLine(containingNode); + var functionDeclaration = parameter.parent; + var indexOfParameter = indexOf(functionDeclaration.parameters, parameter); + if (indexOfParameter) { + // Not a first parameter, go to previous parameter + return spanInParameterDeclaration(functionDeclaration.parameters[indexOfParameter - 1]); + } + else { + // Set breakpoint in the function declaration body + return spanInNode(functionDeclaration.body); + } } } - var element = positionedElement; - - // Syntax node - if (isNode(element)) { - return this.breakpointSpanOfNode(positionedElement); + function canFunctionHaveSpanInWholeDeclaration(functionDeclaration: FunctionDeclaration) { + return !!(functionDeclaration.flags & NodeFlags.Export) || + (functionDeclaration.parent.kind === SyntaxKind.ClassDeclaration && functionDeclaration.kind !== SyntaxKind.Constructor); } - // Token - if (isToken(element)) { - return this.breakpointSpanOfToken(positionedElement); + function spanInFunctionDeclaration(functionDeclaration: FunctionDeclaration): TypeScript.TextSpan { + // No breakpoints in the function signature + if (!functionDeclaration.body) { + return undefined; + } + + if (canFunctionHaveSpanInWholeDeclaration(functionDeclaration)) { + // Set the span on whole function declaration + return textSpan(functionDeclaration); + } + + // Set span in function body + return spanInNode(functionDeclaration.body); } - // List - // Separated List - return this.breakpointSpanOfContainingNode(positionedElement); + function spanInFunctionBlock(block: Block): TypeScript.TextSpan { + var nodeForSpanInBlock = block.statements.length ? block.statements[0] : block.getLastToken(); + if (canFunctionHaveSpanInWholeDeclaration(block.parent)) { + return spanInNodeIfStartsOnSameLine(block.parent, nodeForSpanInBlock); + } + + return spanInNode(nodeForSpanInBlock); + } + + function spanInBlock(block: Block): TypeScript.TextSpan { + switch (block.parent.kind) { + case SyntaxKind.ModuleDeclaration: + if (!isInstantiated(block.parent)) { + return undefined; + } + + // Set on parent if on same line otherwise on first statement + case SyntaxKind.WhileStatement: + case SyntaxKind.IfStatement: + case SyntaxKind.ForInStatement: + return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + + // Set span on previous token if it starts on same line otherwise on the first statement of the block + case SyntaxKind.ForStatement: + return spanInNodeIfStartsOnSameLine(findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); + } + + // Default action is to set on first statement + return spanInNode(block.statements[0]); + } + + function spanInForStatement(forStatement: ForStatement): TypeScript.TextSpan { + if (forStatement.declarations) { + return spanInNode(forStatement.declarations[0]); + } + if (forStatement.initializer) { + return spanInNode(forStatement.initializer); + } + if (forStatement.condition) { + return textSpan(forStatement.condition); + } + if (forStatement.iterator) { + return textSpan(forStatement.iterator); + } + } + + // Tokens: + function spanInOpenBraceToken(node: Node): TypeScript.TextSpan { + switch (node.parent.kind) { + case SyntaxKind.EnumDeclaration: + var enumDeclaration = node.parent; + return spanInNodeIfStartsOnSameLine(findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); + + case SyntaxKind.ClassDeclaration: + var classDeclaration = node.parent; + return spanInNodeIfStartsOnSameLine(findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); + + case SyntaxKind.SwitchStatement: + return spanInNodeIfStartsOnSameLine(node.parent, (node.parent).clauses[0]); + } + + // Default to parent node + return spanInNode(node.parent); + } + + function spanInCloseBraceToken(node: Node): TypeScript.TextSpan { + switch (node.parent.kind) { + case SyntaxKind.ModuleBlock: + // If this is not instantiated module block no bp span + if (!isInstantiated(node.parent.parent)) { + return undefined; + } + + case SyntaxKind.FunctionBlock: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.ClassDeclaration: + // Span on close brace token + return textSpan(node); + + case SyntaxKind.Block: + case SyntaxKind.TryBlock: + case SyntaxKind.CatchBlock: + case SyntaxKind.FinallyBlock: + return spanInNode((node.parent).statements[(node.parent).statements.length - 1]);; + + case SyntaxKind.SwitchStatement: + // breakpoint in last statement of the last clause + var switchStatement = node.parent; + var lastClause = switchStatement.clauses[switchStatement.clauses.length - 1]; + if (lastClause) { + return spanInNode(lastClause.statements[lastClause.statements.length - 1]); + } + return undefined; + + // Default to parent node + default: + return spanInNode(node.parent); + } + } + + function spanInOpenParenToken(node: Node): TypeScript.TextSpan { + if (node.parent.kind === SyntaxKind.DoStatement) { + // Go to while keyword and do action instead + return spanInPreviousNode(node); + } + + // Default to parent node + return spanInNode(node.parent); + } + + function spanInCloseParenToken(node: Node): TypeScript.TextSpan { + // Is this close paren token of parameter list, set span in previous token + switch (node.parent.kind) { + case SyntaxKind.FunctionExpression: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.ArrowFunction: + case SyntaxKind.Method: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.Constructor: + case SyntaxKind.WhileStatement: + case SyntaxKind.DoStatement: + case SyntaxKind.ForStatement: + return spanInPreviousNode(node); + + // Default to parent node + default: + return spanInNode(node.parent); + } + + // Default to parent node + return spanInNode(node.parent); + } + + function spanInColonToken(node: Node): TypeScript.TextSpan { + // Is this : specifying return annotation of the function declaration + if (isAnyFunction(node.parent) || node.parent.kind === SyntaxKind.PropertyAssignment) { + return spanInPreviousNode(node); + } + + return spanInNode(node.parent); + } + + function spanInGreaterThanOrLessThanToken(node: Node): TypeScript.TextSpan { + if (node.parent.kind === SyntaxKind.TypeAssertion) { + return spanInNode((node.parent).operand); + } + + return spanInNode(node.parent); + } + + function spanInWhileKeyword(node: Node): TypeScript.TextSpan { + if (node.parent.kind === SyntaxKind.DoStatement) { + // Set span on while expression + return textSpan(node, findNextToken((node.parent).expression, node.parent)); + } + + // Default to parent node + return spanInNode(node.parent); + } } - } - - export function getBreakpointLocation(syntaxTree: TypeScript.SyntaxTree, askedPos: number): TextSpan { - // Cannot set breakpoint in dts file - if (TypeScript.isDTSFile(syntaxTree.fileName())) { - return null; - } - - var sourceUnit = syntaxTree.sourceUnit(); - var positionedToken = TypeScript.findToken(sourceUnit, askedPos); - - var lineMap = syntaxTree.lineMap(); - var posLine = lineMap.getLineNumberFromPosition(askedPos); - var tokenStartLine = lineMap.getLineNumberFromPosition(start(positionedToken)); - if (posLine < tokenStartLine) { - return null; - } - - var breakpointResolver = new BreakpointResolver(posLine, lineMap); - return breakpointResolver.breakpointSpanOf(positionedToken); - } + } } \ No newline at end of file diff --git a/src/services/services.ts b/src/services/services.ts index 1079381f749..d853d06d68e 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1952,18 +1952,32 @@ module ts { return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } + function isRightSideOfQualifiedName(node: Node) { + return node.parent.kind === SyntaxKind.QualifiedName && (node.parent).right === node; + } + + function isRightSideOfPropertyAccess(node: Node) { + return node.parent.kind === SyntaxKind.PropertyAccess && (node.parent).right === node; + } + function isCallExpressionTarget(node: Node): boolean { - if (node.parent.kind === SyntaxKind.PropertyAccess && (node.parent).right === node) + if (isRightSideOfPropertyAccess(node)) { node = node.parent; + } return node.parent.kind === SyntaxKind.CallExpression && (node.parent).func === node; } function isNewExpressionTarget(node: Node): boolean { - if (node.parent.kind === SyntaxKind.PropertyAccess && (node.parent).right === node) + if (isRightSideOfPropertyAccess(node)) { node = node.parent; + } return node.parent.kind === SyntaxKind.NewExpression && (node.parent).func === node; } + function isNameOfModuleDeclaration(node: Node) { + return node.parent.kind === SyntaxKind.ModuleDeclaration && (node.parent).name === node; + } + function isNameOfFunctionDeclaration(node: Node): boolean { return node.kind === SyntaxKind.Identifier && isAnyFunction(node.parent) && (node.parent).name === node; @@ -1996,7 +2010,7 @@ module ts { function isNameOfExternalModuleImportOrDeclaration(node: Node): boolean { return node.kind === SyntaxKind.StringLiteral && - ((node.parent.kind === SyntaxKind.ModuleDeclaration && (node.parent).name === node) || + (isNameOfModuleDeclaration(node) || (node.parent.kind === SyntaxKind.ImportDeclaration && (node.parent).externalModuleName === node)); } @@ -4535,8 +4549,9 @@ module ts { } function isTypeReference(node: Node): boolean { - if (node.parent.kind === SyntaxKind.QualifiedName && (node.parent).right === node) + if (isRightSideOfQualifiedName(node)) { node = node.parent; + } return node.parent.kind === SyntaxKind.TypeReference; } @@ -4686,67 +4701,64 @@ module ts { } function getNameOrDottedNameSpan(filename: string, startPos: number, endPos: number): TypeScript.TextSpan { - function getTypeInfoEligiblePath(filename: string, position: number, isConstructorValidPosition: boolean) { - var sourceUnit = syntaxTreeCache.getCurrentFileSyntaxTree(filename).sourceUnit(); + filename = ts.normalizeSlashes(filename); + // Get node at the location + var node = getTouchingPropertyName(getCurrentSourceFile(filename), startPos); - var ast = TypeScript.ASTHelpers.getAstAtPosition(sourceUnit, position, /*useTrailingTriviaAsLimChar*/ false, /*forceInclusive*/ true); - if (ast === null) { - return null; - } - - if (ast.kind() === TypeScript.SyntaxKind.ParameterList && ast.parent.kind() === TypeScript.SyntaxKind.CallSignature && ast.parent.parent.kind() === TypeScript.SyntaxKind.ConstructorDeclaration) { - ast = ast.parent.parent; - } - - switch (ast.kind()) { - default: - return null; - case TypeScript.SyntaxKind.ConstructorDeclaration: - var constructorAST = ast; - if (!isConstructorValidPosition || !(position >= TypeScript.start(constructorAST) && position <= TypeScript.start(constructorAST) + "constructor".length)) { - return null; - } - else { - return ast; - } - case TypeScript.SyntaxKind.FunctionDeclaration: - return null; - case TypeScript.SyntaxKind.MemberAccessExpression: - case TypeScript.SyntaxKind.QualifiedName: - case TypeScript.SyntaxKind.SuperKeyword: - case TypeScript.SyntaxKind.StringLiteral: - case TypeScript.SyntaxKind.ThisKeyword: - case TypeScript.SyntaxKind.IdentifierName: - return ast; - } + if (!node) { + return; } - filename = TypeScript.switchToForwardSlashes(filename); + switch (node.kind) { + case SyntaxKind.PropertyAccess: + case SyntaxKind.QualifiedName: + case SyntaxKind.StringLiteral: + case SyntaxKind.FalseKeyword: + case SyntaxKind.TrueKeyword: + case SyntaxKind.NullKeyword: + case SyntaxKind.SuperKeyword: + case SyntaxKind.ThisKeyword: + case SyntaxKind.Identifier: + break; - var node = getTypeInfoEligiblePath(filename, startPos, false); - if (!node) return null; + // Cant create the text span + default: + return; + } - while (node) { - if (TypeScript.ASTHelpers.isNameOfMemberAccessExpression(node) || - TypeScript.ASTHelpers.isRightSideOfQualifiedName(node)) { - node = node.parent; + var nodeForStartPos = node; + while (true) { + if (isRightSideOfPropertyAccess(nodeForStartPos) || isRightSideOfQualifiedName(nodeForStartPos)) { + // If on the span is in right side of the the property or qualified name, return the span from the qualified name pos to end of this node + nodeForStartPos = nodeForStartPos.parent; + } + else if (isNameOfModuleDeclaration(nodeForStartPos)) { + // If this is name of a module declarations, check if this is right side of dotted module name + // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of + // Then this name is name from dotted module + if (nodeForStartPos.parent.parent.kind === SyntaxKind.ModuleDeclaration && + (nodeForStartPos.parent.parent).body === nodeForStartPos.parent) { + // Use parent module declarations name for start pos + nodeForStartPos = (nodeForStartPos.parent.parent).name; + } + else { + // We have to use this name for start pos + break; + } } else { + // Is not a member expression so we have found the node for start pos break; } } - return TypeScript.TextSpan.fromBounds( - TypeScript.start(node), - TypeScript.end(node)); + return TypeScript.TextSpan.fromBounds(nodeForStartPos.getStart(), node.getEnd()); } function getBreakpointStatementAtPosition(filename: string, position: number) { // doesn't use compiler - no need to synchronize with host - filename = TypeScript.switchToForwardSlashes(filename); - - var syntaxtree = getSyntaxTree(filename); - return TypeScript.Services.Breakpoints.getBreakpointLocation(syntaxtree, position); + filename = ts.normalizeSlashes(filename); + return BreakpointResolver.spanInSourceFileAtLocation(getCurrentSourceFile(filename), position); } function getNavigationBarItems(filename: string): NavigationBarItem[] { diff --git a/tests/baselines/reference/bpSpan_arrayLiteralExpressions.baseline b/tests/baselines/reference/bpSpan_arrayLiteralExpressions.baseline new file mode 100644 index 00000000000..d8bfbc84aa0 --- /dev/null +++ b/tests/baselines/reference/bpSpan_arrayLiteralExpressions.baseline @@ -0,0 +1,198 @@ + +1 >var a = [10, 20, 30]; + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 21) SpanInfo: {"start":0,"length":20} + >var a = [10, 20, 30] + >:=> (line 1, col 0) to (line 1, col 20) +-------------------------------- +2 >function foo(a: number) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (22 to 47) SpanInfo: {"start":52,"length":8} + >return a + >:=> (line 3, col 4) to (line 3, col 12) +-------------------------------- +3 > return a; + + ~~~~~~~~~~~~~~ => Pos: (48 to 61) SpanInfo: {"start":52,"length":8} + >return a + >:=> (line 3, col 4) to (line 3, col 12) +-------------------------------- +4 >} + + ~~ => Pos: (62 to 63) SpanInfo: {"start":62,"length":1} + >} + >:=> (line 4, col 0) to (line 4, col 1) +-------------------------------- +5 >a = [foo(30), (function () { + + ~~~~~ => Pos: (64 to 68) SpanInfo: {"start":64,"length":49} + >a = [foo(30), (function () { + > return 30; + >})()] + >:=> (line 5, col 0) to (line 7, col 5) +5 >a = [foo(30), (function () { + + ~~~~~~~~ => Pos: (69 to 76) SpanInfo: {"start":69,"length":7} + >foo(30) + >:=> (line 5, col 5) to (line 5, col 12) +5 >a = [foo(30), (function () { + + ~~ => Pos: (77 to 78) SpanInfo: {"start":78,"length":34} + >(function () { + > return 30; + >})() + >:=> (line 5, col 14) to (line 7, col 4) +5 >a = [foo(30), (function () { + + ~~~~~~~~~~~~~~ => Pos: (79 to 92) SpanInfo: {"start":97,"length":9} + >return 30 + >:=> (line 6, col 4) to (line 6, col 13) +-------------------------------- +6 > return 30; + + ~~~~~~~~~~~~~~~ => Pos: (93 to 107) SpanInfo: {"start":97,"length":9} + >return 30 + >:=> (line 6, col 4) to (line 6, col 13) +-------------------------------- +7 >})()]; + + ~ => Pos: (108 to 108) SpanInfo: {"start":108,"length":1} + >} + >:=> (line 7, col 0) to (line 7, col 1) +7 >})()]; + + ~~~ => Pos: (109 to 111) SpanInfo: {"start":78,"length":34} + >(function () { + > return 30; + >})() + >:=> (line 5, col 14) to (line 7, col 4) +7 >})()]; + + ~~~ => Pos: (112 to 114) SpanInfo: {"start":64,"length":49} + >a = [foo(30), (function () { + > return 30; + >})()] + >:=> (line 5, col 0) to (line 7, col 5) +-------------------------------- +8 >function bar() { + + ~~~~~~~~~~~~~~~~~ => Pos: (115 to 131) SpanInfo: {"start":136,"length":8} + >return a + >:=> (line 9, col 4) to (line 9, col 12) +-------------------------------- +9 > return a; + + ~~~~~~~~~~~~~~ => Pos: (132 to 145) SpanInfo: {"start":136,"length":8} + >return a + >:=> (line 9, col 4) to (line 9, col 12) +-------------------------------- +10 >} + + ~~ => Pos: (146 to 147) SpanInfo: {"start":146,"length":1} + >} + >:=> (line 10, col 0) to (line 10, col 1) +-------------------------------- +11 >var x = bar()[0]; + + ~~~~~~~ => Pos: (148 to 154) SpanInfo: {"start":148,"length":16} + >var x = bar()[0] + >:=> (line 11, col 0) to (line 11, col 16) +11 >var x = bar()[0]; + + ~~~~~~ => Pos: (155 to 160) SpanInfo: {"start":156,"length":5} + >bar() + >:=> (line 11, col 8) to (line 11, col 13) +11 >var x = bar()[0]; + + ~~~~~ => Pos: (161 to 165) SpanInfo: {"start":148,"length":16} + >var x = bar()[0] + >:=> (line 11, col 0) to (line 11, col 16) +-------------------------------- +12 >x = (function () { + + ~~~ => Pos: (166 to 168) SpanInfo: {"start":166,"length":40} + >x = (function () { + > return a; + >})()[x] + >:=> (line 12, col 0) to (line 14, col 7) +12 >x = (function () { + + ~~ => Pos: (169 to 170) SpanInfo: {"start":170,"length":33} + >(function () { + > return a; + >})() + >:=> (line 12, col 4) to (line 14, col 4) +12 >x = (function () { + + ~~~~~~~~~~~~~~ => Pos: (171 to 184) SpanInfo: {"start":189,"length":8} + >return a + >:=> (line 13, col 4) to (line 13, col 12) +-------------------------------- +13 > return a; + + ~~~~~~~~~~~~~~ => Pos: (185 to 198) SpanInfo: {"start":189,"length":8} + >return a + >:=> (line 13, col 4) to (line 13, col 12) +-------------------------------- +14 >})()[x]; + + ~ => Pos: (199 to 199) SpanInfo: {"start":199,"length":1} + >} + >:=> (line 14, col 0) to (line 14, col 1) +14 >})()[x]; + + ~~~ => Pos: (200 to 202) SpanInfo: {"start":170,"length":33} + >(function () { + > return a; + >})() + >:=> (line 12, col 4) to (line 14, col 4) +14 >})()[x]; + + ~~~~~ => Pos: (203 to 207) SpanInfo: {"start":166,"length":40} + >x = (function () { + > return a; + >})()[x] + >:=> (line 12, col 0) to (line 14, col 7) +-------------------------------- +15 >a[(function () { + + ~~ => Pos: (208 to 209) SpanInfo: {"start":208,"length":36} + >a[(function () { + > return x; + >})()] + >:=> (line 15, col 0) to (line 17, col 5) +15 >a[(function () { + + ~ => Pos: (210 to 210) SpanInfo: {"start":210,"length":33} + >(function () { + > return x; + >})() + >:=> (line 15, col 2) to (line 17, col 4) +15 >a[(function () { + + ~~~~~~~~~~~~~~ => Pos: (211 to 224) SpanInfo: {"start":229,"length":8} + >return x + >:=> (line 16, col 4) to (line 16, col 12) +-------------------------------- +16 > return x; + + ~~~~~~~~~~~~~~ => Pos: (225 to 238) SpanInfo: {"start":229,"length":8} + >return x + >:=> (line 16, col 4) to (line 16, col 12) +-------------------------------- +17 >})()]; + ~ => Pos: (239 to 239) SpanInfo: {"start":239,"length":1} + >} + >:=> (line 17, col 0) to (line 17, col 1) +17 >})()]; + ~~~ => Pos: (240 to 242) SpanInfo: {"start":210,"length":33} + >(function () { + > return x; + >})() + >:=> (line 15, col 2) to (line 17, col 4) +17 >})()]; + ~~ => Pos: (243 to 244) SpanInfo: {"start":208,"length":36} + >a[(function () { + > return x; + >})()] + >:=> (line 15, col 0) to (line 17, col 5) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_binaryExpressions.baseline b/tests/baselines/reference/bpSpan_binaryExpressions.baseline new file mode 100644 index 00000000000..370fec39a25 --- /dev/null +++ b/tests/baselines/reference/bpSpan_binaryExpressions.baseline @@ -0,0 +1,119 @@ + +1 >var x = 10; + + ~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":10} + >var x = 10 + >:=> (line 1, col 0) to (line 1, col 10) +-------------------------------- +2 >var y = 20; + + ~~~~~~~~~~~~ => Pos: (12 to 23) SpanInfo: {"start":12,"length":10} + >var y = 20 + >:=> (line 2, col 0) to (line 2, col 10) +-------------------------------- +3 >x += 30; + + ~~~~~~~~~ => Pos: (24 to 32) SpanInfo: {"start":24,"length":7} + >x += 30 + >:=> (line 3, col 0) to (line 3, col 7) +-------------------------------- +4 >x *= 0; + + ~~~~~~~~ => Pos: (33 to 40) SpanInfo: {"start":33,"length":6} + >x *= 0 + >:=> (line 4, col 0) to (line 4, col 6) +-------------------------------- +5 >x = x + 1; + + ~~~~~~~~~~~ => Pos: (41 to 51) SpanInfo: {"start":41,"length":9} + >x = x + 1 + >:=> (line 5, col 0) to (line 5, col 9) +-------------------------------- +6 >x = (function foo() { + + ~~~ => Pos: (52 to 54) SpanInfo: {"start":52,"length":44} + >x = (function foo() { + > return y; + >})() + y + >:=> (line 6, col 0) to (line 8, col 8) +6 >x = (function foo() { + + ~~ => Pos: (55 to 56) SpanInfo: {"start":56,"length":36} + >(function foo() { + > return y; + >})() + >:=> (line 6, col 4) to (line 8, col 4) +6 >x = (function foo() { + + ~~~~~~~~~~~~~~~~~ => Pos: (57 to 73) SpanInfo: {"start":78,"length":8} + >return y + >:=> (line 7, col 4) to (line 7, col 12) +-------------------------------- +7 > return y; + + ~~~~~~~~~~~~~~ => Pos: (74 to 87) SpanInfo: {"start":78,"length":8} + >return y + >:=> (line 7, col 4) to (line 7, col 12) +-------------------------------- +8 >})() + y; + + ~ => Pos: (88 to 88) SpanInfo: {"start":88,"length":1} + >} + >:=> (line 8, col 0) to (line 8, col 1) +8 >})() + y; + + ~~~ => Pos: (89 to 91) SpanInfo: {"start":56,"length":36} + >(function foo() { + > return y; + >})() + >:=> (line 6, col 4) to (line 8, col 4) +8 >})() + y; + + ~~~~~~ => Pos: (92 to 97) SpanInfo: {"start":52,"length":44} + >x = (function foo() { + > return y; + >})() + y + >:=> (line 6, col 0) to (line 8, col 8) +-------------------------------- +9 >x = y + 30 + (function foo() { + + ~~~~~~~~~~~~ => Pos: (98 to 109) SpanInfo: {"start":98,"length":54} + >x = y + 30 + (function foo() { + > return y; + >})() * 40 + >:=> (line 9, col 0) to (line 11, col 9) +9 >x = y + 30 + (function foo() { + + ~~ => Pos: (110 to 111) SpanInfo: {"start":111,"length":36} + >(function foo() { + > return y; + >})() + >:=> (line 9, col 13) to (line 11, col 4) +9 >x = y + 30 + (function foo() { + + ~~~~~~~~~~~~~~~~~ => Pos: (112 to 128) SpanInfo: {"start":133,"length":8} + >return y + >:=> (line 10, col 4) to (line 10, col 12) +-------------------------------- +10 > return y; + + ~~~~~~~~~~~~~~ => Pos: (129 to 142) SpanInfo: {"start":133,"length":8} + >return y + >:=> (line 10, col 4) to (line 10, col 12) +-------------------------------- +11 >})() * 40; + ~ => Pos: (143 to 143) SpanInfo: {"start":143,"length":1} + >} + >:=> (line 11, col 0) to (line 11, col 1) +11 >})() * 40; + ~~~ => Pos: (144 to 146) SpanInfo: {"start":111,"length":36} + >(function foo() { + > return y; + >})() + >:=> (line 9, col 13) to (line 11, col 4) +11 >})() * 40; + ~~~~~~ => Pos: (147 to 152) SpanInfo: {"start":98,"length":54} + >x = y + 30 + (function foo() { + > return y; + >})() * 40 + >:=> (line 9, col 0) to (line 11, col 9) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_breakOrContinue.baseline b/tests/baselines/reference/bpSpan_breakOrContinue.baseline new file mode 100644 index 00000000000..617589b9047 --- /dev/null +++ b/tests/baselines/reference/bpSpan_breakOrContinue.baseline @@ -0,0 +1,71 @@ + +1 >while (true) { + + ~~~~~~~~~~~~~~~ => Pos: (0 to 14) SpanInfo: {"start":0,"length":12} + >while (true) + >:=> (line 1, col 0) to (line 1, col 12) +-------------------------------- +2 > break; + + ~~~~~~~~~~~ => Pos: (15 to 25) SpanInfo: {"start":19,"length":5} + >break + >:=> (line 2, col 4) to (line 2, col 9) +-------------------------------- +3 >} + + ~~ => Pos: (26 to 27) SpanInfo: {"start":19,"length":5} + >break + >:=> (line 2, col 4) to (line 2, col 9) +-------------------------------- +4 >y: while (true) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (28 to 45) SpanInfo: {"start":31,"length":12} + >while (true) + >:=> (line 4, col 3) to (line 4, col 15) +-------------------------------- +5 > break y; + + ~~~~~~~~~~~~~ => Pos: (46 to 58) SpanInfo: {"start":50,"length":7} + >break y + >:=> (line 5, col 4) to (line 5, col 11) +-------------------------------- +6 >} + + ~~ => Pos: (59 to 60) SpanInfo: {"start":50,"length":7} + >break y + >:=> (line 5, col 4) to (line 5, col 11) +-------------------------------- +7 >while (true) { + + ~~~~~~~~~~~~~~~ => Pos: (61 to 75) SpanInfo: {"start":61,"length":12} + >while (true) + >:=> (line 7, col 0) to (line 7, col 12) +-------------------------------- +8 > continue; + + ~~~~~~~~~~~~~~ => Pos: (76 to 89) SpanInfo: {"start":80,"length":8} + >continue + >:=> (line 8, col 4) to (line 8, col 12) +-------------------------------- +9 >} + + ~~ => Pos: (90 to 91) SpanInfo: {"start":80,"length":8} + >continue + >:=> (line 8, col 4) to (line 8, col 12) +-------------------------------- +10 >z: while (true) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (92 to 109) SpanInfo: {"start":95,"length":12} + >while (true) + >:=> (line 10, col 3) to (line 10, col 15) +-------------------------------- +11 > continue z; + + ~~~~~~~~~~~~~~~~ => Pos: (110 to 125) SpanInfo: {"start":114,"length":10} + >continue z + >:=> (line 11, col 4) to (line 11, col 14) +-------------------------------- +12 >} + ~ => Pos: (126 to 126) SpanInfo: {"start":114,"length":10} + >continue z + >:=> (line 11, col 4) to (line 11, col 14) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_class.baseline b/tests/baselines/reference/bpSpan_class.baseline new file mode 100644 index 00000000000..3370762f72b --- /dev/null +++ b/tests/baselines/reference/bpSpan_class.baseline @@ -0,0 +1,365 @@ + +1 >class Greeter { + + ~~~~~~~~~~~~~~~~ => Pos: (0 to 15) SpanInfo: {"start":0,"length":396} + >class Greeter { + > constructor(public greeting: string, ...b: string[]) { + > } + > greet() { + > return "

" + this.greeting + "

"; + > } + > private x: string; + > private x1: number = 10; + > private fn() { + > return this.greeting; + > } + > get greetings() { + > return this.greeting; + > } + > set greetings(greetings: string) { + > this.greeting = greetings; + > } + >} + >:=> (line 1, col 0) to (line 18, col 1) +-------------------------------- +2 > constructor(public greeting: string, ...b: string[]) { + + ~~~~~~~~~~~~~~~~ => Pos: (16 to 31) SpanInfo: {"start":79,"length":1} + >} + >:=> (line 3, col 4) to (line 3, col 5) +2 > constructor(public greeting: string, ...b: string[]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (32 to 55) SpanInfo: {"start":32,"length":23} + >public greeting: string + >:=> (line 2, col 16) to (line 2, col 39) +2 > constructor(public greeting: string, ...b: string[]) { + + ~~~~~~~~~~~~~~~~=> Pos: (56 to 71) SpanInfo: {"start":57,"length":14} + >...b: string[] + >:=> (line 2, col 41) to (line 2, col 55) +2 > constructor(public greeting: string, ...b: string[]) { + + ~~~=> Pos: (72 to 74) SpanInfo: {"start":79,"length":1} + >} + >:=> (line 3, col 4) to (line 3, col 5) +-------------------------------- +3 > } + + ~~~~~~ => Pos: (75 to 80) SpanInfo: {"start":79,"length":1} + >} + >:=> (line 3, col 4) to (line 3, col 5) +-------------------------------- +4 > greet() { + + ~~~~~~~~~~~~~~ => Pos: (81 to 94) SpanInfo: {"start":85,"length":64} + >greet() { + > return "

" + this.greeting + "

"; + > } + >:=> (line 4, col 4) to (line 6, col 5) +-------------------------------- +5 > return "

" + this.greeting + "

"; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (95 to 143) SpanInfo: {"start":103,"length":39} + >return "

" + this.greeting + "

" + >:=> (line 5, col 8) to (line 5, col 47) +-------------------------------- +6 > } + + ~~~~~~ => Pos: (144 to 149) SpanInfo: {"start":148,"length":1} + >} + >:=> (line 6, col 4) to (line 6, col 5) +-------------------------------- +7 > private x: string; + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (150 to 172) SpanInfo: undefined +-------------------------------- +8 > private x1: number = 10; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (173 to 201) SpanInfo: {"start":177,"length":24} + >private x1: number = 10; + >:=> (line 8, col 4) to (line 8, col 28) +-------------------------------- +9 > private fn() { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (202 to 220) SpanInfo: {"start":206,"length":50} + >private fn() { + > return this.greeting; + > } + >:=> (line 9, col 4) to (line 11, col 5) +-------------------------------- +10 > return this.greeting; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (221 to 250) SpanInfo: {"start":229,"length":20} + >return this.greeting + >:=> (line 10, col 8) to (line 10, col 28) +-------------------------------- +11 > } + + ~~~~~~ => Pos: (251 to 256) SpanInfo: {"start":255,"length":1} + >} + >:=> (line 11, col 4) to (line 11, col 5) +-------------------------------- +12 > get greetings() { + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (257 to 278) SpanInfo: {"start":261,"length":53} + >get greetings() { + > return this.greeting; + > } + >:=> (line 12, col 4) to (line 14, col 5) +-------------------------------- +13 > return this.greeting; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (279 to 308) SpanInfo: {"start":287,"length":20} + >return this.greeting + >:=> (line 13, col 8) to (line 13, col 28) +-------------------------------- +14 > } + + ~~~~~~ => Pos: (309 to 314) SpanInfo: {"start":313,"length":1} + >} + >:=> (line 14, col 4) to (line 14, col 5) +-------------------------------- +15 > set greetings(greetings: string) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (315 to 353) SpanInfo: {"start":319,"length":75} + >set greetings(greetings: string) { + > this.greeting = greetings; + > } + >:=> (line 15, col 4) to (line 17, col 5) +-------------------------------- +16 > this.greeting = greetings; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (354 to 388) SpanInfo: {"start":362,"length":25} + >this.greeting = greetings + >:=> (line 16, col 8) to (line 16, col 33) +-------------------------------- +17 > } + + ~~~~~~ => Pos: (389 to 394) SpanInfo: {"start":393,"length":1} + >} + >:=> (line 17, col 4) to (line 17, col 5) +-------------------------------- +18 >} + + ~~ => Pos: (395 to 396) SpanInfo: {"start":395,"length":1} + >} + >:=> (line 18, col 0) to (line 18, col 1) +-------------------------------- +19 >class Greeter2 { + + ~~~~~~~~~~~~~~~~~ => Pos: (397 to 413) SpanInfo: {"start":397,"length":18} + >class Greeter2 { + >} + >:=> (line 19, col 0) to (line 20, col 1) +-------------------------------- +20 >} + + ~~ => Pos: (414 to 415) SpanInfo: {"start":414,"length":1} + >} + >:=> (line 20, col 0) to (line 20, col 1) +-------------------------------- +21 >class Greeter1 + + ~~~~~~~~~~~~~~~~ => Pos: (416 to 431) SpanInfo: {"start":416,"length":419} + >class Greeter1 + >{ + > constructor(public greeting: string, ...b: string[]) + > { + > } + > greet() + > { + > return "

" + this.greeting + "

"; + > } + > private x: string; + > private x1: number = 10; + > private fn() + > { + > return this.greeting; + > } + > get greetings() + > { + > return this.greeting; + > } + > set greetings(greetings: string) + > { + > this.greeting = greetings; + > } + >} + >:=> (line 21, col 0) to (line 44, col 1) +-------------------------------- +22 >{ + + ~~ => Pos: (432 to 433) SpanInfo: {"start":501,"length":1} + >} + >:=> (line 25, col 4) to (line 25, col 5) +-------------------------------- +23 > constructor(public greeting: string, ...b: string[]) + + ~~~~~~~~~~~~~~~~ => Pos: (434 to 449) SpanInfo: {"start":501,"length":1} + >} + >:=> (line 25, col 4) to (line 25, col 5) +23 > constructor(public greeting: string, ...b: string[]) + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (450 to 473) SpanInfo: {"start":450,"length":23} + >public greeting: string + >:=> (line 23, col 16) to (line 23, col 39) +23 > constructor(public greeting: string, ...b: string[]) + + ~~~~~~~~~~~~~~~~~=> Pos: (474 to 490) SpanInfo: {"start":475,"length":14} + >...b: string[] + >:=> (line 23, col 41) to (line 23, col 55) +-------------------------------- +24 > { + + ~~~~~~ => Pos: (491 to 496) SpanInfo: {"start":501,"length":1} + >} + >:=> (line 25, col 4) to (line 25, col 5) +-------------------------------- +25 > } + + ~~~~~~ => Pos: (497 to 502) SpanInfo: {"start":501,"length":1} + >} + >:=> (line 25, col 4) to (line 25, col 5) +-------------------------------- +26 > greet() + + ~~~~~~~~~~~~ => Pos: (503 to 514) SpanInfo: {"start":507,"length":68} + >greet() + > { + > return "

" + this.greeting + "

"; + > } + >:=> (line 26, col 4) to (line 29, col 5) +-------------------------------- +27 > { + + ~~~~~~ => Pos: (515 to 520) SpanInfo: {"start":529,"length":39} + >return "

" + this.greeting + "

" + >:=> (line 28, col 8) to (line 28, col 47) +-------------------------------- +28 > return "

" + this.greeting + "

"; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (521 to 569) SpanInfo: {"start":529,"length":39} + >return "

" + this.greeting + "

" + >:=> (line 28, col 8) to (line 28, col 47) +-------------------------------- +29 > } + + ~~~~~~ => Pos: (570 to 575) SpanInfo: {"start":574,"length":1} + >} + >:=> (line 29, col 4) to (line 29, col 5) +-------------------------------- +30 > private x: string; + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (576 to 598) SpanInfo: undefined +-------------------------------- +31 > private x1: number = 10; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (599 to 627) SpanInfo: {"start":603,"length":24} + >private x1: number = 10; + >:=> (line 31, col 4) to (line 31, col 28) +-------------------------------- +32 > private fn() + + ~~~~~~~~~~~~~~~~~ => Pos: (628 to 644) SpanInfo: {"start":632,"length":54} + >private fn() + > { + > return this.greeting; + > } + >:=> (line 32, col 4) to (line 35, col 5) +-------------------------------- +33 > { + + ~~~~~~ => Pos: (645 to 650) SpanInfo: {"start":659,"length":20} + >return this.greeting + >:=> (line 34, col 8) to (line 34, col 28) +-------------------------------- +34 > return this.greeting; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (651 to 680) SpanInfo: {"start":659,"length":20} + >return this.greeting + >:=> (line 34, col 8) to (line 34, col 28) +-------------------------------- +35 > } + + ~~~~~~ => Pos: (681 to 686) SpanInfo: {"start":685,"length":1} + >} + >:=> (line 35, col 4) to (line 35, col 5) +-------------------------------- +36 > get greetings() + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (687 to 707) SpanInfo: {"start":691,"length":58} + >get greetings() + > { + > return this.greeting; + > } + >:=> (line 36, col 4) to (line 39, col 5) +-------------------------------- +37 > { + + ~~~~~~ => Pos: (708 to 713) SpanInfo: {"start":722,"length":20} + >return this.greeting + >:=> (line 38, col 8) to (line 38, col 28) +-------------------------------- +38 > return this.greeting; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (714 to 743) SpanInfo: {"start":722,"length":20} + >return this.greeting + >:=> (line 38, col 8) to (line 38, col 28) +-------------------------------- +39 > } + + ~~~~~~ => Pos: (744 to 749) SpanInfo: {"start":748,"length":1} + >} + >:=> (line 39, col 4) to (line 39, col 5) +-------------------------------- +40 > set greetings(greetings: string) + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (750 to 786) SpanInfo: {"start":754,"length":79} + >set greetings(greetings: string) + > { + > this.greeting = greetings; + > } + >:=> (line 40, col 4) to (line 43, col 5) +-------------------------------- +41 > { + + ~~~~~~ => Pos: (787 to 792) SpanInfo: {"start":801,"length":25} + >this.greeting = greetings + >:=> (line 42, col 8) to (line 42, col 33) +-------------------------------- +42 > this.greeting = greetings; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (793 to 827) SpanInfo: {"start":801,"length":25} + >this.greeting = greetings + >:=> (line 42, col 8) to (line 42, col 33) +-------------------------------- +43 > } + + ~~~~~~ => Pos: (828 to 833) SpanInfo: {"start":832,"length":1} + >} + >:=> (line 43, col 4) to (line 43, col 5) +-------------------------------- +44 >} + + ~~ => Pos: (834 to 835) SpanInfo: {"start":834,"length":1} + >} + >:=> (line 44, col 0) to (line 44, col 1) +-------------------------------- +45 >class Greeter12 + + ~~~~~~~~~~~~~~~~ => Pos: (836 to 851) SpanInfo: {"start":836,"length":19} + >class Greeter12 + >{ + >} + >:=> (line 45, col 0) to (line 47, col 1) +-------------------------------- +46 >{ + + ~~ => Pos: (852 to 853) SpanInfo: {"start":854,"length":1} + >} + >:=> (line 47, col 0) to (line 47, col 1) +-------------------------------- +47 >} + ~ => Pos: (854 to 854) SpanInfo: {"start":854,"length":1} + >} + >:=> (line 47, col 0) to (line 47, col 1) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_classAmbient.baseline b/tests/baselines/reference/bpSpan_classAmbient.baseline new file mode 100644 index 00000000000..b168c5416c5 --- /dev/null +++ b/tests/baselines/reference/bpSpan_classAmbient.baseline @@ -0,0 +1,31 @@ + +1 >declare class Greeter { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 23) SpanInfo: undefined +-------------------------------- +2 > public greeting: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (24 to 52) SpanInfo: undefined +-------------------------------- +3 > constructor(greeting: string, ...b: string[]); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (53 to 103) SpanInfo: undefined +-------------------------------- +4 > greet(): string; + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (104 to 124) SpanInfo: undefined +-------------------------------- +5 > private val; + + ~~~~~~~~~~~~~~~~~ => Pos: (125 to 141) SpanInfo: undefined +-------------------------------- +6 > static x: number; + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (142 to 163) SpanInfo: undefined +-------------------------------- +7 > static fn(a: number, ...b:string[]); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (164 to 204) SpanInfo: undefined +-------------------------------- +8 >} + ~ => Pos: (205 to 205) SpanInfo: undefined \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_classes.baseline b/tests/baselines/reference/bpSpan_classes.baseline new file mode 100644 index 00000000000..811109af835 --- /dev/null +++ b/tests/baselines/reference/bpSpan_classes.baseline @@ -0,0 +1,356 @@ + +1 >module Foo.Bar { + + ~~~~~~~~~~~ => Pos: (0 to 10) SpanInfo: {"start":0,"length":881} + >module Foo.Bar { + > "use strict"; + > + > class Greeter { + > constructor(public greeting: string) { + > } + > + > greet() { + > return "

" + this.greeting + "

"; + > } + > } + > + > + > function foo(greeting: string): Greeter { + > return new Greeter(greeting); + > } + > + > var greeter = new Greeter("Hello, world!"); + > var str = greeter.greet(); + > + > function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) { + > var greeters: Greeter[] = []; /* inline block comment */ + > greeters[0] = new Greeter(greeting); + > for (var i = 0; i < restGreetings.length; i++) { + > greeters.push(new Greeter(restGreetings[i])); + > } + > + > return greeters; + > } + > + > var b = foo2("Hello", "World", "!"); + > // This is simple signle line comment + > for (var j = 0; j < b.length; j++) { + > b[j].greet(); + > } + >} + >:=> (line 1, col 0) to (line 36, col 1) +1 >module Foo.Bar { + + ~~~~~~ => Pos: (11 to 16) SpanInfo: {"start":11,"length":870} + >Bar { + > "use strict"; + > + > class Greeter { + > constructor(public greeting: string) { + > } + > + > greet() { + > return "

" + this.greeting + "

"; + > } + > } + > + > + > function foo(greeting: string): Greeter { + > return new Greeter(greeting); + > } + > + > var greeter = new Greeter("Hello, world!"); + > var str = greeter.greet(); + > + > function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) { + > var greeters: Greeter[] = []; /* inline block comment */ + > greeters[0] = new Greeter(greeting); + > for (var i = 0; i < restGreetings.length; i++) { + > greeters.push(new Greeter(restGreetings[i])); + > } + > + > return greeters; + > } + > + > var b = foo2("Hello", "World", "!"); + > // This is simple signle line comment + > for (var j = 0; j < b.length; j++) { + > b[j].greet(); + > } + >} + >:=> (line 1, col 11) to (line 36, col 1) +-------------------------------- +2 > "use strict"; + + ~~~~~~~~~~~~~~~~~~ => Pos: (17 to 34) SpanInfo: {"start":21,"length":12} + >"use strict" + >:=> (line 2, col 4) to (line 2, col 16) +-------------------------------- +3 > + + ~ => Pos: (35 to 35) SpanInfo: undefined +-------------------------------- +4 > class Greeter { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (36 to 55) SpanInfo: {"start":40,"length":160} + >class Greeter { + > constructor(public greeting: string) { + > } + > + > greet() { + > return "

" + this.greeting + "

"; + > } + > } + >:=> (line 4, col 4) to (line 11, col 5) +-------------------------------- +5 > constructor(public greeting: string) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (56 to 75) SpanInfo: {"start":111,"length":1} + >} + >:=> (line 6, col 8) to (line 6, col 9) +5 > constructor(public greeting: string) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (76 to 99) SpanInfo: {"start":76,"length":23} + >public greeting: string + >:=> (line 5, col 20) to (line 5, col 43) +5 > constructor(public greeting: string) { + + ~~~=> Pos: (100 to 102) SpanInfo: {"start":111,"length":1} + >} + >:=> (line 6, col 8) to (line 6, col 9) +-------------------------------- +6 > } + + ~~~~~~~~~~ => Pos: (103 to 112) SpanInfo: {"start":111,"length":1} + >} + >:=> (line 6, col 8) to (line 6, col 9) +-------------------------------- +7 > + + ~ => Pos: (113 to 113) SpanInfo: undefined +-------------------------------- +8 > greet() { + + ~~~~~~~~~~~~~~~~~~ => Pos: (114 to 131) SpanInfo: {"start":122,"length":72} + >greet() { + > return "

" + this.greeting + "

"; + > } + >:=> (line 8, col 8) to (line 10, col 9) +-------------------------------- +9 > return "

" + this.greeting + "

"; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (132 to 184) SpanInfo: {"start":144,"length":39} + >return "

" + this.greeting + "

" + >:=> (line 9, col 12) to (line 9, col 51) +-------------------------------- +10 > } + + ~~~~~~~~~~ => Pos: (185 to 194) SpanInfo: {"start":193,"length":1} + >} + >:=> (line 10, col 8) to (line 10, col 9) +-------------------------------- +11 > } + + ~~~~~~ => Pos: (195 to 200) SpanInfo: {"start":199,"length":1} + >} + >:=> (line 11, col 4) to (line 11, col 5) +-------------------------------- +12 > + + ~ => Pos: (201 to 201) SpanInfo: undefined +-------------------------------- +13 > + + ~ => Pos: (202 to 202) SpanInfo: undefined +-------------------------------- +14 > function foo(greeting: string): Greeter { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (203 to 248) SpanInfo: {"start":257,"length":28} + >return new Greeter(greeting) + >:=> (line 15, col 8) to (line 15, col 36) +-------------------------------- +15 > return new Greeter(greeting); + + ~~~~~~~~~~~~~~ => Pos: (249 to 262) SpanInfo: {"start":257,"length":28} + >return new Greeter(greeting) + >:=> (line 15, col 8) to (line 15, col 36) +15 > return new Greeter(greeting); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (263 to 286) SpanInfo: {"start":264,"length":21} + >new Greeter(greeting) + >:=> (line 15, col 15) to (line 15, col 36) +-------------------------------- +16 > } + + ~~~~~~ => Pos: (287 to 292) SpanInfo: {"start":291,"length":1} + >} + >:=> (line 16, col 4) to (line 16, col 5) +-------------------------------- +17 > + + ~ => Pos: (293 to 293) SpanInfo: undefined +-------------------------------- +18 > var greeter = new Greeter("Hello, world!"); + + ~~~~~~~~~~~~~~~~~ => Pos: (294 to 310) SpanInfo: {"start":298,"length":42} + >var greeter = new Greeter("Hello, world!") + >:=> (line 18, col 4) to (line 18, col 46) +18 > var greeter = new Greeter("Hello, world!"); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (311 to 341) SpanInfo: {"start":312,"length":28} + >new Greeter("Hello, world!") + >:=> (line 18, col 18) to (line 18, col 46) +-------------------------------- +19 > var str = greeter.greet(); + + ~~~~~~~~~~~~~ => Pos: (342 to 354) SpanInfo: {"start":346,"length":25} + >var str = greeter.greet() + >:=> (line 19, col 4) to (line 19, col 29) +19 > var str = greeter.greet(); + + ~~~~~~~~~~~~~~~~~~ => Pos: (355 to 372) SpanInfo: {"start":356,"length":15} + >greeter.greet() + >:=> (line 19, col 14) to (line 19, col 29) +-------------------------------- +20 > + + ~ => Pos: (373 to 373) SpanInfo: undefined +-------------------------------- +21 > function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (374 to 408) SpanInfo: {"start":468,"length":28} + >var greeters: Greeter[] = [] + >:=> (line 22, col 8) to (line 22, col 36) +21 > function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (409 to 456) SpanInfo: {"start":410,"length":46} + >...restGreetings /* more greeting */: string[] + >:=> (line 21, col 36) to (line 21, col 82) +21 > function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) { + + ~~~=> Pos: (457 to 459) SpanInfo: {"start":468,"length":28} + >var greeters: Greeter[] = [] + >:=> (line 22, col 8) to (line 22, col 36) +-------------------------------- +22 > var greeters: Greeter[] = []; /* inline block comment */ + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (460 to 524) SpanInfo: {"start":468,"length":28} + >var greeters: Greeter[] = [] + >:=> (line 22, col 8) to (line 22, col 36) +-------------------------------- +23 > greeters[0] = new Greeter(greeting); + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (525 to 545) SpanInfo: {"start":533,"length":35} + >greeters[0] = new Greeter(greeting) + >:=> (line 23, col 8) to (line 23, col 43) +23 > greeters[0] = new Greeter(greeting); + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (546 to 569) SpanInfo: {"start":547,"length":21} + >new Greeter(greeting) + >:=> (line 23, col 22) to (line 23, col 43) +-------------------------------- +24 > for (var i = 0; i < restGreetings.length; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (570 to 592) SpanInfo: {"start":583,"length":9} + >var i = 0 + >:=> (line 24, col 13) to (line 24, col 22) +24 > for (var i = 0; i < restGreetings.length; i++) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (593 to 618) SpanInfo: {"start":594,"length":24} + >i < restGreetings.length + >:=> (line 24, col 24) to (line 24, col 48) +24 > for (var i = 0; i < restGreetings.length; i++) { + + ~~~~~~~~=> Pos: (619 to 626) SpanInfo: {"start":620,"length":3} + >i++ + >:=> (line 24, col 50) to (line 24, col 53) +-------------------------------- +25 > greeters.push(new Greeter(restGreetings[i])); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (627 to 652) SpanInfo: {"start":639,"length":44} + >greeters.push(new Greeter(restGreetings[i])) + >:=> (line 25, col 12) to (line 25, col 56) +25 > greeters.push(new Greeter(restGreetings[i])); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (653 to 681) SpanInfo: {"start":653,"length":29} + >new Greeter(restGreetings[i]) + >:=> (line 25, col 26) to (line 25, col 55) +25 > greeters.push(new Greeter(restGreetings[i])); + + ~~~=> Pos: (682 to 684) SpanInfo: {"start":639,"length":44} + >greeters.push(new Greeter(restGreetings[i])) + >:=> (line 25, col 12) to (line 25, col 56) +-------------------------------- +26 > } + + ~~~~~~~~~~ => Pos: (685 to 694) SpanInfo: {"start":639,"length":44} + >greeters.push(new Greeter(restGreetings[i])) + >:=> (line 25, col 12) to (line 25, col 56) +-------------------------------- +27 > + + ~ => Pos: (695 to 695) SpanInfo: undefined +-------------------------------- +28 > return greeters; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (696 to 720) SpanInfo: {"start":704,"length":15} + >return greeters + >:=> (line 28, col 8) to (line 28, col 23) +-------------------------------- +29 > } + + ~~~~~~ => Pos: (721 to 726) SpanInfo: {"start":725,"length":1} + >} + >:=> (line 29, col 4) to (line 29, col 5) +-------------------------------- +30 > + + ~ => Pos: (727 to 727) SpanInfo: undefined +-------------------------------- +31 > var b = foo2("Hello", "World", "!"); + + ~~~~~~~~~~~ => Pos: (728 to 738) SpanInfo: {"start":732,"length":35} + >var b = foo2("Hello", "World", "!") + >:=> (line 31, col 4) to (line 31, col 39) +31 > var b = foo2("Hello", "World", "!"); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (739 to 768) SpanInfo: {"start":740,"length":27} + >foo2("Hello", "World", "!") + >:=> (line 31, col 12) to (line 31, col 39) +-------------------------------- +32 > // This is simple signle line comment + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (769 to 810) SpanInfo: undefined +-------------------------------- +33 > for (var j = 0; j < b.length; j++) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (811 to 829) SpanInfo: {"start":820,"length":9} + >var j = 0 + >:=> (line 33, col 9) to (line 33, col 18) +33 > for (var j = 0; j < b.length; j++) { + + ~~~~~~~~~~~~~~ => Pos: (830 to 843) SpanInfo: {"start":831,"length":12} + >j < b.length + >:=> (line 33, col 20) to (line 33, col 32) +33 > for (var j = 0; j < b.length; j++) { + + ~~~~~~~~ => Pos: (844 to 851) SpanInfo: {"start":845,"length":3} + >j++ + >:=> (line 33, col 34) to (line 33, col 37) +-------------------------------- +34 > b[j].greet(); + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (852 to 873) SpanInfo: {"start":860,"length":12} + >b[j].greet() + >:=> (line 34, col 8) to (line 34, col 20) +-------------------------------- +35 > } + + ~~~~~~ => Pos: (874 to 879) SpanInfo: {"start":860,"length":12} + >b[j].greet() + >:=> (line 34, col 8) to (line 34, col 20) +-------------------------------- +36 >} + ~ => Pos: (880 to 880) SpanInfo: {"start":880,"length":1} + >} + >:=> (line 36, col 0) to (line 36, col 1) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_conditionalExpressions.baseline b/tests/baselines/reference/bpSpan_conditionalExpressions.baseline new file mode 100644 index 00000000000..5abd49d50cf --- /dev/null +++ b/tests/baselines/reference/bpSpan_conditionalExpressions.baseline @@ -0,0 +1,129 @@ + +1 >var x = 10; + + ~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":10} + >var x = 10 + >:=> (line 1, col 0) to (line 1, col 10) +-------------------------------- +2 >var y = x ? x + 10 : 30; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (12 to 36) SpanInfo: {"start":12,"length":23} + >var y = x ? x + 10 : 30 + >:=> (line 2, col 0) to (line 2, col 23) +-------------------------------- +3 >var z = (function foo() { + + ~~~~~~~ => Pos: (37 to 43) SpanInfo: {"start":37,"length":90} + >var z = (function foo() { + > return x; + >})() ? y : function bar() { + > return x; + >} () + >:=> (line 3, col 0) to (line 7, col 4) +3 >var z = (function foo() { + + ~~ => Pos: (44 to 45) SpanInfo: {"start":45,"length":36} + >(function foo() { + > return x; + >})() + >:=> (line 3, col 8) to (line 5, col 4) +3 >var z = (function foo() { + + ~~~~~~~~~~~~~~~~~ => Pos: (46 to 62) SpanInfo: {"start":67,"length":8} + >return x + >:=> (line 4, col 4) to (line 4, col 12) +-------------------------------- +4 > return x; + + ~~~~~~~~~~~~~~ => Pos: (63 to 76) SpanInfo: {"start":67,"length":8} + >return x + >:=> (line 4, col 4) to (line 4, col 12) +-------------------------------- +5 >})() ? y : function bar() { + + ~ => Pos: (77 to 77) SpanInfo: {"start":77,"length":1} + >} + >:=> (line 5, col 0) to (line 5, col 1) +5 >})() ? y : function bar() { + + ~~~ => Pos: (78 to 80) SpanInfo: {"start":45,"length":36} + >(function foo() { + > return x; + >})() + >:=> (line 3, col 8) to (line 5, col 4) +5 >})() ? y : function bar() { + + ~~~~~~ => Pos: (81 to 86) SpanInfo: {"start":37,"length":90} + >var z = (function foo() { + > return x; + >})() ? y : function bar() { + > return x; + >} () + >:=> (line 3, col 0) to (line 7, col 4) +5 >})() ? y : function bar() { + + ~~~~~~~~~~~~~~~~~~ => Pos: (87 to 104) SpanInfo: {"start":113,"length":8} + >return x + >:=> (line 6, col 8) to (line 6, col 16) +-------------------------------- +6 > return x; + + ~~~~~~~~~~~~~~~~~~ => Pos: (105 to 122) SpanInfo: {"start":113,"length":8} + >return x + >:=> (line 6, col 8) to (line 6, col 16) +-------------------------------- +7 >} (); + + ~ => Pos: (123 to 123) SpanInfo: {"start":123,"length":1} + >} + >:=> (line 7, col 0) to (line 7, col 1) +7 >} (); + + ~~~~~ => Pos: (124 to 128) SpanInfo: {"start":88,"length":39} + >function bar() { + > return x; + >} () + >:=> (line 5, col 11) to (line 7, col 4) +-------------------------------- +8 >x = y ? (function () { + + ~~~~~~~ => Pos: (129 to 135) SpanInfo: {"start":129,"length":47} + >x = y ? (function () { + > return z; + >})() : 10 + >:=> (line 8, col 0) to (line 10, col 10) +8 >x = y ? (function () { + + ~~ => Pos: (136 to 137) SpanInfo: {"start":137,"length":33} + >(function () { + > return z; + >})() + >:=> (line 8, col 8) to (line 10, col 4) +8 >x = y ? (function () { + + ~~~~~~~~~~~~~~ => Pos: (138 to 151) SpanInfo: {"start":156,"length":8} + >return z + >:=> (line 9, col 4) to (line 9, col 12) +-------------------------------- +9 > return z; + + ~~~~~~~~~~~~~~ => Pos: (152 to 165) SpanInfo: {"start":156,"length":8} + >return z + >:=> (line 9, col 4) to (line 9, col 12) +-------------------------------- +10 >})() : 10; + ~ => Pos: (166 to 166) SpanInfo: {"start":166,"length":1} + >} + >:=> (line 10, col 0) to (line 10, col 1) +10 >})() : 10; + ~~~ => Pos: (167 to 169) SpanInfo: {"start":137,"length":33} + >(function () { + > return z; + >})() + >:=> (line 8, col 8) to (line 10, col 4) +10 >})() : 10; + ~~~~~~~ => Pos: (170 to 176) SpanInfo: {"start":129,"length":47} + >x = y ? (function () { + > return z; + >})() : 10 + >:=> (line 8, col 0) to (line 10, col 10) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_debugger.baseline b/tests/baselines/reference/bpSpan_debugger.baseline new file mode 100644 index 00000000000..700ef7a56a9 --- /dev/null +++ b/tests/baselines/reference/bpSpan_debugger.baseline @@ -0,0 +1,5 @@ + +1 >debugger; + ~~~~~~~~~ => Pos: (0 to 8) SpanInfo: {"start":0,"length":8} + >debugger + >:=> (line 1, col 0) to (line 1, col 8) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_do.baseline b/tests/baselines/reference/bpSpan_do.baseline new file mode 100644 index 00000000000..3ff287c2046 --- /dev/null +++ b/tests/baselines/reference/bpSpan_do.baseline @@ -0,0 +1,142 @@ + +1 >var i = 0; + + ~~~~~~~~~~~ => Pos: (0 to 10) SpanInfo: {"start":0,"length":9} + >var i = 0 + >:=> (line 1, col 0) to (line 1, col 9) +-------------------------------- +2 >do + + ~~~ => Pos: (11 to 13) SpanInfo: {"start":20,"length":3} + >i++ + >:=> (line 4, col 4) to (line 4, col 7) +-------------------------------- +3 >{ + + ~~ => Pos: (14 to 15) SpanInfo: {"start":20,"length":3} + >i++ + >:=> (line 4, col 4) to (line 4, col 7) +-------------------------------- +4 > i++; + + ~~~~~~~~~ => Pos: (16 to 24) SpanInfo: {"start":20,"length":3} + >i++ + >:=> (line 4, col 4) to (line 4, col 7) +-------------------------------- +5 >} while (i < 10); + + ~ => Pos: (25 to 25) SpanInfo: {"start":20,"length":3} + >i++ + >:=> (line 4, col 4) to (line 4, col 7) +5 >} while (i < 10); + + ~~~~~~~~~~~~~~~~~ => Pos: (26 to 42) SpanInfo: {"start":27,"length":14} + >while (i < 10) + >:=> (line 5, col 2) to (line 5, col 16) +-------------------------------- +6 >do { + + ~~~~~ => Pos: (43 to 47) SpanInfo: {"start":52,"length":3} + >i++ + >:=> (line 7, col 4) to (line 7, col 7) +-------------------------------- +7 > i++; + + ~~~~~~~~~ => Pos: (48 to 56) SpanInfo: {"start":52,"length":3} + >i++ + >:=> (line 7, col 4) to (line 7, col 7) +-------------------------------- +8 >} while (i < 20); + + ~ => Pos: (57 to 57) SpanInfo: {"start":52,"length":3} + >i++ + >:=> (line 7, col 4) to (line 7, col 7) +8 >} while (i < 20); + + ~~~~~~~~~~~~~~~~~ => Pos: (58 to 74) SpanInfo: {"start":59,"length":14} + >while (i < 20) + >:=> (line 8, col 2) to (line 8, col 16) +-------------------------------- +9 >do { + + ~~~~~ => Pos: (75 to 79) SpanInfo: {"start":84,"length":3} + >i++ + >:=> (line 10, col 4) to (line 10, col 7) +-------------------------------- +10 > i++; + + ~~~~~~~~~ => Pos: (80 to 88) SpanInfo: {"start":84,"length":3} + >i++ + >:=> (line 10, col 4) to (line 10, col 7) +-------------------------------- +11 >} + + ~~~ => Pos: (89 to 91) SpanInfo: {"start":84,"length":3} + >i++ + >:=> (line 10, col 4) to (line 10, col 7) +-------------------------------- +12 >while (i < 30); + + ~~~~~~~~~~~~~~~~ => Pos: (92 to 107) SpanInfo: {"start":92,"length":14} + >while (i < 30) + >:=> (line 12, col 0) to (line 12, col 14) +-------------------------------- +13 >do { + + ~~~~~ => Pos: (108 to 112) SpanInfo: {"start":117,"length":3} + >i-- + >:=> (line 14, col 4) to (line 14, col 7) +-------------------------------- +14 > i--; + + ~~~~~~~~~ => Pos: (113 to 121) SpanInfo: {"start":117,"length":3} + >i-- + >:=> (line 14, col 4) to (line 14, col 7) +-------------------------------- +15 >} while ((function () { + + ~ => Pos: (122 to 122) SpanInfo: {"start":117,"length":3} + >i-- + >:=> (line 14, col 4) to (line 14, col 7) +15 >} while ((function () { + + ~~~~~~~~ => Pos: (123 to 130) SpanInfo: {"start":124,"length":60} + >while ((function () { + > return 30 * i; + > })() !== i) + >:=> (line 15, col 2) to (line 17, col 15) +15 >} while ((function () { + + ~ => Pos: (131 to 131) SpanInfo: {"start":131,"length":46} + >(function () { + > return 30 * i; + > })() + >:=> (line 15, col 9) to (line 17, col 8) +15 >} while ((function () { + + ~~~~~~~~~~~~~~ => Pos: (132 to 145) SpanInfo: {"start":154,"length":13} + >return 30 * i + >:=> (line 16, col 8) to (line 16, col 21) +-------------------------------- +16 > return 30 * i; + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (146 to 168) SpanInfo: {"start":154,"length":13} + >return 30 * i + >:=> (line 16, col 8) to (line 16, col 21) +-------------------------------- +17 > })() !== i); + ~~~~~ => Pos: (169 to 173) SpanInfo: {"start":173,"length":1} + >} + >:=> (line 17, col 4) to (line 17, col 5) +17 > })() !== i); + ~~~ => Pos: (174 to 176) SpanInfo: {"start":131,"length":46} + >(function () { + > return 30 * i; + > })() + >:=> (line 15, col 9) to (line 17, col 8) +17 > })() !== i); + ~~~~~~~~~ => Pos: (177 to 185) SpanInfo: {"start":124,"length":60} + >while ((function () { + > return 30 * i; + > })() !== i) + >:=> (line 15, col 2) to (line 17, col 15) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_enums.baseline b/tests/baselines/reference/bpSpan_enums.baseline new file mode 100644 index 00000000000..1dd77f8d417 --- /dev/null +++ b/tests/baselines/reference/bpSpan_enums.baseline @@ -0,0 +1,248 @@ + +1 >enum e { + + ~~~~~~~~~ => Pos: (0 to 8) SpanInfo: {"start":0,"length":30} + >enum e { + > x, + > y, + > x + >} + >:=> (line 1, col 0) to (line 5, col 1) +-------------------------------- +2 > x, + + ~~~~~~~ => Pos: (9 to 15) SpanInfo: {"start":13,"length":1} + >x + >:=> (line 2, col 4) to (line 2, col 5) +-------------------------------- +3 > y, + + ~~~~~~~ => Pos: (16 to 22) SpanInfo: {"start":20,"length":1} + >y + >:=> (line 3, col 4) to (line 3, col 5) +-------------------------------- +4 > x + + ~~~~~~ => Pos: (23 to 28) SpanInfo: {"start":27,"length":1} + >x + >:=> (line 4, col 4) to (line 4, col 5) +-------------------------------- +5 >} + + ~~ => Pos: (29 to 30) SpanInfo: {"start":29,"length":1} + >} + >:=> (line 5, col 0) to (line 5, col 1) +-------------------------------- +6 >enum e2 { + + ~~~~~~~~~~ => Pos: (31 to 40) SpanInfo: {"start":31,"length":49} + >enum e2 { + > x = 10, + > y = 10, + > z, + > x2 + >} + >:=> (line 6, col 0) to (line 11, col 1) +-------------------------------- +7 > x = 10, + + ~~~~~~~~~~~~ => Pos: (41 to 52) SpanInfo: {"start":45,"length":6} + >x = 10 + >:=> (line 7, col 4) to (line 7, col 10) +-------------------------------- +8 > y = 10, + + ~~~~~~~~~~~~ => Pos: (53 to 64) SpanInfo: {"start":57,"length":6} + >y = 10 + >:=> (line 8, col 4) to (line 8, col 10) +-------------------------------- +9 > z, + + ~~~~~~~ => Pos: (65 to 71) SpanInfo: {"start":69,"length":1} + >z + >:=> (line 9, col 4) to (line 9, col 5) +-------------------------------- +10 > x2 + + ~~~~~~~ => Pos: (72 to 78) SpanInfo: {"start":76,"length":2} + >x2 + >:=> (line 10, col 4) to (line 10, col 6) +-------------------------------- +11 >} + + ~~ => Pos: (79 to 80) SpanInfo: {"start":79,"length":1} + >} + >:=> (line 11, col 0) to (line 11, col 1) +-------------------------------- +12 >enum e3 { + + ~~~~~~~~~~ => Pos: (81 to 90) SpanInfo: {"start":81,"length":11} + >enum e3 { + >} + >:=> (line 12, col 0) to (line 13, col 1) +-------------------------------- +13 >} + + ~~ => Pos: (91 to 92) SpanInfo: {"start":91,"length":1} + >} + >:=> (line 13, col 0) to (line 13, col 1) +-------------------------------- +14 >declare enum e4 { + + ~~~~~~~~~~~~~~~~~~ => Pos: (93 to 110) SpanInfo: undefined +-------------------------------- +15 > x, + + ~~~~~~~ => Pos: (111 to 117) SpanInfo: undefined +-------------------------------- +16 > y, + + ~~~~~~~ => Pos: (118 to 124) SpanInfo: undefined +-------------------------------- +17 > z, + + ~~~~~~~ => Pos: (125 to 131) SpanInfo: undefined +-------------------------------- +18 > x2 + + ~~~~~~~ => Pos: (132 to 138) SpanInfo: undefined +-------------------------------- +19 >} + + ~~ => Pos: (139 to 140) SpanInfo: undefined +-------------------------------- +20 >enum e11 + + ~~~~~~~~~~ => Pos: (141 to 150) SpanInfo: {"start":141,"length":33} + >enum e11 + >{ + > x, + > y, + > x + >} + >:=> (line 20, col 0) to (line 25, col 1) +-------------------------------- +21 >{ + + ~~ => Pos: (151 to 152) SpanInfo: {"start":157,"length":1} + >x + >:=> (line 22, col 4) to (line 22, col 5) +-------------------------------- +22 > x, + + ~~~~~~~ => Pos: (153 to 159) SpanInfo: {"start":157,"length":1} + >x + >:=> (line 22, col 4) to (line 22, col 5) +-------------------------------- +23 > y, + + ~~~~~~~ => Pos: (160 to 166) SpanInfo: {"start":164,"length":1} + >y + >:=> (line 23, col 4) to (line 23, col 5) +-------------------------------- +24 > x + + ~~~~~~ => Pos: (167 to 172) SpanInfo: {"start":171,"length":1} + >x + >:=> (line 24, col 4) to (line 24, col 5) +-------------------------------- +25 >} + + ~~ => Pos: (173 to 174) SpanInfo: {"start":173,"length":1} + >} + >:=> (line 25, col 0) to (line 25, col 1) +-------------------------------- +26 >enum e12 + + ~~~~~~~~~ => Pos: (175 to 183) SpanInfo: {"start":175,"length":50} + >enum e12 + >{ + > x = 10, + > y = 10, + > z, + > x2 + >} + >:=> (line 26, col 0) to (line 32, col 1) +-------------------------------- +27 >{ + + ~~ => Pos: (184 to 185) SpanInfo: {"start":190,"length":6} + >x = 10 + >:=> (line 28, col 4) to (line 28, col 10) +-------------------------------- +28 > x = 10, + + ~~~~~~~~~~~~ => Pos: (186 to 197) SpanInfo: {"start":190,"length":6} + >x = 10 + >:=> (line 28, col 4) to (line 28, col 10) +-------------------------------- +29 > y = 10, + + ~~~~~~~~~~~~ => Pos: (198 to 209) SpanInfo: {"start":202,"length":6} + >y = 10 + >:=> (line 29, col 4) to (line 29, col 10) +-------------------------------- +30 > z, + + ~~~~~~~ => Pos: (210 to 216) SpanInfo: {"start":214,"length":1} + >z + >:=> (line 30, col 4) to (line 30, col 5) +-------------------------------- +31 > x2 + + ~~~~~~~ => Pos: (217 to 223) SpanInfo: {"start":221,"length":2} + >x2 + >:=> (line 31, col 4) to (line 31, col 6) +-------------------------------- +32 >} + + ~~ => Pos: (224 to 225) SpanInfo: {"start":224,"length":1} + >} + >:=> (line 32, col 0) to (line 32, col 1) +-------------------------------- +33 >enum e13 + + ~~~~~~~~~ => Pos: (226 to 234) SpanInfo: {"start":226,"length":12} + >enum e13 + >{ + >} + >:=> (line 33, col 0) to (line 35, col 1) +-------------------------------- +34 >{ + + ~~ => Pos: (235 to 236) SpanInfo: {"start":237,"length":1} + >} + >:=> (line 35, col 0) to (line 35, col 1) +-------------------------------- +35 >} + + ~~ => Pos: (237 to 238) SpanInfo: {"start":237,"length":1} + >} + >:=> (line 35, col 0) to (line 35, col 1) +-------------------------------- +36 >declare enum e14 + + ~~~~~~~~~~~~~~~~~ => Pos: (239 to 255) SpanInfo: undefined +-------------------------------- +37 >{ + + ~~ => Pos: (256 to 257) SpanInfo: undefined +-------------------------------- +38 > x, + + ~~~~~~~ => Pos: (258 to 264) SpanInfo: undefined +-------------------------------- +39 > y, + + ~~~~~~~ => Pos: (265 to 271) SpanInfo: undefined +-------------------------------- +40 > z, + + ~~~~~~~ => Pos: (272 to 278) SpanInfo: undefined +-------------------------------- +41 > x2 + + ~~~~~~~ => Pos: (279 to 285) SpanInfo: undefined +-------------------------------- +42 >} + ~ => Pos: (286 to 286) SpanInfo: undefined \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_exportAssignment.baseline b/tests/baselines/reference/bpSpan_exportAssignment.baseline new file mode 100644 index 00000000000..a9d635a929c --- /dev/null +++ b/tests/baselines/reference/bpSpan_exportAssignment.baseline @@ -0,0 +1,23 @@ + +1 >class a { + + ~~~~~~~~~~ => Pos: (0 to 9) SpanInfo: {"start":0,"length":25} + >class a { + > public c; + >} + >:=> (line 1, col 0) to (line 3, col 1) +-------------------------------- +2 > public c; + + ~~~~~~~~~~~~~~ => Pos: (10 to 23) SpanInfo: undefined +-------------------------------- +3 >} + + ~~ => Pos: (24 to 25) SpanInfo: {"start":24,"length":1} + >} + >:=> (line 3, col 0) to (line 3, col 1) +-------------------------------- +4 >export = a; + ~~~~~~~~~~~ => Pos: (26 to 36) SpanInfo: {"start":26,"length":10} + >export = a + >:=> (line 4, col 0) to (line 4, col 10) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_for.baseline b/tests/baselines/reference/bpSpan_for.baseline new file mode 100644 index 00000000000..7fd6ba4c858 --- /dev/null +++ b/tests/baselines/reference/bpSpan_for.baseline @@ -0,0 +1,253 @@ + +1 >for (var i = 0; i < 10; i++) { + + ~~~~~~~~~~~~~~~ => Pos: (0 to 14) SpanInfo: {"start":5,"length":9} + >var i = 0 + >:=> (line 1, col 5) to (line 1, col 14) +1 >for (var i = 0; i < 10; i++) { + + ~~~~~~~~ => Pos: (15 to 22) SpanInfo: {"start":16,"length":6} + >i < 10 + >:=> (line 1, col 16) to (line 1, col 22) +1 >for (var i = 0; i < 10; i++) { + + ~~~~~~~~ => Pos: (23 to 30) SpanInfo: {"start":24,"length":3} + >i++ + >:=> (line 1, col 24) to (line 1, col 27) +-------------------------------- +2 > WScript.Echo("i: " + i); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (31 to 59) SpanInfo: {"start":35,"length":23} + >WScript.Echo("i: " + i) + >:=> (line 2, col 4) to (line 2, col 27) +-------------------------------- +3 >} + + ~~ => Pos: (60 to 61) SpanInfo: {"start":35,"length":23} + >WScript.Echo("i: " + i) + >:=> (line 2, col 4) to (line 2, col 27) +-------------------------------- +4 >for (i = 0; i < 10; i++) + + ~~~~~~~~~~~ => Pos: (62 to 72) SpanInfo: {"start":67,"length":5} + >i = 0 + >:=> (line 4, col 5) to (line 4, col 10) +4 >for (i = 0; i < 10; i++) + + ~~~~~~~~ => Pos: (73 to 80) SpanInfo: {"start":74,"length":6} + >i < 10 + >:=> (line 4, col 12) to (line 4, col 18) +4 >for (i = 0; i < 10; i++) + + ~~~~~~ => Pos: (81 to 86) SpanInfo: {"start":82,"length":3} + >i++ + >:=> (line 4, col 20) to (line 4, col 23) +-------------------------------- +5 >{ + + ~~ => Pos: (87 to 88) SpanInfo: {"start":93,"length":23} + >WScript.Echo("i: " + i) + >:=> (line 6, col 4) to (line 6, col 27) +-------------------------------- +6 > WScript.Echo("i: " + i); + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (89 to 117) SpanInfo: {"start":93,"length":23} + >WScript.Echo("i: " + i) + >:=> (line 6, col 4) to (line 6, col 27) +-------------------------------- +7 >} + + ~~ => Pos: (118 to 119) SpanInfo: {"start":93,"length":23} + >WScript.Echo("i: " + i) + >:=> (line 6, col 4) to (line 6, col 27) +-------------------------------- +8 >for (var j = 0; j < 10; ) { + + ~~~~~~~~~~~~~~~ => Pos: (120 to 134) SpanInfo: {"start":125,"length":9} + >var j = 0 + >:=> (line 8, col 5) to (line 8, col 14) +8 >for (var j = 0; j < 10; ) { + + ~~~~~~~~~~~~~ => Pos: (135 to 147) SpanInfo: {"start":136,"length":6} + >j < 10 + >:=> (line 8, col 16) to (line 8, col 22) +-------------------------------- +9 > j++; + + ~~~~~~~~~ => Pos: (148 to 156) SpanInfo: {"start":152,"length":3} + >j++ + >:=> (line 9, col 4) to (line 9, col 7) +-------------------------------- +10 > if (j == 1) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (157 to 174) SpanInfo: {"start":161,"length":11} + >if (j == 1) + >:=> (line 10, col 4) to (line 10, col 15) +-------------------------------- +11 > continue; + + ~~~~~~~~~~~~~~~~~~ => Pos: (175 to 192) SpanInfo: {"start":183,"length":8} + >continue + >:=> (line 11, col 8) to (line 11, col 16) +-------------------------------- +12 > } + + ~~~~~~ => Pos: (193 to 198) SpanInfo: {"start":183,"length":8} + >continue + >:=> (line 11, col 8) to (line 11, col 16) +-------------------------------- +13 >} + + ~~ => Pos: (199 to 200) SpanInfo: {"start":161,"length":11} + >if (j == 1) + >:=> (line 10, col 4) to (line 10, col 15) +-------------------------------- +14 >for (j = 0; j < 10;) + + ~~~~~~~~~~~ => Pos: (201 to 211) SpanInfo: {"start":206,"length":5} + >j = 0 + >:=> (line 14, col 5) to (line 14, col 10) +14 >for (j = 0; j < 10;) + + ~~~~~~~~~~ => Pos: (212 to 221) SpanInfo: {"start":213,"length":6} + >j < 10 + >:=> (line 14, col 12) to (line 14, col 18) +-------------------------------- +15 >{ + + ~~ => Pos: (222 to 223) SpanInfo: {"start":228,"length":3} + >j++ + >:=> (line 16, col 4) to (line 16, col 7) +-------------------------------- +16 > j++; + + ~~~~~~~~~ => Pos: (224 to 232) SpanInfo: {"start":228,"length":3} + >j++ + >:=> (line 16, col 4) to (line 16, col 7) +-------------------------------- +17 >} + + ~~ => Pos: (233 to 234) SpanInfo: {"start":228,"length":3} + >j++ + >:=> (line 16, col 4) to (line 16, col 7) +-------------------------------- +18 >for (var k = 0;; k++) { + + ~~~~~~~~~~~~~~~~ => Pos: (235 to 250) SpanInfo: {"start":240,"length":9} + >var k = 0 + >:=> (line 18, col 5) to (line 18, col 14) +18 >for (var k = 0;; k++) { + + ~~~~~~~~ => Pos: (251 to 258) SpanInfo: {"start":252,"length":3} + >k++ + >:=> (line 18, col 17) to (line 18, col 20) +-------------------------------- +19 >} + + ~~ => Pos: (259 to 260) SpanInfo: undefined +-------------------------------- +20 >for (k = 0;; k++) + + ~~~~~~~~~~~~ => Pos: (261 to 272) SpanInfo: {"start":266,"length":5} + >k = 0 + >:=> (line 20, col 5) to (line 20, col 10) +20 >for (k = 0;; k++) + + ~~~~~~ => Pos: (273 to 278) SpanInfo: {"start":274,"length":3} + >k++ + >:=> (line 20, col 13) to (line 20, col 16) +-------------------------------- +21 >{ + + ~~ => Pos: (279 to 280) SpanInfo: undefined +-------------------------------- +22 >} + + ~~ => Pos: (281 to 282) SpanInfo: undefined +-------------------------------- +23 >for (; k < 10; k++) { + + ~~~~~~~~~~~~~~ => Pos: (283 to 296) SpanInfo: {"start":290,"length":6} + >k < 10 + >:=> (line 23, col 7) to (line 23, col 13) +23 >for (; k < 10; k++) { + + ~~~~~~~~ => Pos: (297 to 304) SpanInfo: {"start":298,"length":3} + >k++ + >:=> (line 23, col 15) to (line 23, col 18) +-------------------------------- +24 >} + + ~~ => Pos: (305 to 306) SpanInfo: undefined +-------------------------------- +25 >for (;;) { + + ~~~~~~~~~~~ => Pos: (307 to 317) SpanInfo: undefined +-------------------------------- +26 > i++; + + ~~~~~~~~~ => Pos: (318 to 326) SpanInfo: {"start":322,"length":3} + >i++ + >:=> (line 26, col 4) to (line 26, col 7) +-------------------------------- +27 >} + + ~~ => Pos: (327 to 328) SpanInfo: {"start":322,"length":3} + >i++ + >:=> (line 26, col 4) to (line 26, col 7) +-------------------------------- +28 >for (;;) + + ~~~~~~~~~ => Pos: (329 to 337) SpanInfo: undefined +-------------------------------- +29 >{ + + ~~ => Pos: (338 to 339) SpanInfo: {"start":344,"length":3} + >i++ + >:=> (line 30, col 4) to (line 30, col 7) +-------------------------------- +30 > i++; + + ~~~~~~~~~ => Pos: (340 to 348) SpanInfo: {"start":344,"length":3} + >i++ + >:=> (line 30, col 4) to (line 30, col 7) +-------------------------------- +31 >} + + ~~ => Pos: (349 to 350) SpanInfo: {"start":344,"length":3} + >i++ + >:=> (line 30, col 4) to (line 30, col 7) +-------------------------------- +32 >for (i = 0, j = 20; j < 20, i < 20; j++) { + + ~~~~~ => Pos: (351 to 355) SpanInfo: {"start":356,"length":13} + >i = 0, j = 20 + >:=> (line 32, col 5) to (line 32, col 18) +32 >for (i = 0, j = 20; j < 20, i < 20; j++) { + + ~~~~~~ => Pos: (356 to 361) SpanInfo: {"start":356,"length":5} + >i = 0 + >:=> (line 32, col 5) to (line 32, col 10) +32 >for (i = 0, j = 20; j < 20, i < 20; j++) { + + ~~~~~~~~ => Pos: (362 to 369) SpanInfo: {"start":363,"length":6} + >j = 20 + >:=> (line 32, col 12) to (line 32, col 18) +32 >for (i = 0, j = 20; j < 20, i < 20; j++) { + + ~~~~~~~~ => Pos: (370 to 377) SpanInfo: {"start":371,"length":6} + >j < 20 + >:=> (line 32, col 20) to (line 32, col 26) +32 >for (i = 0, j = 20; j < 20, i < 20; j++) { + + ~~~~~~~~ => Pos: (378 to 385) SpanInfo: {"start":379,"length":6} + >i < 20 + >:=> (line 32, col 28) to (line 32, col 34) +32 >for (i = 0, j = 20; j < 20, i < 20; j++) { + + ~~~~~~~~ => Pos: (386 to 393) SpanInfo: {"start":387,"length":3} + >j++ + >:=> (line 32, col 36) to (line 32, col 39) +-------------------------------- +33 >} + ~ => Pos: (394 to 394) SpanInfo: undefined \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_forIn.baseline b/tests/baselines/reference/bpSpan_forIn.baseline new file mode 100644 index 00000000000..c2b72df5b12 --- /dev/null +++ b/tests/baselines/reference/bpSpan_forIn.baseline @@ -0,0 +1,143 @@ + +1 >for (var x in String) { + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 23) SpanInfo: {"start":0,"length":21} + >for (var x in String) + >:=> (line 1, col 0) to (line 1, col 21) +-------------------------------- +2 > WScript.Echo(x); + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (24 to 44) SpanInfo: {"start":28,"length":15} + >WScript.Echo(x) + >:=> (line 2, col 4) to (line 2, col 19) +-------------------------------- +3 >} + + ~~ => Pos: (45 to 46) SpanInfo: {"start":28,"length":15} + >WScript.Echo(x) + >:=> (line 2, col 4) to (line 2, col 19) +-------------------------------- +4 >for (x in String) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (47 to 66) SpanInfo: {"start":47,"length":17} + >for (x in String) + >:=> (line 4, col 0) to (line 4, col 17) +-------------------------------- +5 > WScript.Echo(x); + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (67 to 87) SpanInfo: {"start":71,"length":15} + >WScript.Echo(x) + >:=> (line 5, col 4) to (line 5, col 19) +-------------------------------- +6 >} + + ~~ => Pos: (88 to 89) SpanInfo: {"start":71,"length":15} + >WScript.Echo(x) + >:=> (line 5, col 4) to (line 5, col 19) +-------------------------------- +7 >for (var x2 in String) + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (90 to 112) SpanInfo: {"start":90,"length":22} + >for (var x2 in String) + >:=> (line 7, col 0) to (line 7, col 22) +-------------------------------- +8 >{ + + ~~ => Pos: (113 to 114) SpanInfo: {"start":119,"length":16} + >WScript.Echo(x2) + >:=> (line 9, col 4) to (line 9, col 20) +-------------------------------- +9 > WScript.Echo(x2); + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (115 to 136) SpanInfo: {"start":119,"length":16} + >WScript.Echo(x2) + >:=> (line 9, col 4) to (line 9, col 20) +-------------------------------- +10 >} + + ~~ => Pos: (137 to 138) SpanInfo: {"start":119,"length":16} + >WScript.Echo(x2) + >:=> (line 9, col 4) to (line 9, col 20) +-------------------------------- +11 >for (x in String) + + ~~~~~~~~~~~~~~~~~~ => Pos: (139 to 156) SpanInfo: {"start":139,"length":17} + >for (x in String) + >:=> (line 11, col 0) to (line 11, col 17) +-------------------------------- +12 >{ + + ~~ => Pos: (157 to 158) SpanInfo: {"start":163,"length":15} + >WScript.Echo(x) + >:=> (line 13, col 4) to (line 13, col 19) +-------------------------------- +13 > WScript.Echo(x); + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (159 to 179) SpanInfo: {"start":163,"length":15} + >WScript.Echo(x) + >:=> (line 13, col 4) to (line 13, col 19) +-------------------------------- +14 >} + + ~~ => Pos: (180 to 181) SpanInfo: {"start":163,"length":15} + >WScript.Echo(x) + >:=> (line 13, col 4) to (line 13, col 19) +-------------------------------- +15 >var z = 10; + + ~~~~~~~~~~~~ => Pos: (182 to 193) SpanInfo: {"start":182,"length":10} + >var z = 10 + >:=> (line 15, col 0) to (line 15, col 10) +-------------------------------- +16 >for (x in function foo() { + + ~~~~~~~~~ => Pos: (194 to 202) SpanInfo: {"start":194,"length":54} + >for (x in function foo() { + > return new String(); + >}) + >:=> (line 16, col 0) to (line 18, col 2) +16 >for (x in function foo() { + + ~~~~~~~~~~~~~~~~~~ => Pos: (203 to 220) SpanInfo: {"start":225,"length":19} + >return new String() + >:=> (line 17, col 4) to (line 17, col 23) +-------------------------------- +17 > return new String(); + + ~~~~~~~~~~ => Pos: (221 to 230) SpanInfo: {"start":225,"length":19} + >return new String() + >:=> (line 17, col 4) to (line 17, col 23) +17 > return new String(); + + ~~~~~~~~~~~~~~~ => Pos: (231 to 245) SpanInfo: {"start":232,"length":12} + >new String() + >:=> (line 17, col 11) to (line 17, col 23) +-------------------------------- +18 >}) { + + ~ => Pos: (246 to 246) SpanInfo: {"start":246,"length":1} + >} + >:=> (line 18, col 0) to (line 18, col 1) +18 >}) { + + ~ => Pos: (247 to 247) SpanInfo: {"start":194,"length":54} + >for (x in function foo() { + > return new String(); + >}) + >:=> (line 16, col 0) to (line 18, col 2) +18 >}) { + + ~~~ => Pos: (248 to 250) SpanInfo: {"start":255,"length":3} + >z++ + >:=> (line 19, col 4) to (line 19, col 7) +-------------------------------- +19 > z++; + + ~~~~~~~~~ => Pos: (251 to 259) SpanInfo: {"start":255,"length":3} + >z++ + >:=> (line 19, col 4) to (line 19, col 7) +-------------------------------- +20 >} + ~ => Pos: (260 to 260) SpanInfo: {"start":255,"length":3} + >z++ + >:=> (line 19, col 4) to (line 19, col 7) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_functionExpressions.baseline b/tests/baselines/reference/bpSpan_functionExpressions.baseline new file mode 100644 index 00000000000..135edff9418 --- /dev/null +++ b/tests/baselines/reference/bpSpan_functionExpressions.baseline @@ -0,0 +1,189 @@ + +1 >var greetings = 0; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 18) SpanInfo: {"start":0,"length":17} + >var greetings = 0 + >:=> (line 1, col 0) to (line 1, col 17) +-------------------------------- +2 >var greet = (greeting: string): number => { + + ~~~~~~~~~~~ => Pos: (19 to 29) SpanInfo: {"start":19,"length":84} + >var greet = (greeting: string): number => { + > greetings++; + > return greetings; + >} + >:=> (line 2, col 0) to (line 5, col 1) +2 >var greet = (greeting: string): number => { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (30 to 62) SpanInfo: {"start":67,"length":11} + >greetings++ + >:=> (line 3, col 4) to (line 3, col 15) +-------------------------------- +3 > greetings++; + + ~~~~~~~~~~~~~~~~~ => Pos: (63 to 79) SpanInfo: {"start":67,"length":11} + >greetings++ + >:=> (line 3, col 4) to (line 3, col 15) +-------------------------------- +4 > return greetings; + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (80 to 101) SpanInfo: {"start":84,"length":16} + >return greetings + >:=> (line 4, col 4) to (line 4, col 20) +-------------------------------- +5 >} + + ~~ => Pos: (102 to 103) SpanInfo: {"start":102,"length":1} + >} + >:=> (line 5, col 0) to (line 5, col 1) +-------------------------------- +6 >greet("Hello"); + + ~~~~~~~~~~~~~~~~ => Pos: (104 to 119) SpanInfo: {"start":104,"length":14} + >greet("Hello") + >:=> (line 6, col 0) to (line 6, col 14) +-------------------------------- +7 >var incrGreetings = () => greetings++; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (120 to 138) SpanInfo: {"start":120,"length":37} + >var incrGreetings = () => greetings++ + >:=> (line 7, col 0) to (line 7, col 37) +7 >var incrGreetings = () => greetings++; + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (139 to 158) SpanInfo: {"start":146,"length":11} + >greetings++ + >:=> (line 7, col 26) to (line 7, col 37) +-------------------------------- +8 >var greetNewMsg = msg => greet(msg); + + ~~~~~~~~~~~~~~~~~ => Pos: (159 to 175) SpanInfo: {"start":159,"length":35} + >var greetNewMsg = msg => greet(msg) + >:=> (line 8, col 0) to (line 8, col 35) +8 >var greetNewMsg = msg => greet(msg); + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (176 to 195) SpanInfo: {"start":184,"length":10} + >greet(msg) + >:=> (line 8, col 25) to (line 8, col 35) +-------------------------------- +9 >greetNewMsg = function (msg: string) { + + ~~~~~~~~~~~~~ => Pos: (196 to 208) SpanInfo: {"start":196,"length":63} + >greetNewMsg = function (msg: string) { + > return greet(msg); + >} + >:=> (line 9, col 0) to (line 11, col 1) +9 >greetNewMsg = function (msg: string) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (209 to 234) SpanInfo: {"start":239,"length":17} + >return greet(msg) + >:=> (line 10, col 4) to (line 10, col 21) +-------------------------------- +10 > return greet(msg); + + ~~~~~~~~~~ => Pos: (235 to 244) SpanInfo: {"start":239,"length":17} + >return greet(msg) + >:=> (line 10, col 4) to (line 10, col 21) +10 > return greet(msg); + + ~~~~~~~~~~~~~ => Pos: (245 to 257) SpanInfo: {"start":246,"length":10} + >greet(msg) + >:=> (line 10, col 11) to (line 10, col 21) +-------------------------------- +11 >}; + + ~~~ => Pos: (258 to 260) SpanInfo: {"start":258,"length":1} + >} + >:=> (line 11, col 0) to (line 11, col 1) +-------------------------------- +12 >function bar(a = function foo() { + + ~~~~~~~~~~~~~ => Pos: (261 to 273) SpanInfo: {"start":326,"length":9} + >if (!a()) + >:=> (line 15, col 4) to (line 15, col 13) +12 >function bar(a = function foo() { + + ~~~ => Pos: (274 to 276) SpanInfo: {"start":274,"length":44} + >a = function foo() { + > return greetings; + >} + >:=> (line 12, col 13) to (line 14, col 1) +12 >function bar(a = function foo() { + + ~~~~~~~~~~~~~~~~~~ => Pos: (277 to 294) SpanInfo: {"start":299,"length":16} + >return greetings + >:=> (line 13, col 4) to (line 13, col 20) +-------------------------------- +13 > return greetings; + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (295 to 316) SpanInfo: {"start":299,"length":16} + >return greetings + >:=> (line 13, col 4) to (line 13, col 20) +-------------------------------- +14 >}) { + + ~~ => Pos: (317 to 318) SpanInfo: {"start":317,"length":1} + >} + >:=> (line 14, col 0) to (line 14, col 1) +14 >}) { + + ~~~ => Pos: (319 to 321) SpanInfo: {"start":326,"length":9} + >if (!a()) + >:=> (line 15, col 4) to (line 15, col 13) +-------------------------------- +15 > if (!a()) { + + ~~~~~~~~~ => Pos: (322 to 330) SpanInfo: {"start":326,"length":9} + >if (!a()) + >:=> (line 15, col 4) to (line 15, col 13) +15 > if (!a()) { + + ~~~ => Pos: (331 to 333) SpanInfo: {"start":331,"length":3} + >a() + >:=> (line 15, col 9) to (line 15, col 12) +15 > if (!a()) { + + ~~~~ => Pos: (334 to 337) SpanInfo: {"start":326,"length":9} + >if (!a()) + >:=> (line 15, col 4) to (line 15, col 13) +-------------------------------- +16 > return a; + + ~~~~~~~~~~~~~~~~~~ => Pos: (338 to 355) SpanInfo: {"start":346,"length":8} + >return a + >:=> (line 16, col 8) to (line 16, col 16) +-------------------------------- +17 > } + + ~~~~~~ => Pos: (356 to 361) SpanInfo: {"start":346,"length":8} + >return a + >:=> (line 16, col 8) to (line 16, col 16) +-------------------------------- +18 > return function bar() { + + ~~~~~~~~~~ => Pos: (362 to 371) SpanInfo: {"start":366,"length":56} + >return function bar() { + > return -greetings; + > } + >:=> (line 18, col 4) to (line 20, col 5) +18 > return function bar() { + + ~~~~~~~~~~~~~~~~~~ => Pos: (372 to 389) SpanInfo: {"start":398,"length":17} + >return -greetings + >:=> (line 19, col 8) to (line 19, col 25) +-------------------------------- +19 > return -greetings; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (390 to 416) SpanInfo: {"start":398,"length":17} + >return -greetings + >:=> (line 19, col 8) to (line 19, col 25) +-------------------------------- +20 > }; + + ~~~~~~~ => Pos: (417 to 423) SpanInfo: {"start":421,"length":1} + >} + >:=> (line 20, col 4) to (line 20, col 5) +-------------------------------- +21 >} + ~ => Pos: (424 to 424) SpanInfo: {"start":424,"length":1} + >} + >:=> (line 21, col 0) to (line 21, col 1) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_functions.baseline b/tests/baselines/reference/bpSpan_functions.baseline new file mode 100644 index 00000000000..535f177c0f6 --- /dev/null +++ b/tests/baselines/reference/bpSpan_functions.baseline @@ -0,0 +1,372 @@ + +1 >var greetings = 0; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 18) SpanInfo: {"start":0,"length":17} + >var greetings = 0 + >:=> (line 1, col 0) to (line 1, col 17) +-------------------------------- +2 >function greet(greeting: string): number { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (19 to 61) SpanInfo: {"start":66,"length":11} + >greetings++ + >:=> (line 3, col 4) to (line 3, col 15) +-------------------------------- +3 > greetings++; + + ~~~~~~~~~~~~~~~~~ => Pos: (62 to 78) SpanInfo: {"start":66,"length":11} + >greetings++ + >:=> (line 3, col 4) to (line 3, col 15) +-------------------------------- +4 > return greetings; + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (79 to 100) SpanInfo: {"start":83,"length":16} + >return greetings + >:=> (line 4, col 4) to (line 4, col 20) +-------------------------------- +5 >} + + ~~ => Pos: (101 to 102) SpanInfo: {"start":101,"length":1} + >} + >:=> (line 5, col 0) to (line 5, col 1) +-------------------------------- +6 >function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (103 to 135) SpanInfo: {"start":196,"length":11} + >greetings++ + >:=> (line 7, col 4) to (line 7, col 15) +6 >function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { + + ~~~~~~~~~~~~~~~~~~~~=> Pos: (136 to 155) SpanInfo: {"start":137,"length":6} + >n = 10 + >:=> (line 6, col 34) to (line 6, col 40) +6 >function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (156 to 188) SpanInfo: {"start":157,"length":23} + >...restParams: string[] + >:=> (line 6, col 54) to (line 6, col 77) +6 >function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { + + ~~~=> Pos: (189 to 191) SpanInfo: {"start":196,"length":11} + >greetings++ + >:=> (line 7, col 4) to (line 7, col 15) +-------------------------------- +7 > greetings++; + + ~~~~~~~~~~~~~~~~~ => Pos: (192 to 208) SpanInfo: {"start":196,"length":11} + >greetings++ + >:=> (line 7, col 4) to (line 7, col 15) +-------------------------------- +8 > return greetings; + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (209 to 230) SpanInfo: {"start":213,"length":16} + >return greetings + >:=> (line 8, col 4) to (line 8, col 20) +-------------------------------- +9 >} + + ~~ => Pos: (231 to 232) SpanInfo: {"start":231,"length":1} + >} + >:=> (line 9, col 0) to (line 9, col 1) +-------------------------------- +10 >function foo(greeting: string, n = 10, x?: string, ...restParams: string[]) + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (233 to 262) SpanInfo: {"start":315,"length":6} + >return + >:=> (line 12, col 4) to (line 12, col 10) +10 >function foo(greeting: string, n = 10, x?: string, ...restParams: string[]) + + ~~~~~~~~~~~~~~~~~~~~=> Pos: (263 to 282) SpanInfo: {"start":264,"length":6} + >n = 10 + >:=> (line 10, col 31) to (line 10, col 37) +10 >function foo(greeting: string, n = 10, x?: string, ...restParams: string[]) + + ~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (283 to 308) SpanInfo: {"start":284,"length":23} + >...restParams: string[] + >:=> (line 10, col 51) to (line 10, col 74) +-------------------------------- +11 >{ + + ~~ => Pos: (309 to 310) SpanInfo: {"start":315,"length":6} + >return + >:=> (line 12, col 4) to (line 12, col 10) +-------------------------------- +12 > return; + + ~~~~~~~~~~~~ => Pos: (311 to 322) SpanInfo: {"start":315,"length":6} + >return + >:=> (line 12, col 4) to (line 12, col 10) +-------------------------------- +13 >} + + ~~ => Pos: (323 to 324) SpanInfo: {"start":323,"length":1} + >} + >:=> (line 13, col 0) to (line 13, col 1) +-------------------------------- +14 >module m { + + ~~~~~~~~~~~ => Pos: (325 to 335) SpanInfo: {"start":325,"length":389} + >module m { + > var greetings = 0; + > function greet(greeting: string): number { + > greetings++; + > return greetings; + > } + > function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { + > greetings++; + > return greetings; + > } + > function foo(greeting: string, n = 10, x?: string, ...restParams: string[]) + > { + > return; + > } + >} + >:=> (line 14, col 0) to (line 28, col 1) +-------------------------------- +15 > var greetings = 0; + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (336 to 358) SpanInfo: {"start":340,"length":17} + >var greetings = 0 + >:=> (line 15, col 4) to (line 15, col 21) +-------------------------------- +16 > function greet(greeting: string): number { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (359 to 405) SpanInfo: {"start":414,"length":11} + >greetings++ + >:=> (line 17, col 8) to (line 17, col 19) +-------------------------------- +17 > greetings++; + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (406 to 426) SpanInfo: {"start":414,"length":11} + >greetings++ + >:=> (line 17, col 8) to (line 17, col 19) +-------------------------------- +18 > return greetings; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (427 to 452) SpanInfo: {"start":435,"length":16} + >return greetings + >:=> (line 18, col 8) to (line 18, col 24) +-------------------------------- +19 > } + + ~~~~~~ => Pos: (453 to 458) SpanInfo: {"start":457,"length":1} + >} + >:=> (line 19, col 4) to (line 19, col 5) +-------------------------------- +20 > function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (459 to 495) SpanInfo: {"start":560,"length":11} + >greetings++ + >:=> (line 21, col 8) to (line 21, col 19) +20 > function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { + + ~~~~~~~~~~~~~~~~~~~~=> Pos: (496 to 515) SpanInfo: {"start":497,"length":6} + >n = 10 + >:=> (line 20, col 38) to (line 20, col 44) +20 > function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (516 to 548) SpanInfo: {"start":517,"length":23} + >...restParams: string[] + >:=> (line 20, col 58) to (line 20, col 81) +20 > function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { + + ~~~=> Pos: (549 to 551) SpanInfo: {"start":560,"length":11} + >greetings++ + >:=> (line 21, col 8) to (line 21, col 19) +-------------------------------- +21 > greetings++; + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (552 to 572) SpanInfo: {"start":560,"length":11} + >greetings++ + >:=> (line 21, col 8) to (line 21, col 19) +-------------------------------- +22 > return greetings; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (573 to 598) SpanInfo: {"start":581,"length":16} + >return greetings + >:=> (line 22, col 8) to (line 22, col 24) +-------------------------------- +23 > } + + ~~~~~~ => Pos: (599 to 604) SpanInfo: {"start":603,"length":1} + >} + >:=> (line 23, col 4) to (line 23, col 5) +-------------------------------- +24 > function foo(greeting: string, n = 10, x?: string, ...restParams: string[]) + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (605 to 638) SpanInfo: {"start":699,"length":6} + >return + >:=> (line 26, col 8) to (line 26, col 14) +24 > function foo(greeting: string, n = 10, x?: string, ...restParams: string[]) + + ~~~~~~~~~~~~~~~~~~~~=> Pos: (639 to 658) SpanInfo: {"start":640,"length":6} + >n = 10 + >:=> (line 24, col 35) to (line 24, col 41) +24 > function foo(greeting: string, n = 10, x?: string, ...restParams: string[]) + + ~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (659 to 684) SpanInfo: {"start":660,"length":23} + >...restParams: string[] + >:=> (line 24, col 55) to (line 24, col 78) +-------------------------------- +25 > { + + ~~~~~~ => Pos: (685 to 690) SpanInfo: {"start":699,"length":6} + >return + >:=> (line 26, col 8) to (line 26, col 14) +-------------------------------- +26 > return; + + ~~~~~~~~~~~~~~~~ => Pos: (691 to 706) SpanInfo: {"start":699,"length":6} + >return + >:=> (line 26, col 8) to (line 26, col 14) +-------------------------------- +27 > } + + ~~~~~~ => Pos: (707 to 712) SpanInfo: {"start":711,"length":1} + >} + >:=> (line 27, col 4) to (line 27, col 5) +-------------------------------- +28 >} + + ~~ => Pos: (713 to 714) SpanInfo: {"start":713,"length":1} + >} + >:=> (line 28, col 0) to (line 28, col 1) +-------------------------------- +29 >module m1 { + + ~~~~~~~~~~~~ => Pos: (715 to 726) SpanInfo: {"start":715,"length":411} + >module m1 { + > var greetings = 0; + > export function greet(greeting: string): number { + > greetings++; + > return greetings; + > } + > export function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { + > greetings++; + > return greetings; + > } + > export function foo(greeting: string, n = 10, x?: string, ...restParams: string[]) + > { + > return; + > } + >} + >:=> (line 29, col 0) to (line 43, col 1) +-------------------------------- +30 > var greetings = 0; + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (727 to 749) SpanInfo: {"start":731,"length":17} + >var greetings = 0 + >:=> (line 30, col 4) to (line 30, col 21) +-------------------------------- +31 > export function greet(greeting: string): number { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (750 to 803) SpanInfo: {"start":754,"length":102} + >export function greet(greeting: string): number { + > greetings++; + > return greetings; + > } + >:=> (line 31, col 4) to (line 34, col 5) +-------------------------------- +32 > greetings++; + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (804 to 824) SpanInfo: {"start":812,"length":11} + >greetings++ + >:=> (line 32, col 8) to (line 32, col 19) +-------------------------------- +33 > return greetings; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (825 to 850) SpanInfo: {"start":833,"length":16} + >return greetings + >:=> (line 33, col 8) to (line 33, col 24) +-------------------------------- +34 > } + + ~~~~~~ => Pos: (851 to 856) SpanInfo: {"start":855,"length":1} + >} + >:=> (line 34, col 4) to (line 34, col 5) +-------------------------------- +35 > export function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (857 to 900) SpanInfo: {"start":861,"length":148} + >export function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { + > greetings++; + > return greetings; + > } + >:=> (line 35, col 4) to (line 38, col 5) +35 > export function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { + + ~~~~~~~~~~~~~~~~~~~~=> Pos: (901 to 920) SpanInfo: {"start":902,"length":6} + >n = 10 + >:=> (line 35, col 45) to (line 35, col 51) +35 > export function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (921 to 953) SpanInfo: {"start":922,"length":23} + >...restParams: string[] + >:=> (line 35, col 65) to (line 35, col 88) +35 > export function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { + + ~~~=> Pos: (954 to 956) SpanInfo: {"start":861,"length":148} + >export function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { + > greetings++; + > return greetings; + > } + >:=> (line 35, col 4) to (line 38, col 5) +-------------------------------- +36 > greetings++; + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (957 to 977) SpanInfo: {"start":965,"length":11} + >greetings++ + >:=> (line 36, col 8) to (line 36, col 19) +-------------------------------- +37 > return greetings; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (978 to 1003) SpanInfo: {"start":986,"length":16} + >return greetings + >:=> (line 37, col 8) to (line 37, col 24) +-------------------------------- +38 > } + + ~~~~~~ => Pos: (1004 to 1009) SpanInfo: {"start":1008,"length":1} + >} + >:=> (line 38, col 4) to (line 38, col 5) +-------------------------------- +39 > export function foo(greeting: string, n = 10, x?: string, ...restParams: string[]) + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1010 to 1050) SpanInfo: {"start":1014,"length":110} + >export function foo(greeting: string, n = 10, x?: string, ...restParams: string[]) + > { + > return; + > } + >:=> (line 39, col 4) to (line 42, col 5) +39 > export function foo(greeting: string, n = 10, x?: string, ...restParams: string[]) + + ~~~~~~~~~~~~~~~~~~~~=> Pos: (1051 to 1070) SpanInfo: {"start":1052,"length":6} + >n = 10 + >:=> (line 39, col 42) to (line 39, col 48) +39 > export function foo(greeting: string, n = 10, x?: string, ...restParams: string[]) + + ~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (1071 to 1096) SpanInfo: {"start":1072,"length":23} + >...restParams: string[] + >:=> (line 39, col 62) to (line 39, col 85) +-------------------------------- +40 > { + + ~~~~~~ => Pos: (1097 to 1102) SpanInfo: {"start":1111,"length":6} + >return + >:=> (line 41, col 8) to (line 41, col 14) +-------------------------------- +41 > return; + + ~~~~~~~~~~~~~~~~ => Pos: (1103 to 1118) SpanInfo: {"start":1111,"length":6} + >return + >:=> (line 41, col 8) to (line 41, col 14) +-------------------------------- +42 > } + + ~~~~~~ => Pos: (1119 to 1124) SpanInfo: {"start":1123,"length":1} + >} + >:=> (line 42, col 4) to (line 42, col 5) +-------------------------------- +43 >} + ~ => Pos: (1125 to 1125) SpanInfo: {"start":1125,"length":1} + >} + >:=> (line 43, col 0) to (line 43, col 1) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_ifElse.baseline b/tests/baselines/reference/bpSpan_ifElse.baseline new file mode 100644 index 00000000000..b66316d3392 --- /dev/null +++ b/tests/baselines/reference/bpSpan_ifElse.baseline @@ -0,0 +1,166 @@ + +1 >var i = 10; + + ~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":10} + >var i = 10 + >:=> (line 1, col 0) to (line 1, col 10) +-------------------------------- +2 >if (i == 10) { + + ~~~~~~~~~~~~~~~ => Pos: (12 to 26) SpanInfo: {"start":12,"length":12} + >if (i == 10) + >:=> (line 2, col 0) to (line 2, col 12) +-------------------------------- +3 > i++; + + ~~~~~~~~~ => Pos: (27 to 35) SpanInfo: {"start":31,"length":3} + >i++ + >:=> (line 3, col 4) to (line 3, col 7) +-------------------------------- +4 >} else + + ~ => Pos: (36 to 36) SpanInfo: {"start":31,"length":3} + >i++ + >:=> (line 3, col 4) to (line 3, col 7) +4 >} else + + ~~~~~~ => Pos: (37 to 42) SpanInfo: undefined +-------------------------------- +5 >{ + + ~~ => Pos: (43 to 44) SpanInfo: undefined +-------------------------------- +6 >} + + ~~ => Pos: (45 to 46) SpanInfo: undefined +-------------------------------- +7 >if (i == 10) + + ~~~~~~~~~~~~~ => Pos: (47 to 59) SpanInfo: {"start":47,"length":12} + >if (i == 10) + >:=> (line 7, col 0) to (line 7, col 12) +-------------------------------- +8 >{ + + ~~ => Pos: (60 to 61) SpanInfo: {"start":66,"length":3} + >i++ + >:=> (line 9, col 4) to (line 9, col 7) +-------------------------------- +9 > i++; + + ~~~~~~~~~ => Pos: (62 to 70) SpanInfo: {"start":66,"length":3} + >i++ + >:=> (line 9, col 4) to (line 9, col 7) +-------------------------------- +10 >} + + ~~ => Pos: (71 to 72) SpanInfo: {"start":66,"length":3} + >i++ + >:=> (line 9, col 4) to (line 9, col 7) +-------------------------------- +11 >else if (i == 20) { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (73 to 92) SpanInfo: {"start":78,"length":12} + >if (i == 20) + >:=> (line 11, col 5) to (line 11, col 17) +-------------------------------- +12 > i--; + + ~~~~~~~~~ => Pos: (93 to 101) SpanInfo: {"start":97,"length":3} + >i-- + >:=> (line 12, col 4) to (line 12, col 7) +-------------------------------- +13 >} else if (i == 30) { + + ~ => Pos: (102 to 102) SpanInfo: {"start":97,"length":3} + >i-- + >:=> (line 12, col 4) to (line 12, col 7) +13 >} else if (i == 30) { + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (103 to 123) SpanInfo: {"start":109,"length":12} + >if (i == 30) + >:=> (line 13, col 7) to (line 13, col 19) +-------------------------------- +14 > i += 70; + + ~~~~~~~~~~~~~ => Pos: (124 to 136) SpanInfo: {"start":128,"length":7} + >i += 70 + >:=> (line 14, col 4) to (line 14, col 11) +-------------------------------- +15 >} else { + + ~ => Pos: (137 to 137) SpanInfo: {"start":128,"length":7} + >i += 70 + >:=> (line 14, col 4) to (line 14, col 11) +15 >} else { + + ~~~~~~~~ => Pos: (138 to 145) SpanInfo: {"start":150,"length":3} + >i-- + >:=> (line 16, col 4) to (line 16, col 7) +-------------------------------- +16 > i--; + + ~~~~~~~~~ => Pos: (146 to 154) SpanInfo: {"start":150,"length":3} + >i-- + >:=> (line 16, col 4) to (line 16, col 7) +-------------------------------- +17 >} + + ~~ => Pos: (155 to 156) SpanInfo: {"start":150,"length":3} + >i-- + >:=> (line 16, col 4) to (line 16, col 7) +-------------------------------- +18 >if (function foo() { + + ~~~~ => Pos: (157 to 160) SpanInfo: {"start":157,"length":41} + >if (function foo() { + > return 30; + >} ()) + >:=> (line 18, col 0) to (line 20, col 5) +18 >if (function foo() { + + ~~~~~~~~~~~~~~~~~ => Pos: (161 to 177) SpanInfo: {"start":182,"length":9} + >return 30 + >:=> (line 19, col 4) to (line 19, col 13) +-------------------------------- +19 > return 30; + + ~~~~~~~~~~~~~~~ => Pos: (178 to 192) SpanInfo: {"start":182,"length":9} + >return 30 + >:=> (line 19, col 4) to (line 19, col 13) +-------------------------------- +20 >} ()) { + + ~ => Pos: (193 to 193) SpanInfo: {"start":193,"length":1} + >} + >:=> (line 20, col 0) to (line 20, col 1) +20 >} ()) { + + ~~~ => Pos: (194 to 196) SpanInfo: {"start":161,"length":36} + >function foo() { + > return 30; + >} () + >:=> (line 18, col 4) to (line 20, col 4) +20 >} ()) { + + ~ => Pos: (197 to 197) SpanInfo: {"start":157,"length":41} + >if (function foo() { + > return 30; + >} ()) + >:=> (line 18, col 0) to (line 20, col 5) +20 >} ()) { + + ~~~ => Pos: (198 to 200) SpanInfo: {"start":205,"length":3} + >i++ + >:=> (line 21, col 4) to (line 21, col 7) +-------------------------------- +21 > i++; + + ~~~~~~~~~ => Pos: (201 to 209) SpanInfo: {"start":205,"length":3} + >i++ + >:=> (line 21, col 4) to (line 21, col 7) +-------------------------------- +22 >} + ~ => Pos: (210 to 210) SpanInfo: {"start":205,"length":3} + >i++ + >:=> (line 21, col 4) to (line 21, col 7) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_import.baseline b/tests/baselines/reference/bpSpan_import.baseline new file mode 100644 index 00000000000..26279b48f26 --- /dev/null +++ b/tests/baselines/reference/bpSpan_import.baseline @@ -0,0 +1,60 @@ + +1 >module m { + + ~~~~~~~~~~~ => Pos: (0 to 10) SpanInfo: {"start":0,"length":32} + >module m { + > class c { + > } + >} + >:=> (line 1, col 0) to (line 4, col 1) +-------------------------------- +2 > class c { + + ~~~~~~~~~~~~~~ => Pos: (11 to 24) SpanInfo: {"start":15,"length":15} + >class c { + > } + >:=> (line 2, col 4) to (line 3, col 5) +-------------------------------- +3 > } + + ~~~~~~ => Pos: (25 to 30) SpanInfo: {"start":29,"length":1} + >} + >:=> (line 3, col 4) to (line 3, col 5) +-------------------------------- +4 >} + + ~~ => Pos: (31 to 32) SpanInfo: {"start":31,"length":1} + >} + >:=> (line 4, col 0) to (line 4, col 1) +-------------------------------- +5 >import a = m.c; + + ~~~~~~~~~~~~~~~~ => Pos: (33 to 48) SpanInfo: {"start":33,"length":14} + >import a = m.c + >:=> (line 5, col 0) to (line 5, col 14) +-------------------------------- +6 >export import b = m.c; + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (49 to 71) SpanInfo: {"start":49,"length":21} + >export import b = m.c + >:=> (line 6, col 0) to (line 6, col 21) +-------------------------------- +7 >var x = new a(); + + ~~~~~~~ => Pos: (72 to 78) SpanInfo: {"start":72,"length":15} + >var x = new a() + >:=> (line 7, col 0) to (line 7, col 15) +7 >var x = new a(); + + ~~~~~~~~~~ => Pos: (79 to 88) SpanInfo: {"start":80,"length":7} + >new a() + >:=> (line 7, col 8) to (line 7, col 15) +-------------------------------- +8 >var y = new b(); + ~~~~~~~ => Pos: (89 to 95) SpanInfo: {"start":89,"length":15} + >var y = new b() + >:=> (line 8, col 0) to (line 8, col 15) +8 >var y = new b(); + ~~~~~~~~~ => Pos: (96 to 104) SpanInfo: {"start":97,"length":7} + >new b() + >:=> (line 8, col 8) to (line 8, col 15) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_inBlankLine.baseline b/tests/baselines/reference/bpSpan_inBlankLine.baseline new file mode 100644 index 00000000000..40fe26a16a6 --- /dev/null +++ b/tests/baselines/reference/bpSpan_inBlankLine.baseline @@ -0,0 +1,15 @@ + +1 >var x = 10; + + ~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":10} + >var x = 10 + >:=> (line 1, col 0) to (line 1, col 10) +-------------------------------- +2 > + + ~ => Pos: (12 to 12) SpanInfo: undefined +-------------------------------- +3 >var y = 10; + ~~~~~~~~~~~ => Pos: (13 to 23) SpanInfo: {"start":13,"length":10} + >var y = 10 + >:=> (line 3, col 0) to (line 3, col 10) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_inComments.baseline b/tests/baselines/reference/bpSpan_inComments.baseline new file mode 100644 index 00000000000..5c167293513 --- /dev/null +++ b/tests/baselines/reference/bpSpan_inComments.baseline @@ -0,0 +1,19 @@ + +1 >/*comment here*/ var x = 10; /*comment here*/ + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (0 to 45) SpanInfo: {"start":17,"length":10} + >var x = 10 + >:=> (line 1, col 17) to (line 1, col 27) +-------------------------------- +2 >// comment only line + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (46 to 66) SpanInfo: undefined +-------------------------------- +3 >/*multiline comment + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (67 to 86) SpanInfo: undefined +-------------------------------- +4 >another line of multiline comment */ var y = 10; // comment here + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (87 to 150) SpanInfo: {"start":124,"length":10} + >var y = 10 + >:=> (line 4, col 37) to (line 4, col 47) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_interface.baseline b/tests/baselines/reference/bpSpan_interface.baseline new file mode 100644 index 00000000000..14e7921757d --- /dev/null +++ b/tests/baselines/reference/bpSpan_interface.baseline @@ -0,0 +1,91 @@ + +1 >interface I { + + ~~~~~~~~~~~~~~ => Pos: (0 to 13) SpanInfo: undefined +-------------------------------- +2 > property: string; + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (14 to 35) SpanInfo: undefined +-------------------------------- +3 > method(): number; + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (36 to 57) SpanInfo: undefined +-------------------------------- +4 > (a: string): string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (58 to 82) SpanInfo: undefined +-------------------------------- +5 > new (a: string): I; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (83 to 106) SpanInfo: undefined +-------------------------------- +6 > [a: number]: number; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (107 to 131) SpanInfo: undefined +-------------------------------- +7 >} + + ~~ => Pos: (132 to 133) SpanInfo: undefined +-------------------------------- +8 >module m { + + ~~~~~~~~~~~ => Pos: (134 to 144) SpanInfo: undefined +-------------------------------- +9 > interface I1 { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (145 to 163) SpanInfo: undefined +-------------------------------- +10 > property: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (164 to 189) SpanInfo: undefined +-------------------------------- +11 > method(): number; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (190 to 215) SpanInfo: undefined +-------------------------------- +12 > (a: string): string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (216 to 244) SpanInfo: undefined +-------------------------------- +13 > new (a: string): I; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (245 to 272) SpanInfo: undefined +-------------------------------- +14 > [a: number]: number; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (273 to 301) SpanInfo: undefined +-------------------------------- +15 > } + + ~~~~~~ => Pos: (302 to 307) SpanInfo: undefined +-------------------------------- +16 > export interface I2 { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (308 to 333) SpanInfo: undefined +-------------------------------- +17 > property: string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (334 to 359) SpanInfo: undefined +-------------------------------- +18 > method(): number; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (360 to 385) SpanInfo: undefined +-------------------------------- +19 > (a: string): string; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (386 to 414) SpanInfo: undefined +-------------------------------- +20 > new (a: string): I; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (415 to 442) SpanInfo: undefined +-------------------------------- +21 > [a: number]: number; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (443 to 471) SpanInfo: undefined +-------------------------------- +22 > } + + ~~~~~~ => Pos: (472 to 477) SpanInfo: undefined +-------------------------------- +23 >} + ~ => Pos: (478 to 478) SpanInfo: undefined \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_labeled.baseline b/tests/baselines/reference/bpSpan_labeled.baseline new file mode 100644 index 00000000000..8c2d23adedb --- /dev/null +++ b/tests/baselines/reference/bpSpan_labeled.baseline @@ -0,0 +1,11 @@ + +1 >x: + + ~~~ => Pos: (0 to 2) SpanInfo: {"start":3,"length":10} + >var b = 10 + >:=> (line 2, col 0) to (line 2, col 10) +-------------------------------- +2 >var b = 10; + ~~~~~~~~~~~ => Pos: (3 to 13) SpanInfo: {"start":3,"length":10} + >var b = 10 + >:=> (line 2, col 0) to (line 2, col 10) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_module.baseline b/tests/baselines/reference/bpSpan_module.baseline new file mode 100644 index 00000000000..14145512658 --- /dev/null +++ b/tests/baselines/reference/bpSpan_module.baseline @@ -0,0 +1,234 @@ + +1 >module m2 { + + ~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":38} + >module m2 { + > var a = 10; + > a++; + >} + >:=> (line 1, col 0) to (line 4, col 1) +-------------------------------- +2 > var a = 10; + + ~~~~~~~~~~~~~~~~ => Pos: (12 to 27) SpanInfo: {"start":16,"length":10} + >var a = 10 + >:=> (line 2, col 4) to (line 2, col 14) +-------------------------------- +3 > a++; + + ~~~~~~~~~ => Pos: (28 to 36) SpanInfo: {"start":32,"length":3} + >a++ + >:=> (line 3, col 4) to (line 3, col 7) +-------------------------------- +4 >} + + ~~ => Pos: (37 to 38) SpanInfo: {"start":37,"length":1} + >} + >:=> (line 4, col 0) to (line 4, col 1) +-------------------------------- +5 >module m3 { + + ~~~~~~~~~~~~ => Pos: (39 to 50) SpanInfo: {"start":39,"length":118} + >module m3 { + > module m4 { + > export var x = 30; + > } + > + > export function foo() { + > return m4.x; + > } + >} + >:=> (line 5, col 0) to (line 13, col 1) +-------------------------------- +6 > module m4 { + + ~~~~~~~~~~~~~~~~ => Pos: (51 to 66) SpanInfo: {"start":55,"length":44} + >module m4 { + > export var x = 30; + > } + >:=> (line 6, col 4) to (line 8, col 5) +-------------------------------- +7 > export var x = 30; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (67 to 93) SpanInfo: {"start":75,"length":17} + >export var x = 30 + >:=> (line 7, col 8) to (line 7, col 25) +-------------------------------- +8 > } + + ~~~~~~ => Pos: (94 to 99) SpanInfo: {"start":98,"length":1} + >} + >:=> (line 8, col 4) to (line 8, col 5) +-------------------------------- +9 > + + ~ => Pos: (100 to 100) SpanInfo: undefined +-------------------------------- +10 > export function foo() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (101 to 128) SpanInfo: {"start":105,"length":50} + >export function foo() { + > return m4.x; + > } + >:=> (line 10, col 4) to (line 12, col 5) +-------------------------------- +11 > return m4.x; + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (129 to 149) SpanInfo: {"start":137,"length":11} + >return m4.x + >:=> (line 11, col 8) to (line 11, col 19) +-------------------------------- +12 > } + + ~~~~~~ => Pos: (150 to 155) SpanInfo: {"start":154,"length":1} + >} + >:=> (line 12, col 4) to (line 12, col 5) +-------------------------------- +13 >} + + ~~ => Pos: (156 to 157) SpanInfo: {"start":156,"length":1} + >} + >:=> (line 13, col 0) to (line 13, col 1) +-------------------------------- +14 >module m4 { + + ~~~~~~~~~~~~ => Pos: (158 to 169) SpanInfo: undefined +-------------------------------- +15 > interface I { } + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (170 to 189) SpanInfo: undefined +-------------------------------- +16 >} + + ~~ => Pos: (190 to 191) SpanInfo: undefined +-------------------------------- +17 >module m12 + + ~~~~~~~~~~~ => Pos: (192 to 202) SpanInfo: {"start":192,"length":39} + >module m12 + >{ + > var a = 10; + > a++; + >} + >:=> (line 17, col 0) to (line 21, col 1) +-------------------------------- +18 >{ + + ~~ => Pos: (203 to 204) SpanInfo: {"start":209,"length":10} + >var a = 10 + >:=> (line 19, col 4) to (line 19, col 14) +-------------------------------- +19 > var a = 10; + + ~~~~~~~~~~~~~~~~ => Pos: (205 to 220) SpanInfo: {"start":209,"length":10} + >var a = 10 + >:=> (line 19, col 4) to (line 19, col 14) +-------------------------------- +20 > a++; + + ~~~~~~~~~ => Pos: (221 to 229) SpanInfo: {"start":225,"length":3} + >a++ + >:=> (line 20, col 4) to (line 20, col 7) +-------------------------------- +21 >} + + ~~ => Pos: (230 to 231) SpanInfo: {"start":230,"length":1} + >} + >:=> (line 21, col 0) to (line 21, col 1) +-------------------------------- +22 >module m13 + + ~~~~~~~~~~~ => Pos: (232 to 242) SpanInfo: {"start":232,"length":125} + >module m13 + >{ + > module m14 + > { + > export var x = 30; + > } + > + > export function foo() { + > return m4.x; + > } + >} + >:=> (line 22, col 0) to (line 32, col 1) +-------------------------------- +23 >{ + + ~~ => Pos: (243 to 244) SpanInfo: {"start":249,"length":50} + >module m14 + > { + > export var x = 30; + > } + >:=> (line 24, col 4) to (line 27, col 5) +-------------------------------- +24 > module m14 + + ~~~~~~~~~~~~~~~~ => Pos: (245 to 260) SpanInfo: {"start":249,"length":50} + >module m14 + > { + > export var x = 30; + > } + >:=> (line 24, col 4) to (line 27, col 5) +-------------------------------- +25 > { + + ~~~~~~ => Pos: (261 to 266) SpanInfo: {"start":275,"length":17} + >export var x = 30 + >:=> (line 26, col 8) to (line 26, col 25) +-------------------------------- +26 > export var x = 30; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (267 to 293) SpanInfo: {"start":275,"length":17} + >export var x = 30 + >:=> (line 26, col 8) to (line 26, col 25) +-------------------------------- +27 > } + + ~~~~~~ => Pos: (294 to 299) SpanInfo: {"start":298,"length":1} + >} + >:=> (line 27, col 4) to (line 27, col 5) +-------------------------------- +28 > + + ~ => Pos: (300 to 300) SpanInfo: undefined +-------------------------------- +29 > export function foo() { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (301 to 328) SpanInfo: {"start":305,"length":50} + >export function foo() { + > return m4.x; + > } + >:=> (line 29, col 4) to (line 31, col 5) +-------------------------------- +30 > return m4.x; + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (329 to 349) SpanInfo: {"start":337,"length":11} + >return m4.x + >:=> (line 30, col 8) to (line 30, col 19) +-------------------------------- +31 > } + + ~~~~~~ => Pos: (350 to 355) SpanInfo: {"start":354,"length":1} + >} + >:=> (line 31, col 4) to (line 31, col 5) +-------------------------------- +32 >} + + ~~ => Pos: (356 to 357) SpanInfo: {"start":356,"length":1} + >} + >:=> (line 32, col 0) to (line 32, col 1) +-------------------------------- +33 >module m14 + + ~~~~~~~~~~~~ => Pos: (358 to 369) SpanInfo: undefined +-------------------------------- +34 >{ + + ~~ => Pos: (370 to 371) SpanInfo: undefined +-------------------------------- +35 > interface I { } + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (372 to 391) SpanInfo: undefined +-------------------------------- +36 >} + ~ => Pos: (392 to 392) SpanInfo: undefined \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_moduleAmbient.baseline b/tests/baselines/reference/bpSpan_moduleAmbient.baseline new file mode 100644 index 00000000000..8ea705dc09f --- /dev/null +++ b/tests/baselines/reference/bpSpan_moduleAmbient.baseline @@ -0,0 +1,19 @@ + +1 >declare module Bar { + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 20) SpanInfo: undefined +-------------------------------- +2 >} + + ~~ => Pos: (21 to 22) SpanInfo: undefined +-------------------------------- +3 >declare module Foo { + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (23 to 43) SpanInfo: undefined +-------------------------------- +4 > var x; + + ~~~~~~~~~~~ => Pos: (44 to 54) SpanInfo: undefined +-------------------------------- +5 >} + ~ => Pos: (55 to 55) SpanInfo: undefined \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_moduleEmpty.baseline b/tests/baselines/reference/bpSpan_moduleEmpty.baseline new file mode 100644 index 00000000000..3139d4603d2 --- /dev/null +++ b/tests/baselines/reference/bpSpan_moduleEmpty.baseline @@ -0,0 +1,7 @@ + +1 >module Bar { + + ~~~~~~~~~~~~~ => Pos: (0 to 12) SpanInfo: undefined +-------------------------------- +2 >} + ~ => Pos: (13 to 13) SpanInfo: undefined \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_objectLiteralExpressions.baseline b/tests/baselines/reference/bpSpan_objectLiteralExpressions.baseline new file mode 100644 index 00000000000..0d864a9b1bd --- /dev/null +++ b/tests/baselines/reference/bpSpan_objectLiteralExpressions.baseline @@ -0,0 +1,233 @@ + +1 >var x = { + + ~~~~~~~~~~ => Pos: (0 to 9) SpanInfo: {"start":0,"length":179} + >var x = { + > a: 10, + > b: () => 10, + > someMethod() { + > return "Hello"; + > }, + > get y() { + > return 30; + > }, + > set z(x: number) { + > var bar = x; + > } + >} + >:=> (line 1, col 0) to (line 13, col 1) +-------------------------------- +2 > a: 10, + + ~~~~~~~~~~~ => Pos: (10 to 20) SpanInfo: {"start":0,"length":179} + >var x = { + > a: 10, + > b: () => 10, + > someMethod() { + > return "Hello"; + > }, + > get y() { + > return 30; + > }, + > set z(x: number) { + > var bar = x; + > } + >} + >:=> (line 1, col 0) to (line 13, col 1) +-------------------------------- +3 > b: () => 10, + + ~~~~~~~~~~~~~~~~~ => Pos: (21 to 37) SpanInfo: {"start":34,"length":2} + >10 + >:=> (line 3, col 13) to (line 3, col 15) +-------------------------------- +4 > someMethod() { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (38 to 56) SpanInfo: {"start":65,"length":14} + >return "Hello" + >:=> (line 5, col 8) to (line 5, col 22) +-------------------------------- +5 > return "Hello"; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (57 to 80) SpanInfo: {"start":65,"length":14} + >return "Hello" + >:=> (line 5, col 8) to (line 5, col 22) +-------------------------------- +6 > }, + + ~~~~~~~ => Pos: (81 to 87) SpanInfo: {"start":85,"length":1} + >} + >:=> (line 6, col 4) to (line 6, col 5) +-------------------------------- +7 > get y() { + + ~~~~~~~~~~~~~~ => Pos: (88 to 101) SpanInfo: {"start":110,"length":9} + >return 30 + >:=> (line 8, col 8) to (line 8, col 17) +-------------------------------- +8 > return 30; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (102 to 120) SpanInfo: {"start":110,"length":9} + >return 30 + >:=> (line 8, col 8) to (line 8, col 17) +-------------------------------- +9 > }, + + ~~~~~~~ => Pos: (121 to 127) SpanInfo: {"start":125,"length":1} + >} + >:=> (line 9, col 4) to (line 9, col 5) +-------------------------------- +10 > set z(x: number) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (128 to 150) SpanInfo: {"start":159,"length":11} + >var bar = x + >:=> (line 11, col 8) to (line 11, col 19) +-------------------------------- +11 > var bar = x; + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (151 to 171) SpanInfo: {"start":159,"length":11} + >var bar = x + >:=> (line 11, col 8) to (line 11, col 19) +-------------------------------- +12 > } + + ~~~~~~ => Pos: (172 to 177) SpanInfo: {"start":176,"length":1} + >} + >:=> (line 12, col 4) to (line 12, col 5) +-------------------------------- +13 >}; + + ~~~ => Pos: (178 to 180) SpanInfo: {"start":0,"length":179} + >var x = { + > a: 10, + > b: () => 10, + > someMethod() { + > return "Hello"; + > }, + > get y() { + > return 30; + > }, + > set z(x: number) { + > var bar = x; + > } + >} + >:=> (line 1, col 0) to (line 13, col 1) +-------------------------------- +14 >var a = ({ + + ~~~~~~~~~~~ => Pos: (181 to 191) SpanInfo: {"start":181,"length":192} + >var a = ({ + > a: 10, + > b: () => 10, + > someMethod() { + > return "Hello"; + > }, + > get y() { + > return 30; + > }, + > set z(x: number) { + > var bar = x; + > } + >}).someMethod + >:=> (line 14, col 0) to (line 26, col 13) +-------------------------------- +15 > a: 10, + + ~~~~~~~~~~~ => Pos: (192 to 202) SpanInfo: {"start":181,"length":192} + >var a = ({ + > a: 10, + > b: () => 10, + > someMethod() { + > return "Hello"; + > }, + > get y() { + > return 30; + > }, + > set z(x: number) { + > var bar = x; + > } + >}).someMethod + >:=> (line 14, col 0) to (line 26, col 13) +-------------------------------- +16 > b: () => 10, + + ~~~~~~~~~~~~~~~~~ => Pos: (203 to 219) SpanInfo: {"start":216,"length":2} + >10 + >:=> (line 16, col 13) to (line 16, col 15) +-------------------------------- +17 > someMethod() { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (220 to 238) SpanInfo: {"start":247,"length":14} + >return "Hello" + >:=> (line 18, col 8) to (line 18, col 22) +-------------------------------- +18 > return "Hello"; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (239 to 262) SpanInfo: {"start":247,"length":14} + >return "Hello" + >:=> (line 18, col 8) to (line 18, col 22) +-------------------------------- +19 > }, + + ~~~~~~~ => Pos: (263 to 269) SpanInfo: {"start":267,"length":1} + >} + >:=> (line 19, col 4) to (line 19, col 5) +-------------------------------- +20 > get y() { + + ~~~~~~~~~~~~~~ => Pos: (270 to 283) SpanInfo: {"start":292,"length":9} + >return 30 + >:=> (line 21, col 8) to (line 21, col 17) +-------------------------------- +21 > return 30; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (284 to 302) SpanInfo: {"start":292,"length":9} + >return 30 + >:=> (line 21, col 8) to (line 21, col 17) +-------------------------------- +22 > }, + + ~~~~~~~ => Pos: (303 to 309) SpanInfo: {"start":307,"length":1} + >} + >:=> (line 22, col 4) to (line 22, col 5) +-------------------------------- +23 > set z(x: number) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (310 to 332) SpanInfo: {"start":341,"length":11} + >var bar = x + >:=> (line 24, col 8) to (line 24, col 19) +-------------------------------- +24 > var bar = x; + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (333 to 353) SpanInfo: {"start":341,"length":11} + >var bar = x + >:=> (line 24, col 8) to (line 24, col 19) +-------------------------------- +25 > } + + ~~~~~~ => Pos: (354 to 359) SpanInfo: {"start":358,"length":1} + >} + >:=> (line 25, col 4) to (line 25, col 5) +-------------------------------- +26 >}).someMethod; + + ~~~~~~~~~~~~~~~ => Pos: (360 to 374) SpanInfo: {"start":181,"length":192} + >var a = ({ + > a: 10, + > b: () => 10, + > someMethod() { + > return "Hello"; + > }, + > get y() { + > return 30; + > }, + > set z(x: number) { + > var bar = x; + > } + >}).someMethod + >:=> (line 14, col 0) to (line 26, col 13) +-------------------------------- +27 >a(); + ~~~~ => Pos: (375 to 378) SpanInfo: {"start":375,"length":3} + >a() + >:=> (line 27, col 0) to (line 27, col 3) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_parenCallOrNewExpressions.baseline b/tests/baselines/reference/bpSpan_parenCallOrNewExpressions.baseline new file mode 100644 index 00000000000..47c932640f9 --- /dev/null +++ b/tests/baselines/reference/bpSpan_parenCallOrNewExpressions.baseline @@ -0,0 +1,364 @@ + +1 >function foo(a: number) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 25) SpanInfo: {"start":30,"length":8} + >return a + >:=> (line 2, col 4) to (line 2, col 12) +-------------------------------- +2 > return a; + + ~~~~~~~~~~~~~~ => Pos: (26 to 39) SpanInfo: {"start":30,"length":8} + >return a + >:=> (line 2, col 4) to (line 2, col 12) +-------------------------------- +3 >} + + ~~ => Pos: (40 to 41) SpanInfo: {"start":40,"length":1} + >} + >:=> (line 3, col 0) to (line 3, col 1) +-------------------------------- +4 >foo((function bar() { + + ~~~~ => Pos: (42 to 45) SpanInfo: {"start":42,"length":47} + >foo((function bar() { + > return foo(40); + >})()) + >:=> (line 4, col 0) to (line 6, col 5) +4 >foo((function bar() { + + ~ => Pos: (46 to 46) SpanInfo: {"start":46,"length":42} + >(function bar() { + > return foo(40); + >})() + >:=> (line 4, col 4) to (line 6, col 4) +4 >foo((function bar() { + + ~~~~~~~~~~~~~~~~~ => Pos: (47 to 63) SpanInfo: {"start":68,"length":14} + >return foo(40) + >:=> (line 5, col 4) to (line 5, col 18) +-------------------------------- +5 > return foo(40); + + ~~~~~~~~~~ => Pos: (64 to 73) SpanInfo: {"start":68,"length":14} + >return foo(40) + >:=> (line 5, col 4) to (line 5, col 18) +5 > return foo(40); + + ~~~~~~~~~~ => Pos: (74 to 83) SpanInfo: {"start":75,"length":7} + >foo(40) + >:=> (line 5, col 11) to (line 5, col 18) +-------------------------------- +6 >})()); + + ~ => Pos: (84 to 84) SpanInfo: {"start":84,"length":1} + >} + >:=> (line 6, col 0) to (line 6, col 1) +6 >})()); + + ~~~ => Pos: (85 to 87) SpanInfo: {"start":46,"length":42} + >(function bar() { + > return foo(40); + >})() + >:=> (line 4, col 4) to (line 6, col 4) +6 >})()); + + ~~~ => Pos: (88 to 90) SpanInfo: {"start":42,"length":47} + >foo((function bar() { + > return foo(40); + >})()) + >:=> (line 4, col 0) to (line 6, col 5) +-------------------------------- +7 >var y = foo((function () { + + ~~~~~~~ => Pos: (91 to 97) SpanInfo: {"start":91,"length":52} + >var y = foo((function () { + > return foo(40); + >})()) + >:=> (line 7, col 0) to (line 9, col 5) +7 >var y = foo((function () { + + ~~~~~ => Pos: (98 to 102) SpanInfo: {"start":99,"length":44} + >foo((function () { + > return foo(40); + >})()) + >:=> (line 7, col 8) to (line 9, col 5) +7 >var y = foo((function () { + + ~ => Pos: (103 to 103) SpanInfo: {"start":103,"length":39} + >(function () { + > return foo(40); + >})() + >:=> (line 7, col 12) to (line 9, col 4) +7 >var y = foo((function () { + + ~~~~~~~~~~~~~~ => Pos: (104 to 117) SpanInfo: {"start":122,"length":14} + >return foo(40) + >:=> (line 8, col 4) to (line 8, col 18) +-------------------------------- +8 > return foo(40); + + ~~~~~~~~~~ => Pos: (118 to 127) SpanInfo: {"start":122,"length":14} + >return foo(40) + >:=> (line 8, col 4) to (line 8, col 18) +8 > return foo(40); + + ~~~~~~~~~~ => Pos: (128 to 137) SpanInfo: {"start":129,"length":7} + >foo(40) + >:=> (line 8, col 11) to (line 8, col 18) +-------------------------------- +9 >})());; + + ~ => Pos: (138 to 138) SpanInfo: {"start":138,"length":1} + >} + >:=> (line 9, col 0) to (line 9, col 1) +9 >})());; + + ~~~ => Pos: (139 to 141) SpanInfo: {"start":103,"length":39} + >(function () { + > return foo(40); + >})() + >:=> (line 7, col 12) to (line 9, col 4) +9 >})());; + + ~~~~ => Pos: (142 to 145) SpanInfo: {"start":99,"length":44} + >foo((function () { + > return foo(40); + >})()) + >:=> (line 7, col 8) to (line 9, col 5) +-------------------------------- +10 >class greeter { + + ~~~~~~~~~~~~~~~~ => Pos: (146 to 161) SpanInfo: {"start":146,"length":52} + >class greeter { + > constructor(a: number) { + > } + >} + >:=> (line 10, col 0) to (line 13, col 1) +-------------------------------- +11 > constructor(a: number) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (162 to 190) SpanInfo: {"start":195,"length":1} + >} + >:=> (line 12, col 4) to (line 12, col 5) +-------------------------------- +12 > } + + ~~~~~~ => Pos: (191 to 196) SpanInfo: {"start":195,"length":1} + >} + >:=> (line 12, col 4) to (line 12, col 5) +-------------------------------- +13 >} + + ~~ => Pos: (197 to 198) SpanInfo: {"start":197,"length":1} + >} + >:=> (line 13, col 0) to (line 13, col 1) +-------------------------------- +14 >foo(30); + + ~~~~~~~~~ => Pos: (199 to 207) SpanInfo: {"start":199,"length":7} + >foo(30) + >:=> (line 14, col 0) to (line 14, col 7) +-------------------------------- +15 >foo(40 + y); + + ~~~~~~~~~~~~~ => Pos: (208 to 220) SpanInfo: {"start":208,"length":11} + >foo(40 + y) + >:=> (line 15, col 0) to (line 15, col 11) +-------------------------------- +16 >y = foo(30); + + ~~~ => Pos: (221 to 223) SpanInfo: {"start":221,"length":11} + >y = foo(30) + >:=> (line 16, col 0) to (line 16, col 11) +16 >y = foo(30); + + ~~~~~~~~~~ => Pos: (224 to 233) SpanInfo: {"start":225,"length":7} + >foo(30) + >:=> (line 16, col 4) to (line 16, col 11) +-------------------------------- +17 >y = foo(500 + y); + + ~~~ => Pos: (234 to 236) SpanInfo: {"start":234,"length":16} + >y = foo(500 + y) + >:=> (line 17, col 0) to (line 17, col 16) +17 >y = foo(500 + y); + + ~~~~~~~~~~~~~~~ => Pos: (237 to 251) SpanInfo: {"start":238,"length":12} + >foo(500 + y) + >:=> (line 17, col 4) to (line 17, col 16) +-------------------------------- +18 >new greeter((function bar() { + + ~~~~~~~~~~~~ => Pos: (252 to 263) SpanInfo: {"start":252,"length":55} + >new greeter((function bar() { + > return foo(40); + >})()) + >:=> (line 18, col 0) to (line 20, col 5) +18 >new greeter((function bar() { + + ~ => Pos: (264 to 264) SpanInfo: {"start":264,"length":42} + >(function bar() { + > return foo(40); + >})() + >:=> (line 18, col 12) to (line 20, col 4) +18 >new greeter((function bar() { + + ~~~~~~~~~~~~~~~~~ => Pos: (265 to 281) SpanInfo: {"start":286,"length":14} + >return foo(40) + >:=> (line 19, col 4) to (line 19, col 18) +-------------------------------- +19 > return foo(40); + + ~~~~~~~~~~ => Pos: (282 to 291) SpanInfo: {"start":286,"length":14} + >return foo(40) + >:=> (line 19, col 4) to (line 19, col 18) +19 > return foo(40); + + ~~~~~~~~~~ => Pos: (292 to 301) SpanInfo: {"start":293,"length":7} + >foo(40) + >:=> (line 19, col 11) to (line 19, col 18) +-------------------------------- +20 >})()); + + ~ => Pos: (302 to 302) SpanInfo: {"start":302,"length":1} + >} + >:=> (line 20, col 0) to (line 20, col 1) +20 >})()); + + ~~~ => Pos: (303 to 305) SpanInfo: {"start":264,"length":42} + >(function bar() { + > return foo(40); + >})() + >:=> (line 18, col 12) to (line 20, col 4) +20 >})()); + + ~~~ => Pos: (306 to 308) SpanInfo: {"start":252,"length":55} + >new greeter((function bar() { + > return foo(40); + >})()) + >:=> (line 18, col 0) to (line 20, col 5) +-------------------------------- +21 >var anotherGreeter = new greeter((function bar() { + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (309 to 328) SpanInfo: {"start":309,"length":76} + >var anotherGreeter = new greeter((function bar() { + > return foo(40); + >})()) + >:=> (line 21, col 0) to (line 23, col 5) +21 >var anotherGreeter = new greeter((function bar() { + + ~~~~~~~~~~~~~ => Pos: (329 to 341) SpanInfo: {"start":330,"length":55} + >new greeter((function bar() { + > return foo(40); + >})()) + >:=> (line 21, col 21) to (line 23, col 5) +21 >var anotherGreeter = new greeter((function bar() { + + ~ => Pos: (342 to 342) SpanInfo: {"start":342,"length":42} + >(function bar() { + > return foo(40); + >})() + >:=> (line 21, col 33) to (line 23, col 4) +21 >var anotherGreeter = new greeter((function bar() { + + ~~~~~~~~~~~~~~~~~=> Pos: (343 to 359) SpanInfo: {"start":364,"length":14} + >return foo(40) + >:=> (line 22, col 4) to (line 22, col 18) +-------------------------------- +22 > return foo(40); + + ~~~~~~~~~~ => Pos: (360 to 369) SpanInfo: {"start":364,"length":14} + >return foo(40) + >:=> (line 22, col 4) to (line 22, col 18) +22 > return foo(40); + + ~~~~~~~~~~ => Pos: (370 to 379) SpanInfo: {"start":371,"length":7} + >foo(40) + >:=> (line 22, col 11) to (line 22, col 18) +-------------------------------- +23 >})()); + + ~ => Pos: (380 to 380) SpanInfo: {"start":380,"length":1} + >} + >:=> (line 23, col 0) to (line 23, col 1) +23 >})()); + + ~~~ => Pos: (381 to 383) SpanInfo: {"start":342,"length":42} + >(function bar() { + > return foo(40); + >})() + >:=> (line 21, col 33) to (line 23, col 4) +23 >})()); + + ~~~ => Pos: (384 to 386) SpanInfo: {"start":330,"length":55} + >new greeter((function bar() { + > return foo(40); + >})()) + >:=> (line 21, col 21) to (line 23, col 5) +-------------------------------- +24 >anotherGreeter = new greeter(30); + + ~~~~~~~~~~~~~~~~ => Pos: (387 to 402) SpanInfo: {"start":387,"length":32} + >anotherGreeter = new greeter(30) + >:=> (line 24, col 0) to (line 24, col 32) +24 >anotherGreeter = new greeter(30); + + ~~~~~~~~~~~~~~~~~~ => Pos: (403 to 420) SpanInfo: {"start":404,"length":15} + >new greeter(30) + >:=> (line 24, col 17) to (line 24, col 32) +-------------------------------- +25 >anotherGreeter = new greeter(40 + y); + + ~~~~~~~~~~~~~~~~ => Pos: (421 to 436) SpanInfo: {"start":421,"length":36} + >anotherGreeter = new greeter(40 + y) + >:=> (line 25, col 0) to (line 25, col 36) +25 >anotherGreeter = new greeter(40 + y); + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (437 to 458) SpanInfo: {"start":438,"length":19} + >new greeter(40 + y) + >:=> (line 25, col 17) to (line 25, col 36) +-------------------------------- +26 >new greeter(30); + + ~~~~~~~~~~~~~~~~~ => Pos: (459 to 475) SpanInfo: {"start":459,"length":15} + >new greeter(30) + >:=> (line 26, col 0) to (line 26, col 15) +-------------------------------- +27 >new greeter(40 + y); + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (476 to 496) SpanInfo: {"start":476,"length":19} + >new greeter(40 + y) + >:=> (line 27, col 0) to (line 27, col 19) +-------------------------------- +28 >function foo2(x: number, y: string) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (497 to 534) SpanInfo: {"start":535,"length":1} + >} + >:=> (line 29, col 0) to (line 29, col 1) +-------------------------------- +29 >} + + ~~ => Pos: (535 to 536) SpanInfo: {"start":535,"length":1} + >} + >:=> (line 29, col 0) to (line 29, col 1) +-------------------------------- +30 >foo2(foo(30), foo(40).toString()); + ~~~~~ => Pos: (537 to 541) SpanInfo: {"start":537,"length":33} + >foo2(foo(30), foo(40).toString()) + >:=> (line 30, col 0) to (line 30, col 33) +30 >foo2(foo(30), foo(40).toString()); + ~~~~~~~~ => Pos: (542 to 549) SpanInfo: {"start":542,"length":7} + >foo(30) + >:=> (line 30, col 5) to (line 30, col 12) +30 >foo2(foo(30), foo(40).toString()); + ~~~~~~~~ => Pos: (550 to 557) SpanInfo: {"start":551,"length":7} + >foo(40) + >:=> (line 30, col 14) to (line 30, col 21) +30 >foo2(foo(30), foo(40).toString()); + ~~~~~~~~~~~ => Pos: (558 to 568) SpanInfo: {"start":551,"length":18} + >foo(40).toString() + >:=> (line 30, col 14) to (line 30, col 32) +30 >foo2(foo(30), foo(40).toString()); + ~~ => Pos: (569 to 570) SpanInfo: {"start":537,"length":33} + >foo2(foo(30), foo(40).toString()) + >:=> (line 30, col 0) to (line 30, col 33) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_stmts.baseline b/tests/baselines/reference/bpSpan_stmts.baseline new file mode 100644 index 00000000000..a81559ee9a5 --- /dev/null +++ b/tests/baselines/reference/bpSpan_stmts.baseline @@ -0,0 +1,572 @@ + +1 >function f() { + + ~~~~~~~~~~~~~~~ => Pos: (0 to 14) SpanInfo: undefined +-------------------------------- +2 > var y; + + ~~~~~~~~~~~ => Pos: (15 to 25) SpanInfo: undefined +-------------------------------- +3 > var x = 0; + + ~~~~~~~~~~~~~~~ => Pos: (26 to 40) SpanInfo: {"start":30,"length":9} + >var x = 0 + >:=> (line 3, col 4) to (line 3, col 13) +-------------------------------- +4 > for (var i = 0; i < 10; i++) { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (41 to 59) SpanInfo: {"start":50,"length":9} + >var i = 0 + >:=> (line 4, col 9) to (line 4, col 18) +4 > for (var i = 0; i < 10; i++) { + + ~~~~~~~~ => Pos: (60 to 67) SpanInfo: {"start":61,"length":6} + >i < 10 + >:=> (line 4, col 20) to (line 4, col 26) +4 > for (var i = 0; i < 10; i++) { + + ~~~~~~~~ => Pos: (68 to 75) SpanInfo: {"start":69,"length":3} + >i++ + >:=> (line 4, col 28) to (line 4, col 31) +-------------------------------- +5 > x += i; + + ~~~~~~~~~~~~~~~~ => Pos: (76 to 91) SpanInfo: {"start":84,"length":6} + >x += i + >:=> (line 5, col 8) to (line 5, col 14) +-------------------------------- +6 > x *= 0; + + ~~~~~~~~~~~~~~~~ => Pos: (92 to 107) SpanInfo: {"start":100,"length":6} + >x *= 0 + >:=> (line 6, col 8) to (line 6, col 14) +-------------------------------- +7 > } + + ~~~~~~ => Pos: (108 to 113) SpanInfo: {"start":100,"length":6} + >x *= 0 + >:=> (line 6, col 8) to (line 6, col 14) +-------------------------------- +8 > if (x > 17) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (114 to 131) SpanInfo: {"start":118,"length":11} + >if (x > 17) + >:=> (line 8, col 4) to (line 8, col 15) +-------------------------------- +9 > x /= 9; + + ~~~~~~~~~~~~~~~~ => Pos: (132 to 147) SpanInfo: {"start":140,"length":6} + >x /= 9 + >:=> (line 9, col 8) to (line 9, col 14) +-------------------------------- +10 > } else { + + ~~~~~ => Pos: (148 to 152) SpanInfo: {"start":140,"length":6} + >x /= 9 + >:=> (line 9, col 8) to (line 9, col 14) +10 > } else { + + ~~~~~~~~ => Pos: (153 to 160) SpanInfo: {"start":169,"length":7} + >x += 10 + >:=> (line 11, col 8) to (line 11, col 15) +-------------------------------- +11 > x += 10; + + ~~~~~~~~~~~~~~~~~ => Pos: (161 to 177) SpanInfo: {"start":169,"length":7} + >x += 10 + >:=> (line 11, col 8) to (line 11, col 15) +-------------------------------- +12 > x++; + + ~~~~~~~~~~~~~ => Pos: (178 to 190) SpanInfo: {"start":186,"length":3} + >x++ + >:=> (line 12, col 8) to (line 12, col 11) +-------------------------------- +13 > } + + ~~~~~~ => Pos: (191 to 196) SpanInfo: {"start":186,"length":3} + >x++ + >:=> (line 12, col 8) to (line 12, col 11) +-------------------------------- +14 > var a = [ + + ~~~~~~~~~~~~~~ => Pos: (197 to 210) SpanInfo: {"start":201,"length":47} + >var a = [ + > 1, + > 2, + > 3 + > ] + >:=> (line 14, col 4) to (line 18, col 5) +-------------------------------- +15 > 1, + + ~~~~~~~~~~~ => Pos: (211 to 221) SpanInfo: {"start":201,"length":47} + >var a = [ + > 1, + > 2, + > 3 + > ] + >:=> (line 14, col 4) to (line 18, col 5) +-------------------------------- +16 > 2, + + ~~~~~~~~~~~ => Pos: (222 to 232) SpanInfo: {"start":201,"length":47} + >var a = [ + > 1, + > 2, + > 3 + > ] + >:=> (line 14, col 4) to (line 18, col 5) +-------------------------------- +17 > 3 + + ~~~~~~~~~~ => Pos: (233 to 242) SpanInfo: {"start":201,"length":47} + >var a = [ + > 1, + > 2, + > 3 + > ] + >:=> (line 14, col 4) to (line 18, col 5) +-------------------------------- +18 > ]; + + ~~~~~~~ => Pos: (243 to 249) SpanInfo: {"start":201,"length":47} + >var a = [ + > 1, + > 2, + > 3 + > ] + >:=> (line 14, col 4) to (line 18, col 5) +-------------------------------- +19 > var obj = { + + ~~~~~~~~~~~~~~~~ => Pos: (250 to 265) SpanInfo: {"start":254,"length":50} + >var obj = { + > z: 1, + > q: "hello" + > } + >:=> (line 19, col 4) to (line 22, col 5) +-------------------------------- +20 > z: 1, + + ~~~~~~~~~~~~~~ => Pos: (266 to 279) SpanInfo: {"start":254,"length":50} + >var obj = { + > z: 1, + > q: "hello" + > } + >:=> (line 19, col 4) to (line 22, col 5) +-------------------------------- +21 > q: "hello" + + ~~~~~~~~~~~~~~~~~~~ => Pos: (280 to 298) SpanInfo: {"start":254,"length":50} + >var obj = { + > z: 1, + > q: "hello" + > } + >:=> (line 19, col 4) to (line 22, col 5) +-------------------------------- +22 > }; + + ~~~~~~~ => Pos: (299 to 305) SpanInfo: {"start":254,"length":50} + >var obj = { + > z: 1, + > q: "hello" + > } + >:=> (line 19, col 4) to (line 22, col 5) +-------------------------------- +23 > for (var j in a) { + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (306 to 328) SpanInfo: {"start":310,"length":16} + >for (var j in a) + >:=> (line 23, col 4) to (line 23, col 20) +-------------------------------- +24 > obj.z = a[j]; + + ~~~~~~~~~~~~~~~~~~~~~~ => Pos: (329 to 350) SpanInfo: {"start":337,"length":12} + >obj.z = a[j] + >:=> (line 24, col 8) to (line 24, col 20) +-------------------------------- +25 > var v = 10; + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (351 to 370) SpanInfo: {"start":359,"length":10} + >var v = 10 + >:=> (line 25, col 8) to (line 25, col 18) +-------------------------------- +26 > } + + ~~~~~~ => Pos: (371 to 376) SpanInfo: {"start":359,"length":10} + >var v = 10 + >:=> (line 25, col 8) to (line 25, col 18) +-------------------------------- +27 > try { + + ~~~~~~~~~~ => Pos: (377 to 386) SpanInfo: {"start":395,"length":14} + >obj.q = "ohhh" + >:=> (line 28, col 8) to (line 28, col 22) +-------------------------------- +28 > obj.q = "ohhh"; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (387 to 410) SpanInfo: {"start":395,"length":14} + >obj.q = "ohhh" + >:=> (line 28, col 8) to (line 28, col 22) +-------------------------------- +29 > } catch (e) { + + ~~~~~ => Pos: (411 to 415) SpanInfo: {"start":395,"length":14} + >obj.q = "ohhh" + >:=> (line 28, col 8) to (line 28, col 22) +29 > } catch (e) { + + ~~~~~~~~~~~~~ => Pos: (416 to 428) SpanInfo: {"start":437,"length":15} + >if (obj.z < 10) + >:=> (line 30, col 8) to (line 30, col 23) +-------------------------------- +30 > if (obj.z < 10) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (429 to 454) SpanInfo: {"start":437,"length":15} + >if (obj.z < 10) + >:=> (line 30, col 8) to (line 30, col 23) +-------------------------------- +31 > obj.z = 12; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (455 to 478) SpanInfo: {"start":467,"length":10} + >obj.z = 12 + >:=> (line 31, col 12) to (line 31, col 22) +-------------------------------- +32 > } else { + + ~~~~~~~~~ => Pos: (479 to 487) SpanInfo: {"start":467,"length":10} + >obj.z = 12 + >:=> (line 31, col 12) to (line 31, col 22) +32 > } else { + + ~~~~~~~~ => Pos: (488 to 495) SpanInfo: {"start":508,"length":13} + >obj.q = "hmm" + >:=> (line 33, col 12) to (line 33, col 25) +-------------------------------- +33 > obj.q = "hmm"; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (496 to 522) SpanInfo: {"start":508,"length":13} + >obj.q = "hmm" + >:=> (line 33, col 12) to (line 33, col 25) +-------------------------------- +34 > } + + ~~~~~~~~~~ => Pos: (523 to 532) SpanInfo: {"start":508,"length":13} + >obj.q = "hmm" + >:=> (line 33, col 12) to (line 33, col 25) +-------------------------------- +35 > } + + ~~~~~~ => Pos: (533 to 538) SpanInfo: {"start":437,"length":15} + >if (obj.z < 10) + >:=> (line 30, col 8) to (line 30, col 23) +-------------------------------- +36 > try { + + ~~~~~~~~~~ => Pos: (539 to 548) SpanInfo: {"start":557,"length":17} + >throw new Error() + >:=> (line 37, col 8) to (line 37, col 25) +-------------------------------- +37 > throw new Error(); + + ~~~~~~~~~~~~~ => Pos: (549 to 561) SpanInfo: {"start":557,"length":17} + >throw new Error() + >:=> (line 37, col 8) to (line 37, col 25) +37 > throw new Error(); + + ~~~~~~~~~~~~~~ => Pos: (562 to 575) SpanInfo: {"start":563,"length":11} + >new Error() + >:=> (line 37, col 14) to (line 37, col 25) +-------------------------------- +38 > } catch (e1) { + + ~~~~~ => Pos: (576 to 580) SpanInfo: {"start":557,"length":17} + >throw new Error() + >:=> (line 37, col 8) to (line 37, col 25) +38 > } catch (e1) { + + ~~~~~~~~~~~~~~ => Pos: (581 to 594) SpanInfo: {"start":603,"length":10} + >var b = e1 + >:=> (line 39, col 8) to (line 39, col 18) +-------------------------------- +39 > var b = e1; + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (595 to 614) SpanInfo: {"start":603,"length":10} + >var b = e1 + >:=> (line 39, col 8) to (line 39, col 18) +-------------------------------- +40 > } finally { + + ~~~~~ => Pos: (615 to 619) SpanInfo: {"start":603,"length":10} + >var b = e1 + >:=> (line 39, col 8) to (line 39, col 18) +40 > } finally { + + ~~~~~~~~~~~ => Pos: (620 to 630) SpanInfo: {"start":639,"length":6} + >y = 70 + >:=> (line 41, col 8) to (line 41, col 14) +-------------------------------- +41 > y = 70; + + ~~~~~~~~~~~~~~~~ => Pos: (631 to 646) SpanInfo: {"start":639,"length":6} + >y = 70 + >:=> (line 41, col 8) to (line 41, col 14) +-------------------------------- +42 > } + + ~~~~~~ => Pos: (647 to 652) SpanInfo: {"start":639,"length":6} + >y = 70 + >:=> (line 41, col 8) to (line 41, col 14) +-------------------------------- +43 > with (obj) { + + ~~~~~~~~~~~~~~~~~ => Pos: (653 to 669) SpanInfo: {"start":678,"length":5} + >i = 2 + >:=> (line 44, col 8) to (line 44, col 13) +-------------------------------- +44 > i = 2; + + ~~~~~~~~~~~~~~~ => Pos: (670 to 684) SpanInfo: {"start":678,"length":5} + >i = 2 + >:=> (line 44, col 8) to (line 44, col 13) +-------------------------------- +45 > z = 10; + + ~~~~~~~~~~~~~~~~ => Pos: (685 to 700) SpanInfo: {"start":693,"length":6} + >z = 10 + >:=> (line 45, col 8) to (line 45, col 14) +-------------------------------- +46 > } + + ~~~~~~ => Pos: (701 to 706) SpanInfo: {"start":693,"length":6} + >z = 10 + >:=> (line 45, col 8) to (line 45, col 14) +-------------------------------- +47 > switch (obj.z) { + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (707 to 727) SpanInfo: {"start":711,"length":14} + >switch (obj.z) + >:=> (line 47, col 4) to (line 47, col 18) +-------------------------------- +48 > case 0: { + + ~~~~~~~~~~~~~~~~~~ => Pos: (728 to 745) SpanInfo: {"start":758,"length":3} + >x++ + >:=> (line 49, col 12) to (line 49, col 15) +-------------------------------- +49 > x++; + + ~~~~~~~~~~~~~~~~~ => Pos: (746 to 762) SpanInfo: {"start":758,"length":3} + >x++ + >:=> (line 49, col 12) to (line 49, col 15) +-------------------------------- +50 > break; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (763 to 781) SpanInfo: {"start":775,"length":5} + >break + >:=> (line 50, col 12) to (line 50, col 17) +-------------------------------- +51 > + + ~ => Pos: (782 to 782) SpanInfo: undefined +-------------------------------- +52 > } + + ~~~~~~~~~~ => Pos: (783 to 792) SpanInfo: {"start":775,"length":5} + >break + >:=> (line 50, col 12) to (line 50, col 17) +-------------------------------- +53 > case 1: { + + ~~~~~~~~~~~~~~~~~~ => Pos: (793 to 810) SpanInfo: {"start":823,"length":3} + >x-- + >:=> (line 54, col 12) to (line 54, col 15) +-------------------------------- +54 > x--; + + ~~~~~~~~~~~~~~~~~ => Pos: (811 to 827) SpanInfo: {"start":823,"length":3} + >x-- + >:=> (line 54, col 12) to (line 54, col 15) +-------------------------------- +55 > break; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (828 to 846) SpanInfo: {"start":840,"length":5} + >break + >:=> (line 55, col 12) to (line 55, col 17) +-------------------------------- +56 > + + ~ => Pos: (847 to 847) SpanInfo: undefined +-------------------------------- +57 > } + + ~~~~~~~~~~ => Pos: (848 to 857) SpanInfo: {"start":840,"length":5} + >break + >:=> (line 55, col 12) to (line 55, col 17) +-------------------------------- +58 > default: { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (858 to 876) SpanInfo: {"start":889,"length":6} + >x *= 2 + >:=> (line 59, col 12) to (line 59, col 18) +-------------------------------- +59 > x *= 2; + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (877 to 896) SpanInfo: {"start":889,"length":6} + >x *= 2 + >:=> (line 59, col 12) to (line 59, col 18) +-------------------------------- +60 > x = 50; + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (897 to 916) SpanInfo: {"start":909,"length":6} + >x = 50 + >:=> (line 60, col 12) to (line 60, col 18) +-------------------------------- +61 > break; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (917 to 935) SpanInfo: {"start":929,"length":5} + >break + >:=> (line 61, col 12) to (line 61, col 17) +-------------------------------- +62 > + + ~ => Pos: (936 to 936) SpanInfo: undefined +-------------------------------- +63 > } + + ~~~~~~~~~~ => Pos: (937 to 946) SpanInfo: {"start":929,"length":5} + >break + >:=> (line 61, col 12) to (line 61, col 17) +-------------------------------- +64 > } + + ~~~~~~ => Pos: (947 to 952) SpanInfo: {"start":889,"length":6} + >x *= 2 + >:=> (line 59, col 12) to (line 59, col 18) +-------------------------------- +65 > while (x < 10) { + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (953 to 973) SpanInfo: {"start":957,"length":14} + >while (x < 10) + >:=> (line 65, col 4) to (line 65, col 18) +-------------------------------- +66 > x++; + + ~~~~~~~~~~~~~ => Pos: (974 to 986) SpanInfo: {"start":982,"length":3} + >x++ + >:=> (line 66, col 8) to (line 66, col 11) +-------------------------------- +67 > } + + ~~~~~~ => Pos: (987 to 992) SpanInfo: {"start":982,"length":3} + >x++ + >:=> (line 66, col 8) to (line 66, col 11) +-------------------------------- +68 > do { + + ~~~~~~~~~ => Pos: (993 to 1001) SpanInfo: {"start":1010,"length":3} + >x-- + >:=> (line 69, col 8) to (line 69, col 11) +-------------------------------- +69 > x--; + + ~~~~~~~~~~~~~ => Pos: (1002 to 1014) SpanInfo: {"start":1010,"length":3} + >x-- + >:=> (line 69, col 8) to (line 69, col 11) +-------------------------------- +70 > } while (x > 4) + + ~~~~~ => Pos: (1015 to 1019) SpanInfo: {"start":1010,"length":3} + >x-- + >:=> (line 69, col 8) to (line 69, col 11) +70 > } while (x > 4) + + ~~~~~~~~~~~~~~~ => Pos: (1020 to 1034) SpanInfo: {"start":1021,"length":13} + >while (x > 4) + >:=> (line 70, col 6) to (line 70, col 19) +-------------------------------- +71 > x = y; + + ~~~~~~~~~~~ => Pos: (1035 to 1045) SpanInfo: {"start":1039,"length":5} + >x = y + >:=> (line 71, col 4) to (line 71, col 9) +-------------------------------- +72 > var z = (x == 1) ? x + 1 : x - 1; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1046 to 1083) SpanInfo: {"start":1050,"length":32} + >var z = (x == 1) ? x + 1 : x - 1 + >:=> (line 72, col 4) to (line 72, col 36) +-------------------------------- +73 > (x == 1) ? x + 1 : x - 1; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1084 to 1113) SpanInfo: {"start":1088,"length":24} + >(x == 1) ? x + 1 : x - 1 + >:=> (line 73, col 4) to (line 73, col 28) +-------------------------------- +74 > x === 1; + + ~~~~~~~~~~~~~ => Pos: (1114 to 1126) SpanInfo: {"start":1118,"length":7} + >x === 1 + >:=> (line 74, col 4) to (line 74, col 11) +-------------------------------- +75 > x = z = 40; + + ~~~~~~~~~~~~~~~~ => Pos: (1127 to 1142) SpanInfo: {"start":1131,"length":10} + >x = z = 40 + >:=> (line 75, col 4) to (line 75, col 14) +-------------------------------- +76 > eval("y"); + + ~~~~~~~~~~~~~~~ => Pos: (1143 to 1157) SpanInfo: {"start":1147,"length":9} + >eval("y") + >:=> (line 76, col 4) to (line 76, col 13) +-------------------------------- +77 > return; + + ~~~~~~~~~~~~ => Pos: (1158 to 1169) SpanInfo: {"start":1162,"length":6} + >return + >:=> (line 77, col 4) to (line 77, col 10) +-------------------------------- +78 >} + + ~~ => Pos: (1170 to 1171) SpanInfo: {"start":1170,"length":1} + >} + >:=> (line 78, col 0) to (line 78, col 1) +-------------------------------- +79 >var b = function () { + + ~~~~~~~ => Pos: (1172 to 1178) SpanInfo: {"start":1172,"length":54} + >var b = function () { + > var x = 10; + > x = x + 1; + >} + >:=> (line 79, col 0) to (line 82, col 1) +79 >var b = function () { + + ~~~~~~~~~~~~~~~ => Pos: (1179 to 1193) SpanInfo: {"start":1198,"length":10} + >var x = 10 + >:=> (line 80, col 4) to (line 80, col 14) +-------------------------------- +80 > var x = 10; + + ~~~~~~~~~~~~~~~~ => Pos: (1194 to 1209) SpanInfo: {"start":1198,"length":10} + >var x = 10 + >:=> (line 80, col 4) to (line 80, col 14) +-------------------------------- +81 > x = x + 1; + + ~~~~~~~~~~~~~~~ => Pos: (1210 to 1224) SpanInfo: {"start":1214,"length":9} + >x = x + 1 + >:=> (line 81, col 4) to (line 81, col 13) +-------------------------------- +82 >}; + + ~~~ => Pos: (1225 to 1227) SpanInfo: {"start":1225,"length":1} + >} + >:=> (line 82, col 0) to (line 82, col 1) +-------------------------------- +83 >f(); + ~~~~ => Pos: (1228 to 1231) SpanInfo: {"start":1228,"length":3} + >f() + >:=> (line 83, col 0) to (line 83, col 3) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_switch.baseline b/tests/baselines/reference/bpSpan_switch.baseline new file mode 100644 index 00000000000..c0e2259784d --- /dev/null +++ b/tests/baselines/reference/bpSpan_switch.baseline @@ -0,0 +1,272 @@ + +1 >var x = 10; + + ~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":10} + >var x = 10 + >:=> (line 1, col 0) to (line 1, col 10) +-------------------------------- +2 >switch (x) { + + ~~~~~~~~~~~~~ => Pos: (12 to 24) SpanInfo: {"start":12,"length":10} + >switch (x) + >:=> (line 2, col 0) to (line 2, col 10) +-------------------------------- +3 > case 5: + + ~~~~~~~~~~~~ => Pos: (25 to 36) SpanInfo: {"start":45,"length":3} + >x++ + >:=> (line 4, col 8) to (line 4, col 11) +-------------------------------- +4 > x++; + + ~~~~~~~~~~~~~ => Pos: (37 to 49) SpanInfo: {"start":45,"length":3} + >x++ + >:=> (line 4, col 8) to (line 4, col 11) +-------------------------------- +5 > break; + + ~~~~~~~~~~~~~~~ => Pos: (50 to 64) SpanInfo: {"start":58,"length":5} + >break + >:=> (line 5, col 8) to (line 5, col 13) +-------------------------------- +6 > case 10: + + ~~~~~~~~~~~~~ => Pos: (65 to 77) SpanInfo: {"start":100,"length":3} + >x-- + >:=> (line 8, col 12) to (line 8, col 15) +-------------------------------- +7 > { + + ~~~~~~~~~~ => Pos: (78 to 87) SpanInfo: {"start":100,"length":3} + >x-- + >:=> (line 8, col 12) to (line 8, col 15) +-------------------------------- +8 > x--; + + ~~~~~~~~~~~~~~~~~ => Pos: (88 to 104) SpanInfo: {"start":100,"length":3} + >x-- + >:=> (line 8, col 12) to (line 8, col 15) +-------------------------------- +9 > break; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (105 to 123) SpanInfo: {"start":117,"length":5} + >break + >:=> (line 9, col 12) to (line 9, col 17) +-------------------------------- +10 > } + + ~~~~~~~~~~ => Pos: (124 to 133) SpanInfo: {"start":117,"length":5} + >break + >:=> (line 9, col 12) to (line 9, col 17) +-------------------------------- +11 > default: + + ~~~~~~~~~~~~~ => Pos: (134 to 146) SpanInfo: {"start":155,"length":9} + >x = x *10 + >:=> (line 12, col 8) to (line 12, col 17) +-------------------------------- +12 > x = x *10; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (147 to 165) SpanInfo: {"start":155,"length":9} + >x = x *10 + >:=> (line 12, col 8) to (line 12, col 17) +-------------------------------- +13 >} + + ~~ => Pos: (166 to 167) SpanInfo: {"start":155,"length":9} + >x = x *10 + >:=> (line 12, col 8) to (line 12, col 17) +-------------------------------- +14 >switch (x) + + ~~~~~~~~~~~ => Pos: (168 to 178) SpanInfo: {"start":168,"length":10} + >switch (x) + >:=> (line 14, col 0) to (line 14, col 10) +-------------------------------- +15 >{ + + ~~ => Pos: (179 to 180) SpanInfo: {"start":201,"length":3} + >x++ + >:=> (line 17, col 8) to (line 17, col 11) +-------------------------------- +16 > case 5: + + ~~~~~~~~~~~~ => Pos: (181 to 192) SpanInfo: {"start":201,"length":3} + >x++ + >:=> (line 17, col 8) to (line 17, col 11) +-------------------------------- +17 > x++; + + ~~~~~~~~~~~~~ => Pos: (193 to 205) SpanInfo: {"start":201,"length":3} + >x++ + >:=> (line 17, col 8) to (line 17, col 11) +-------------------------------- +18 > break; + + ~~~~~~~~~~~~~~~ => Pos: (206 to 220) SpanInfo: {"start":214,"length":5} + >break + >:=> (line 18, col 8) to (line 18, col 13) +-------------------------------- +19 > case 10: + + ~~~~~~~~~~~~~ => Pos: (221 to 233) SpanInfo: {"start":256,"length":3} + >x-- + >:=> (line 21, col 12) to (line 21, col 15) +-------------------------------- +20 > { + + ~~~~~~~~~~ => Pos: (234 to 243) SpanInfo: {"start":256,"length":3} + >x-- + >:=> (line 21, col 12) to (line 21, col 15) +-------------------------------- +21 > x--; + + ~~~~~~~~~~~~~~~~~ => Pos: (244 to 260) SpanInfo: {"start":256,"length":3} + >x-- + >:=> (line 21, col 12) to (line 21, col 15) +-------------------------------- +22 > break; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (261 to 279) SpanInfo: {"start":273,"length":5} + >break + >:=> (line 22, col 12) to (line 22, col 17) +-------------------------------- +23 > } + + ~~~~~~~~~~ => Pos: (280 to 289) SpanInfo: {"start":273,"length":5} + >break + >:=> (line 22, col 12) to (line 22, col 17) +-------------------------------- +24 > default: + + ~~~~~~~~~~~~~ => Pos: (290 to 302) SpanInfo: {"start":325,"length":10} + >x = x * 10 + >:=> (line 26, col 12) to (line 26, col 22) +-------------------------------- +25 > { + + ~~~~~~~~~~ => Pos: (303 to 312) SpanInfo: {"start":325,"length":10} + >x = x * 10 + >:=> (line 26, col 12) to (line 26, col 22) +-------------------------------- +26 > x = x * 10; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (313 to 336) SpanInfo: {"start":325,"length":10} + >x = x * 10 + >:=> (line 26, col 12) to (line 26, col 22) +-------------------------------- +27 > } + + ~~~~~~~~~~ => Pos: (337 to 346) SpanInfo: {"start":325,"length":10} + >x = x * 10 + >:=> (line 26, col 12) to (line 26, col 22) +-------------------------------- +28 >} + + ~~ => Pos: (347 to 348) SpanInfo: {"start":325,"length":10} + >x = x * 10 + >:=> (line 26, col 12) to (line 26, col 22) +-------------------------------- +29 >switch ((function foo() { + + ~~~~~~~~ => Pos: (349 to 356) SpanInfo: {"start":349,"length":50} + >switch ((function foo() { + > return x * 30; + >})()) + >:=> (line 29, col 0) to (line 31, col 5) +29 >switch ((function foo() { + + ~ => Pos: (357 to 357) SpanInfo: {"start":357,"length":41} + >(function foo() { + > return x * 30; + >})() + >:=> (line 29, col 8) to (line 31, col 4) +29 >switch ((function foo() { + + ~~~~~~~~~~~~~~~~~ => Pos: (358 to 374) SpanInfo: {"start":379,"length":13} + >return x * 30 + >:=> (line 30, col 4) to (line 30, col 17) +-------------------------------- +30 > return x * 30; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (375 to 393) SpanInfo: {"start":379,"length":13} + >return x * 30 + >:=> (line 30, col 4) to (line 30, col 17) +-------------------------------- +31 >})()) { + + ~ => Pos: (394 to 394) SpanInfo: {"start":394,"length":1} + >} + >:=> (line 31, col 0) to (line 31, col 1) +31 >})()) { + + ~~~ => Pos: (395 to 397) SpanInfo: {"start":357,"length":41} + >(function foo() { + > return x * 30; + >})() + >:=> (line 29, col 8) to (line 31, col 4) +31 >})()) { + + ~ => Pos: (398 to 398) SpanInfo: {"start":349,"length":50} + >switch ((function foo() { + > return x * 30; + >})()) + >:=> (line 29, col 0) to (line 31, col 5) +31 >})()) { + + ~~~ => Pos: (399 to 401) SpanInfo: {"start":466,"length":3} + >x++ + >:=> (line 35, col 8) to (line 35, col 11) +-------------------------------- +32 > case (function bar() { + + ~~~~~~~~ => Pos: (402 to 409) SpanInfo: {"start":466,"length":3} + >x++ + >:=> (line 35, col 8) to (line 35, col 11) +32 > case (function bar() { + + ~~ => Pos: (410 to 411) SpanInfo: {"start":411,"length":45} + >(function bar() { + > return 30; + > })() + >:=> (line 32, col 9) to (line 34, col 8) +32 > case (function bar() { + + ~~~~~~~~~~~~~~~~~ => Pos: (412 to 428) SpanInfo: {"start":437,"length":9} + >return 30 + >:=> (line 33, col 8) to (line 33, col 17) +-------------------------------- +33 > return 30; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (429 to 447) SpanInfo: {"start":437,"length":9} + >return 30 + >:=> (line 33, col 8) to (line 33, col 17) +-------------------------------- +34 > })(): + + ~~~~~ => Pos: (448 to 452) SpanInfo: {"start":452,"length":1} + >} + >:=> (line 34, col 4) to (line 34, col 5) +34 > })(): + + ~~~ => Pos: (453 to 455) SpanInfo: {"start":411,"length":45} + >(function bar() { + > return 30; + > })() + >:=> (line 32, col 9) to (line 34, col 8) +34 > })(): + + ~~ => Pos: (456 to 457) SpanInfo: {"start":466,"length":3} + >x++ + >:=> (line 35, col 8) to (line 35, col 11) +-------------------------------- +35 > x++; + + ~~~~~~~~~~~~~ => Pos: (458 to 470) SpanInfo: {"start":466,"length":3} + >x++ + >:=> (line 35, col 8) to (line 35, col 11) +-------------------------------- +36 >} + ~ => Pos: (471 to 471) SpanInfo: {"start":466,"length":3} + >x++ + >:=> (line 35, col 8) to (line 35, col 11) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_tryCatchFinally.baseline b/tests/baselines/reference/bpSpan_tryCatchFinally.baseline new file mode 100644 index 00000000000..5a9e569f403 --- /dev/null +++ b/tests/baselines/reference/bpSpan_tryCatchFinally.baseline @@ -0,0 +1,223 @@ + +1 >var x = 10; + + ~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":10} + >var x = 10 + >:=> (line 1, col 0) to (line 1, col 10) +-------------------------------- +2 >try { + + ~~~~~~ => Pos: (12 to 17) SpanInfo: {"start":22,"length":9} + >x = x + 1 + >:=> (line 3, col 4) to (line 3, col 13) +-------------------------------- +3 > x = x + 1; + + ~~~~~~~~~~~~~~~ => Pos: (18 to 32) SpanInfo: {"start":22,"length":9} + >x = x + 1 + >:=> (line 3, col 4) to (line 3, col 13) +-------------------------------- +4 >} catch (e) { + + ~ => Pos: (33 to 33) SpanInfo: {"start":22,"length":9} + >x = x + 1 + >:=> (line 3, col 4) to (line 3, col 13) +4 >} catch (e) { + + ~~~~~~~~~~~~~ => Pos: (34 to 46) SpanInfo: {"start":51,"length":9} + >x = x - 1 + >:=> (line 5, col 4) to (line 5, col 13) +-------------------------------- +5 > x = x - 1; + + ~~~~~~~~~~~~~~~ => Pos: (47 to 61) SpanInfo: {"start":51,"length":9} + >x = x - 1 + >:=> (line 5, col 4) to (line 5, col 13) +-------------------------------- +6 >} finally { + + ~ => Pos: (62 to 62) SpanInfo: {"start":51,"length":9} + >x = x - 1 + >:=> (line 5, col 4) to (line 5, col 13) +6 >} finally { + + ~~~~~~~~~~~ => Pos: (63 to 73) SpanInfo: {"start":78,"length":10} + >x = x * 10 + >:=> (line 7, col 4) to (line 7, col 14) +-------------------------------- +7 > x = x * 10; + + ~~~~~~~~~~~~~~~~ => Pos: (74 to 89) SpanInfo: {"start":78,"length":10} + >x = x * 10 + >:=> (line 7, col 4) to (line 7, col 14) +-------------------------------- +8 >} + + ~~ => Pos: (90 to 91) SpanInfo: {"start":78,"length":10} + >x = x * 10 + >:=> (line 7, col 4) to (line 7, col 14) +-------------------------------- +9 >try + + ~~~~ => Pos: (92 to 95) SpanInfo: {"start":102,"length":9} + >x = x + 1 + >:=> (line 11, col 4) to (line 11, col 13) +-------------------------------- +10 >{ + + ~~ => Pos: (96 to 97) SpanInfo: {"start":102,"length":9} + >x = x + 1 + >:=> (line 11, col 4) to (line 11, col 13) +-------------------------------- +11 > x = x + 1; + + ~~~~~~~~~~~~~~~ => Pos: (98 to 112) SpanInfo: {"start":102,"length":9} + >x = x + 1 + >:=> (line 11, col 4) to (line 11, col 13) +-------------------------------- +12 > throw new Error(); + + ~~~~~~~~~ => Pos: (113 to 121) SpanInfo: {"start":117,"length":17} + >throw new Error() + >:=> (line 12, col 4) to (line 12, col 21) +12 > throw new Error(); + + ~~~~~~~~~~~~~~ => Pos: (122 to 135) SpanInfo: {"start":123,"length":11} + >new Error() + >:=> (line 12, col 10) to (line 12, col 21) +-------------------------------- +13 >} + + ~~ => Pos: (136 to 137) SpanInfo: {"start":117,"length":17} + >throw new Error() + >:=> (line 12, col 4) to (line 12, col 21) +-------------------------------- +14 >catch (e) + + ~~~~~~~~~~ => Pos: (138 to 147) SpanInfo: {"start":154,"length":9} + >x = x - 1 + >:=> (line 16, col 4) to (line 16, col 13) +-------------------------------- +15 >{ + + ~~ => Pos: (148 to 149) SpanInfo: {"start":154,"length":9} + >x = x - 1 + >:=> (line 16, col 4) to (line 16, col 13) +-------------------------------- +16 > x = x - 1; + + ~~~~~~~~~~~~~~~ => Pos: (150 to 164) SpanInfo: {"start":154,"length":9} + >x = x - 1 + >:=> (line 16, col 4) to (line 16, col 13) +-------------------------------- +17 >} + + ~~ => Pos: (165 to 166) SpanInfo: {"start":154,"length":9} + >x = x - 1 + >:=> (line 16, col 4) to (line 16, col 13) +-------------------------------- +18 >finally + + ~~~~~~~~ => Pos: (167 to 174) SpanInfo: {"start":181,"length":10} + >x = x * 10 + >:=> (line 20, col 4) to (line 20, col 14) +-------------------------------- +19 >{ + + ~~ => Pos: (175 to 176) SpanInfo: {"start":181,"length":10} + >x = x * 10 + >:=> (line 20, col 4) to (line 20, col 14) +-------------------------------- +20 > x = x * 10; + + ~~~~~~~~~~~~~~~~ => Pos: (177 to 192) SpanInfo: {"start":181,"length":10} + >x = x * 10 + >:=> (line 20, col 4) to (line 20, col 14) +-------------------------------- +21 >} + + ~~ => Pos: (193 to 194) SpanInfo: {"start":181,"length":10} + >x = x * 10 + >:=> (line 20, col 4) to (line 20, col 14) +-------------------------------- +22 >try { + + ~~~~~~ => Pos: (195 to 200) SpanInfo: {"start":205,"length":65} + >throw (function foo() { + > new Error(x.toString()); + > })() + >:=> (line 23, col 4) to (line 25, col 8) +-------------------------------- +23 > throw (function foo() { + + ~~~~~~~~~ => Pos: (201 to 209) SpanInfo: {"start":205,"length":65} + >throw (function foo() { + > new Error(x.toString()); + > })() + >:=> (line 23, col 4) to (line 25, col 8) +23 > throw (function foo() { + + ~~ => Pos: (210 to 211) SpanInfo: {"start":211,"length":59} + >(function foo() { + > new Error(x.toString()); + > })() + >:=> (line 23, col 10) to (line 25, col 8) +23 > throw (function foo() { + + ~~~~~~~~~~~~~~~~~ => Pos: (212 to 228) SpanInfo: {"start":237,"length":23} + >new Error(x.toString()) + >:=> (line 24, col 8) to (line 24, col 31) +-------------------------------- +24 > new Error(x.toString()); + + ~~~~~~~~~~~~~~~~~~ => Pos: (229 to 246) SpanInfo: {"start":237,"length":23} + >new Error(x.toString()) + >:=> (line 24, col 8) to (line 24, col 31) +24 > new Error(x.toString()); + + ~~~~~~~~~~~~ => Pos: (247 to 258) SpanInfo: {"start":247,"length":12} + >x.toString() + >:=> (line 24, col 18) to (line 24, col 30) +24 > new Error(x.toString()); + + ~~~ => Pos: (259 to 261) SpanInfo: {"start":237,"length":23} + >new Error(x.toString()) + >:=> (line 24, col 8) to (line 24, col 31) +-------------------------------- +25 > })(); + + ~~~~~ => Pos: (262 to 266) SpanInfo: {"start":266,"length":1} + >} + >:=> (line 25, col 4) to (line 25, col 5) +25 > })(); + + ~~~~~ => Pos: (267 to 271) SpanInfo: {"start":211,"length":59} + >(function foo() { + > new Error(x.toString()); + > })() + >:=> (line 23, col 10) to (line 25, col 8) +-------------------------------- +26 >} + + ~~ => Pos: (272 to 273) SpanInfo: {"start":205,"length":65} + >throw (function foo() { + > new Error(x.toString()); + > })() + >:=> (line 23, col 4) to (line 25, col 8) +-------------------------------- +27 >finally { + + ~~~~~~~~~~ => Pos: (274 to 283) SpanInfo: {"start":288,"length":3} + >x++ + >:=> (line 28, col 4) to (line 28, col 7) +-------------------------------- +28 > x++; + + ~~~~~~~~~ => Pos: (284 to 292) SpanInfo: {"start":288,"length":3} + >x++ + >:=> (line 28, col 4) to (line 28, col 7) +-------------------------------- +29 >} + ~ => Pos: (293 to 293) SpanInfo: {"start":288,"length":3} + >x++ + >:=> (line 28, col 4) to (line 28, col 7) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_typeAssertionExpressions.baseline b/tests/baselines/reference/bpSpan_typeAssertionExpressions.baseline new file mode 100644 index 00000000000..c04ddb8503b --- /dev/null +++ b/tests/baselines/reference/bpSpan_typeAssertionExpressions.baseline @@ -0,0 +1,82 @@ + +1 >class Greeter { + + ~~~~~~~~~~~~~~~~ => Pos: (0 to 15) SpanInfo: {"start":0,"length":17} + >class Greeter { + >} + >:=> (line 1, col 0) to (line 2, col 1) +-------------------------------- +2 >} + + ~~ => Pos: (16 to 17) SpanInfo: {"start":16,"length":1} + >} + >:=> (line 2, col 0) to (line 2, col 1) +-------------------------------- +3 >var a = new Greeter(); + + ~~~~~~~ => Pos: (18 to 24) SpanInfo: {"start":18,"length":30} + >var a = new Greeter() + >:=> (line 3, col 0) to (line 3, col 30) +3 >var a = new Greeter(); + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (25 to 49) SpanInfo: {"start":35,"length":13} + >new Greeter() + >:=> (line 3, col 17) to (line 3, col 30) +-------------------------------- +4 >a = ( new Greeter()); + + ~~~~~ => Pos: (50 to 54) SpanInfo: {"start":50,"length":29} + >a = ( new Greeter()) + >:=> (line 4, col 0) to (line 4, col 29) +4 >a = ( new Greeter()); + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (55 to 77) SpanInfo: {"start":65,"length":13} + >new Greeter() + >:=> (line 4, col 15) to (line 4, col 28) +4 >a = ( new Greeter()); + + ~~~ => Pos: (78 to 80) SpanInfo: {"start":50,"length":29} + >a = ( new Greeter()) + >:=> (line 4, col 0) to (line 4, col 29) +-------------------------------- +5 >a = (function foo() { + + ~~~ => Pos: (81 to 83) SpanInfo: {"start":81,"length":61} + >a = (function foo() { + > return new Greeter(); + >})() + >:=> (line 5, col 0) to (line 7, col 4) +5 >a = (function foo() { + + ~~~~~~~~~~~ => Pos: (84 to 94) SpanInfo: {"start":94,"length":48} + >(function foo() { + > return new Greeter(); + >})() + >:=> (line 5, col 13) to (line 7, col 4) +5 >a = (function foo() { + + ~~~~~~~~~~~~~~~~~ => Pos: (95 to 111) SpanInfo: {"start":116,"length":20} + >return new Greeter() + >:=> (line 6, col 4) to (line 6, col 24) +-------------------------------- +6 > return new Greeter(); + + ~~~~~~~~~~ => Pos: (112 to 121) SpanInfo: {"start":116,"length":20} + >return new Greeter() + >:=> (line 6, col 4) to (line 6, col 24) +6 > return new Greeter(); + + ~~~~~~~~~~~~~~~~ => Pos: (122 to 137) SpanInfo: {"start":123,"length":13} + >new Greeter() + >:=> (line 6, col 11) to (line 6, col 24) +-------------------------------- +7 >})(); + ~ => Pos: (138 to 138) SpanInfo: {"start":138,"length":1} + >} + >:=> (line 7, col 0) to (line 7, col 1) +7 >})(); + ~~~~ => Pos: (139 to 142) SpanInfo: {"start":94,"length":48} + >(function foo() { + > return new Greeter(); + >})() + >:=> (line 5, col 13) to (line 7, col 4) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_unaryExpressions.baseline b/tests/baselines/reference/bpSpan_unaryExpressions.baseline new file mode 100644 index 00000000000..2ad1191cf95 --- /dev/null +++ b/tests/baselines/reference/bpSpan_unaryExpressions.baseline @@ -0,0 +1,74 @@ + +1 >var x = 10; + + ~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":10} + >var x = 10 + >:=> (line 1, col 0) to (line 1, col 10) +-------------------------------- +2 >var y = 20; + + ~~~~~~~~~~~~ => Pos: (12 to 23) SpanInfo: {"start":12,"length":10} + >var y = 20 + >:=> (line 2, col 0) to (line 2, col 10) +-------------------------------- +3 >x++; + + ~~~~~ => Pos: (24 to 28) SpanInfo: {"start":24,"length":3} + >x++ + >:=> (line 3, col 0) to (line 3, col 3) +-------------------------------- +4 >y--; + + ~~~~~ => Pos: (29 to 33) SpanInfo: {"start":29,"length":3} + >y-- + >:=> (line 4, col 0) to (line 4, col 3) +-------------------------------- +5 >typeof (function foo() { + + ~~~~~~ => Pos: (34 to 39) SpanInfo: {"start":34,"length":43} + >typeof (function foo() { + > return y; + >})() + >:=> (line 5, col 0) to (line 7, col 4) +5 >typeof (function foo() { + + ~~ => Pos: (40 to 41) SpanInfo: {"start":41,"length":36} + >(function foo() { + > return y; + >})() + >:=> (line 5, col 7) to (line 7, col 4) +5 >typeof (function foo() { + + ~~~~~~~~~~~~~~~~~ => Pos: (42 to 58) SpanInfo: {"start":63,"length":8} + >return y + >:=> (line 6, col 4) to (line 6, col 12) +-------------------------------- +6 > return y; + + ~~~~~~~~~~~~~~ => Pos: (59 to 72) SpanInfo: {"start":63,"length":8} + >return y + >:=> (line 6, col 4) to (line 6, col 12) +-------------------------------- +7 >})(); + + ~ => Pos: (73 to 73) SpanInfo: {"start":73,"length":1} + >} + >:=> (line 7, col 0) to (line 7, col 1) +7 >})(); + + ~~~~~ => Pos: (74 to 78) SpanInfo: {"start":41,"length":36} + >(function foo() { + > return y; + >})() + >:=> (line 5, col 7) to (line 7, col 4) +-------------------------------- +8 >++x; + + ~~~~~ => Pos: (79 to 83) SpanInfo: {"start":79,"length":3} + >++x + >:=> (line 8, col 0) to (line 8, col 3) +-------------------------------- +9 >++y; + ~~~~ => Pos: (84 to 87) SpanInfo: {"start":84,"length":3} + >++y + >:=> (line 9, col 0) to (line 9, col 3) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_variables.baseline b/tests/baselines/reference/bpSpan_variables.baseline new file mode 100644 index 00000000000..1904c34b835 --- /dev/null +++ b/tests/baselines/reference/bpSpan_variables.baseline @@ -0,0 +1,90 @@ + +1 >var a = 10; + + ~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":10} + >var a = 10 + >:=> (line 1, col 0) to (line 1, col 10) +-------------------------------- +2 >var b; + + ~~~~~~~ => Pos: (12 to 18) SpanInfo: undefined +-------------------------------- +3 >var c = 10, d, e; + + ~~~~~~~~~~~~~~~~~~ => Pos: (19 to 36) SpanInfo: {"start":19,"length":10} + >var c = 10 + >:=> (line 3, col 0) to (line 3, col 10) +-------------------------------- +4 >var c2, d2 = 10; + + ~~~~~~~ => Pos: (37 to 43) SpanInfo: undefined +4 >var c2, d2 = 10; + + ~~~~~~~~~~ => Pos: (44 to 53) SpanInfo: {"start":45,"length":7} + >d2 = 10 + >:=> (line 4, col 8) to (line 4, col 15) +-------------------------------- +5 >module m { + + ~~~~~~~~~~~ => Pos: (54 to 64) SpanInfo: {"start":54,"length":146} + >module m { + > var x1; + > var x2 = 10, x3 = 10; + > var x4, x5; + > export var xx1; + > export var xx2 = 10, xx3 = 10; + > export var xx4, xx5; + >} + >:=> (line 5, col 0) to (line 12, col 1) +-------------------------------- +6 > var x1; + + ~~~~~~~~~~~~ => Pos: (65 to 76) SpanInfo: undefined +-------------------------------- +7 > var x2 = 10, x3 = 10; + + ~~~~~~~~~~~~~~~~ => Pos: (77 to 92) SpanInfo: {"start":81,"length":11} + >var x2 = 10 + >:=> (line 7, col 4) to (line 7, col 15) +7 > var x2 = 10, x3 = 10; + + ~~~~~~~~~~ => Pos: (93 to 102) SpanInfo: {"start":94,"length":7} + >x3 = 10 + >:=> (line 7, col 17) to (line 7, col 24) +-------------------------------- +8 > var x4, x5; + + ~~~~~~~~~~~~~~~~ => Pos: (103 to 118) SpanInfo: undefined +-------------------------------- +9 > export var xx1; + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (119 to 138) SpanInfo: {"start":123,"length":14} + >export var xx1 + >:=> (line 9, col 4) to (line 9, col 18) +-------------------------------- +10 > export var xx2 = 10, xx3 = 10; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (139 to 162) SpanInfo: {"start":143,"length":19} + >export var xx2 = 10 + >:=> (line 10, col 4) to (line 10, col 23) +10 > export var xx2 = 10, xx3 = 10; + + ~~~~~~~~~~~ => Pos: (163 to 173) SpanInfo: {"start":164,"length":8} + >xx3 = 10 + >:=> (line 10, col 25) to (line 10, col 33) +-------------------------------- +11 > export var xx4, xx5; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (174 to 192) SpanInfo: {"start":178,"length":14} + >export var xx4 + >:=> (line 11, col 4) to (line 11, col 18) +11 > export var xx4, xx5; + + ~~~~~~ => Pos: (193 to 198) SpanInfo: {"start":194,"length":3} + >xx5 + >:=> (line 11, col 20) to (line 11, col 23) +-------------------------------- +12 >} + ~ => Pos: (199 to 199) SpanInfo: {"start":199,"length":1} + >} + >:=> (line 12, col 0) to (line 12, col 1) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_while.baseline b/tests/baselines/reference/bpSpan_while.baseline new file mode 100644 index 00000000000..91632b78009 --- /dev/null +++ b/tests/baselines/reference/bpSpan_while.baseline @@ -0,0 +1,133 @@ + +1 >var a = 10; + + ~~~~~~~~~~~~ => Pos: (0 to 11) SpanInfo: {"start":0,"length":10} + >var a = 10 + >:=> (line 1, col 0) to (line 1, col 10) +-------------------------------- +2 >while (a == 10) { + + ~~~~~~~~~~~~~~~~~~ => Pos: (12 to 29) SpanInfo: {"start":12,"length":15} + >while (a == 10) + >:=> (line 2, col 0) to (line 2, col 15) +-------------------------------- +3 > a++; + + ~~~~~~~~~ => Pos: (30 to 38) SpanInfo: {"start":34,"length":3} + >a++ + >:=> (line 3, col 4) to (line 3, col 7) +-------------------------------- +4 >} + + ~~ => Pos: (39 to 40) SpanInfo: {"start":34,"length":3} + >a++ + >:=> (line 3, col 4) to (line 3, col 7) +-------------------------------- +5 >while (a == 10) + + ~~~~~~~~~~~~~~~~~ => Pos: (41 to 57) SpanInfo: {"start":41,"length":15} + >while (a == 10) + >:=> (line 5, col 0) to (line 5, col 15) +-------------------------------- +6 >{ + + ~~ => Pos: (58 to 59) SpanInfo: {"start":64,"length":3} + >a++ + >:=> (line 7, col 4) to (line 7, col 7) +-------------------------------- +7 > a++; + + ~~~~~~~~~ => Pos: (60 to 68) SpanInfo: {"start":64,"length":3} + >a++ + >:=> (line 7, col 4) to (line 7, col 7) +-------------------------------- +8 >} + + ~~ => Pos: (69 to 70) SpanInfo: {"start":64,"length":3} + >a++ + >:=> (line 7, col 4) to (line 7, col 7) +-------------------------------- +9 >while (a == 10) a++; + + ~~~~~~~~~~~~~~~ => Pos: (71 to 85) SpanInfo: {"start":71,"length":15} + >while (a == 10) + >:=> (line 9, col 0) to (line 9, col 15) +9 >while (a == 10) a++; + + ~~~~~~~ => Pos: (86 to 92) SpanInfo: {"start":88,"length":3} + >a++ + >:=> (line 9, col 17) to (line 9, col 20) +-------------------------------- +10 >while (a == 10) + + ~~~~~~~~~~~~~~~~~ => Pos: (93 to 109) SpanInfo: {"start":93,"length":15} + >while (a == 10) + >:=> (line 10, col 0) to (line 10, col 15) +-------------------------------- +11 > a++; + + ~~~~~~~~~ => Pos: (110 to 118) SpanInfo: {"start":114,"length":3} + >a++ + >:=> (line 11, col 4) to (line 11, col 7) +-------------------------------- +12 >while ((function () { + + ~~~~~~~ => Pos: (119 to 125) SpanInfo: {"start":119,"length":52} + >while ((function () { + > return 30 * a; + >})() !== a) + >:=> (line 12, col 0) to (line 14, col 11) +12 >while ((function () { + + ~ => Pos: (126 to 126) SpanInfo: {"start":126,"length":38} + >(function () { + > return 30 * a; + >})() + >:=> (line 12, col 7) to (line 14, col 4) +12 >while ((function () { + + ~~~~~~~~~~~~~~ => Pos: (127 to 140) SpanInfo: {"start":145,"length":13} + >return 30 * a + >:=> (line 13, col 4) to (line 13, col 17) +-------------------------------- +13 > return 30 * a; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (141 to 159) SpanInfo: {"start":145,"length":13} + >return 30 * a + >:=> (line 13, col 4) to (line 13, col 17) +-------------------------------- +14 >})() !== a) { + + ~ => Pos: (160 to 160) SpanInfo: {"start":160,"length":1} + >} + >:=> (line 14, col 0) to (line 14, col 1) +14 >})() !== a) { + + ~~~ => Pos: (161 to 163) SpanInfo: {"start":126,"length":38} + >(function () { + > return 30 * a; + >})() + >:=> (line 12, col 7) to (line 14, col 4) +14 >})() !== a) { + + ~~~~~~~ => Pos: (164 to 170) SpanInfo: {"start":119,"length":52} + >while ((function () { + > return 30 * a; + >})() !== a) + >:=> (line 12, col 0) to (line 14, col 11) +14 >})() !== a) { + + ~~~ => Pos: (171 to 173) SpanInfo: {"start":178,"length":3} + >a-- + >:=> (line 15, col 4) to (line 15, col 7) +-------------------------------- +15 > a--; + + ~~~~~~~~~ => Pos: (174 to 182) SpanInfo: {"start":178,"length":3} + >a-- + >:=> (line 15, col 4) to (line 15, col 7) +-------------------------------- +16 >} + ~ => Pos: (183 to 183) SpanInfo: {"start":178,"length":3} + >a-- + >:=> (line 15, col 4) to (line 15, col 7) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_with.baseline b/tests/baselines/reference/bpSpan_with.baseline new file mode 100644 index 00000000000..d4a00e7a3aa --- /dev/null +++ b/tests/baselines/reference/bpSpan_with.baseline @@ -0,0 +1,21 @@ + +1 >var obj: string; + + ~~~~~~~~~~~~~~~~~ => Pos: (0 to 16) SpanInfo: undefined +-------------------------------- +2 >with (obj) { + + ~~~~~~~~~~~~~ => Pos: (17 to 29) SpanInfo: {"start":34,"length":6} + >x = 10 + >:=> (line 3, col 4) to (line 3, col 10) +-------------------------------- +3 > x = 10; + + ~~~~~~~~~~~~ => Pos: (30 to 41) SpanInfo: {"start":34,"length":6} + >x = 10 + >:=> (line 3, col 4) to (line 3, col 10) +-------------------------------- +4 >} + ~ => Pos: (42 to 42) SpanInfo: {"start":34,"length":6} + >x = 10 + >:=> (line 3, col 4) to (line 3, col 10) \ No newline at end of file diff --git a/tests/baselines/reference/nameOrDottedSpan_classes.baseline b/tests/baselines/reference/nameOrDottedSpan_classes.baseline new file mode 100644 index 00000000000..88383c638a8 --- /dev/null +++ b/tests/baselines/reference/nameOrDottedSpan_classes.baseline @@ -0,0 +1,522 @@ + +1 >module Foo.Bar { + + ~~~~~~~ => Pos: (0 to 6) SpanInfo: undefined +1 >module Foo.Bar { + + ~~~~ => Pos: (7 to 10) SpanInfo: {"start":7,"length":3} + >Foo + >:=> (line 1, col 7) to (line 1, col 10) +1 >module Foo.Bar { + + ~~~~ => Pos: (11 to 14) SpanInfo: {"start":7,"length":7} + >Foo.Bar + >:=> (line 1, col 7) to (line 1, col 14) +1 >module Foo.Bar { + + ~~ => Pos: (15 to 16) SpanInfo: undefined +-------------------------------- +2 > "use strict"; + + ~~~~ => Pos: (17 to 20) SpanInfo: undefined +2 > "use strict"; + + ~~~~~~~~~~~~~ => Pos: (21 to 33) SpanInfo: {"start":21,"length":12} + >"use strict" + >:=> (line 2, col 4) to (line 2, col 16) +2 > "use strict"; + + ~ => Pos: (34 to 34) SpanInfo: undefined +-------------------------------- +3 > + + ~ => Pos: (35 to 35) SpanInfo: undefined +-------------------------------- +4 > class Greeter { + + ~~~~~~~~~~ => Pos: (36 to 45) SpanInfo: undefined +4 > class Greeter { + + ~~~~~~~~ => Pos: (46 to 53) SpanInfo: {"start":46,"length":7} + >Greeter + >:=> (line 4, col 10) to (line 4, col 17) +4 > class Greeter { + + ~~ => Pos: (54 to 55) SpanInfo: undefined +-------------------------------- +5 > constructor(public greeting: string) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (56 to 82) SpanInfo: undefined +5 > constructor(public greeting: string) { + + ~~~~~~~~~ => Pos: (83 to 91) SpanInfo: {"start":83,"length":8} + >greeting + >:=> (line 5, col 27) to (line 5, col 35) +5 > constructor(public greeting: string) { + + ~~~~~~~~~~~=> Pos: (92 to 102) SpanInfo: undefined +-------------------------------- +6 > } + + ~~~~~~~~~~ => Pos: (103 to 112) SpanInfo: undefined +-------------------------------- +7 > + + ~ => Pos: (113 to 113) SpanInfo: undefined +-------------------------------- +8 > greet() { + + ~~~~~~~~ => Pos: (114 to 121) SpanInfo: undefined +8 > greet() { + + ~~~~~~ => Pos: (122 to 127) SpanInfo: {"start":122,"length":5} + >greet + >:=> (line 8, col 8) to (line 8, col 13) +8 > greet() { + + ~~~~ => Pos: (128 to 131) SpanInfo: undefined +-------------------------------- +9 > return "

" + this.greeting + "

"; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (132 to 150) SpanInfo: undefined +9 > return "

" + this.greeting + "

"; + + ~~~~~~~ => Pos: (151 to 157) SpanInfo: {"start":151,"length":6} + >"

" + >:=> (line 9, col 19) to (line 9, col 25) +9 > return "

" + this.greeting + "

"; + + ~~ => Pos: (158 to 159) SpanInfo: undefined +9 > return "

" + this.greeting + "

"; + + ~~~~~ => Pos: (160 to 164) SpanInfo: {"start":160,"length":4} + >this + >:=> (line 9, col 28) to (line 9, col 32) +9 > return "

" + this.greeting + "

"; + + ~~~~~~~~~ => Pos: (165 to 173) SpanInfo: {"start":160,"length":13} + >this.greeting + >:=> (line 9, col 28) to (line 9, col 41) +9 > return "

" + this.greeting + "

"; + + ~~ => Pos: (174 to 175) SpanInfo: undefined +9 > return "

" + this.greeting + "

"; + + ~~~~~~~~=> Pos: (176 to 183) SpanInfo: {"start":176,"length":7} + >"" + >:=> (line 9, col 44) to (line 9, col 51) +9 > return "

" + this.greeting + "

"; + + ~=> Pos: (184 to 184) SpanInfo: undefined +-------------------------------- +10 > } + + ~~~~~~~~~~ => Pos: (185 to 194) SpanInfo: undefined +-------------------------------- +11 > } + + ~~~~~~ => Pos: (195 to 200) SpanInfo: undefined +-------------------------------- +12 > + + ~ => Pos: (201 to 201) SpanInfo: undefined +-------------------------------- +13 > + + ~ => Pos: (202 to 202) SpanInfo: undefined +-------------------------------- +14 > function foo(greeting: string): Greeter { + + ~~~~~~~~~~~~~ => Pos: (203 to 215) SpanInfo: undefined +14 > function foo(greeting: string): Greeter { + + ~~~~ => Pos: (216 to 219) SpanInfo: {"start":216,"length":3} + >foo + >:=> (line 14, col 13) to (line 14, col 16) +14 > function foo(greeting: string): Greeter { + + ~~~~~~~~~ => Pos: (220 to 228) SpanInfo: {"start":220,"length":8} + >greeting + >:=> (line 14, col 17) to (line 14, col 25) +14 > function foo(greeting: string): Greeter { + + ~~~~~~~~~~ => Pos: (229 to 238) SpanInfo: undefined +14 > function foo(greeting: string): Greeter { + + ~~~~~~~~ => Pos: (239 to 246) SpanInfo: {"start":239,"length":7} + >Greeter + >:=> (line 14, col 36) to (line 14, col 43) +14 > function foo(greeting: string): Greeter { + + ~~=> Pos: (247 to 248) SpanInfo: undefined +-------------------------------- +15 > return new Greeter(greeting); + + ~~~~~~~~~~~~~~~~~~~ => Pos: (249 to 267) SpanInfo: undefined +15 > return new Greeter(greeting); + + ~~~~~~~~ => Pos: (268 to 275) SpanInfo: {"start":268,"length":7} + >Greeter + >:=> (line 15, col 19) to (line 15, col 26) +15 > return new Greeter(greeting); + + ~~~~~~~~~ => Pos: (276 to 284) SpanInfo: {"start":276,"length":8} + >greeting + >:=> (line 15, col 27) to (line 15, col 35) +15 > return new Greeter(greeting); + + ~~ => Pos: (285 to 286) SpanInfo: undefined +-------------------------------- +16 > } + + ~~~~~~ => Pos: (287 to 292) SpanInfo: undefined +-------------------------------- +17 > + + ~ => Pos: (293 to 293) SpanInfo: undefined +-------------------------------- +18 > var greeter = new Greeter("Hello, world!"); + + ~~~~~~~~ => Pos: (294 to 301) SpanInfo: undefined +18 > var greeter = new Greeter("Hello, world!"); + + ~~~~~~~~ => Pos: (302 to 309) SpanInfo: {"start":302,"length":7} + >greeter + >:=> (line 18, col 8) to (line 18, col 15) +18 > var greeter = new Greeter("Hello, world!"); + + ~~~~~~ => Pos: (310 to 315) SpanInfo: undefined +18 > var greeter = new Greeter("Hello, world!"); + + ~~~~~~~~ => Pos: (316 to 323) SpanInfo: {"start":316,"length":7} + >Greeter + >:=> (line 18, col 22) to (line 18, col 29) +18 > var greeter = new Greeter("Hello, world!"); + + ~~~~~~~~~~~~~~~~=> Pos: (324 to 339) SpanInfo: {"start":324,"length":15} + >"Hello, world!" + >:=> (line 18, col 30) to (line 18, col 45) +18 > var greeter = new Greeter("Hello, world!"); + + ~~=> Pos: (340 to 341) SpanInfo: undefined +-------------------------------- +19 > var str = greeter.greet(); + + ~~~~~~~~ => Pos: (342 to 349) SpanInfo: undefined +19 > var str = greeter.greet(); + + ~~~~ => Pos: (350 to 353) SpanInfo: {"start":350,"length":3} + >str + >:=> (line 19, col 8) to (line 19, col 11) +19 > var str = greeter.greet(); + + ~~ => Pos: (354 to 355) SpanInfo: undefined +19 > var str = greeter.greet(); + + ~~~~~~~~ => Pos: (356 to 363) SpanInfo: {"start":356,"length":7} + >greeter + >:=> (line 19, col 14) to (line 19, col 21) +19 > var str = greeter.greet(); + + ~~~~~~ => Pos: (364 to 369) SpanInfo: {"start":356,"length":13} + >greeter.greet + >:=> (line 19, col 14) to (line 19, col 27) +19 > var str = greeter.greet(); + + ~~~ => Pos: (370 to 372) SpanInfo: undefined +-------------------------------- +20 > + + ~ => Pos: (373 to 373) SpanInfo: undefined +-------------------------------- +21 > function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) { + + ~~~~~~~~~~~~~ => Pos: (374 to 386) SpanInfo: undefined +21 > function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) { + + ~~~~~ => Pos: (387 to 391) SpanInfo: {"start":387,"length":4} + >foo2 + >:=> (line 21, col 13) to (line 21, col 17) +21 > function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) { + + ~~~~~~~~~ => Pos: (392 to 400) SpanInfo: {"start":392,"length":8} + >greeting + >:=> (line 21, col 18) to (line 21, col 26) +21 > function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) { + + ~~~~~~~~~~~~ => Pos: (401 to 412) SpanInfo: undefined +21 > function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) { + + ~~~~~~~~~~~~~~=> Pos: (413 to 426) SpanInfo: {"start":413,"length":13} + >restGreetings + >:=> (line 21, col 39) to (line 21, col 52) +21 > function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) { + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (427 to 459) SpanInfo: undefined +-------------------------------- +22 > var greeters: Greeter[] = []; /* inline block comment */ + + ~~~~~~~~~~~~ => Pos: (460 to 471) SpanInfo: undefined +22 > var greeters: Greeter[] = []; /* inline block comment */ + + ~~~~~~~~~ => Pos: (472 to 480) SpanInfo: {"start":472,"length":8} + >greeters + >:=> (line 22, col 12) to (line 22, col 20) +22 > var greeters: Greeter[] = []; /* inline block comment */ + + ~ => Pos: (481 to 481) SpanInfo: undefined +22 > var greeters: Greeter[] = []; /* inline block comment */ + + ~~~~~~~~ => Pos: (482 to 489) SpanInfo: {"start":482,"length":7} + >Greeter + >:=> (line 22, col 22) to (line 22, col 29) +22 > var greeters: Greeter[] = []; /* inline block comment */ + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (490 to 524) SpanInfo: undefined +-------------------------------- +23 > greeters[0] = new Greeter(greeting); + + ~~~~~~~~ => Pos: (525 to 532) SpanInfo: undefined +23 > greeters[0] = new Greeter(greeting); + + ~~~~~~~~~ => Pos: (533 to 541) SpanInfo: {"start":533,"length":8} + >greeters + >:=> (line 23, col 8) to (line 23, col 16) +23 > greeters[0] = new Greeter(greeting); + + ~~~~~~~~~ => Pos: (542 to 550) SpanInfo: undefined +23 > greeters[0] = new Greeter(greeting); + + ~~~~~~~~ => Pos: (551 to 558) SpanInfo: {"start":551,"length":7} + >Greeter + >:=> (line 23, col 26) to (line 23, col 33) +23 > greeters[0] = new Greeter(greeting); + + ~~~~~~~~~ => Pos: (559 to 567) SpanInfo: {"start":559,"length":8} + >greeting + >:=> (line 23, col 34) to (line 23, col 42) +23 > greeters[0] = new Greeter(greeting); + + ~~ => Pos: (568 to 569) SpanInfo: undefined +-------------------------------- +24 > for (var i = 0; i < restGreetings.length; i++) { + + ~~~~~~~~~~~~~~~~~ => Pos: (570 to 586) SpanInfo: undefined +24 > for (var i = 0; i < restGreetings.length; i++) { + + ~~ => Pos: (587 to 588) SpanInfo: {"start":587,"length":1} + >i + >:=> (line 24, col 17) to (line 24, col 18) +24 > for (var i = 0; i < restGreetings.length; i++) { + + ~~~~~ => Pos: (589 to 593) SpanInfo: undefined +24 > for (var i = 0; i < restGreetings.length; i++) { + + ~~ => Pos: (594 to 595) SpanInfo: {"start":594,"length":1} + >i + >:=> (line 24, col 24) to (line 24, col 25) +24 > for (var i = 0; i < restGreetings.length; i++) { + + ~~ => Pos: (596 to 597) SpanInfo: undefined +24 > for (var i = 0; i < restGreetings.length; i++) { + + ~~~~~~~~~~~~~~ => Pos: (598 to 611) SpanInfo: {"start":598,"length":13} + >restGreetings + >:=> (line 24, col 28) to (line 24, col 41) +24 > for (var i = 0; i < restGreetings.length; i++) { + + ~~~~~~~=> Pos: (612 to 618) SpanInfo: {"start":598,"length":20} + >restGreetings.length + >:=> (line 24, col 28) to (line 24, col 48) +24 > for (var i = 0; i < restGreetings.length; i++) { + + ~=> Pos: (619 to 619) SpanInfo: undefined +24 > for (var i = 0; i < restGreetings.length; i++) { + + ~~=> Pos: (620 to 621) SpanInfo: {"start":620,"length":1} + >i + >:=> (line 24, col 50) to (line 24, col 51) +24 > for (var i = 0; i < restGreetings.length; i++) { + + ~~~~~=> Pos: (622 to 626) SpanInfo: undefined +-------------------------------- +25 > greeters.push(new Greeter(restGreetings[i])); + + ~~~~~~~~~~~~ => Pos: (627 to 638) SpanInfo: undefined +25 > greeters.push(new Greeter(restGreetings[i])); + + ~~~~~~~~~ => Pos: (639 to 647) SpanInfo: {"start":639,"length":8} + >greeters + >:=> (line 25, col 12) to (line 25, col 20) +25 > greeters.push(new Greeter(restGreetings[i])); + + ~~~~~ => Pos: (648 to 652) SpanInfo: {"start":639,"length":13} + >greeters.push + >:=> (line 25, col 12) to (line 25, col 25) +25 > greeters.push(new Greeter(restGreetings[i])); + + ~~~~ => Pos: (653 to 656) SpanInfo: undefined +25 > greeters.push(new Greeter(restGreetings[i])); + + ~~~~~~~~ => Pos: (657 to 664) SpanInfo: {"start":657,"length":7} + >Greeter + >:=> (line 25, col 30) to (line 25, col 37) +25 > greeters.push(new Greeter(restGreetings[i])); + + ~~~~~~~~~~~~~~=> Pos: (665 to 678) SpanInfo: {"start":665,"length":13} + >restGreetings + >:=> (line 25, col 38) to (line 25, col 51) +25 > greeters.push(new Greeter(restGreetings[i])); + + ~~=> Pos: (679 to 680) SpanInfo: {"start":679,"length":1} + >i + >:=> (line 25, col 52) to (line 25, col 53) +25 > greeters.push(new Greeter(restGreetings[i])); + + ~~~~=> Pos: (681 to 684) SpanInfo: undefined +-------------------------------- +26 > } + + ~~~~~~~~~~ => Pos: (685 to 694) SpanInfo: undefined +-------------------------------- +27 > + + ~ => Pos: (695 to 695) SpanInfo: undefined +-------------------------------- +28 > return greeters; + + ~~~~~~~~~~~~~~~ => Pos: (696 to 710) SpanInfo: undefined +28 > return greeters; + + ~~~~~~~~~ => Pos: (711 to 719) SpanInfo: {"start":711,"length":8} + >greeters + >:=> (line 28, col 15) to (line 28, col 23) +28 > return greeters; + + ~ => Pos: (720 to 720) SpanInfo: undefined +-------------------------------- +29 > } + + ~~~~~~ => Pos: (721 to 726) SpanInfo: undefined +-------------------------------- +30 > + + ~ => Pos: (727 to 727) SpanInfo: undefined +-------------------------------- +31 > var b = foo2("Hello", "World", "!"); + + ~~~~~~~~ => Pos: (728 to 735) SpanInfo: undefined +31 > var b = foo2("Hello", "World", "!"); + + ~~ => Pos: (736 to 737) SpanInfo: {"start":736,"length":1} + >b + >:=> (line 31, col 8) to (line 31, col 9) +31 > var b = foo2("Hello", "World", "!"); + + ~~ => Pos: (738 to 739) SpanInfo: undefined +31 > var b = foo2("Hello", "World", "!"); + + ~~~~~ => Pos: (740 to 744) SpanInfo: {"start":740,"length":4} + >foo2 + >:=> (line 31, col 12) to (line 31, col 16) +31 > var b = foo2("Hello", "World", "!"); + + ~~~~~~~~ => Pos: (745 to 752) SpanInfo: {"start":745,"length":7} + >"Hello" + >:=> (line 31, col 17) to (line 31, col 24) +31 > var b = foo2("Hello", "World", "!"); + + ~ => Pos: (753 to 753) SpanInfo: undefined +31 > var b = foo2("Hello", "World", "!"); + + ~~~~~~~~ => Pos: (754 to 761) SpanInfo: {"start":754,"length":7} + >"World" + >:=> (line 31, col 26) to (line 31, col 33) +31 > var b = foo2("Hello", "World", "!"); + + ~ => Pos: (762 to 762) SpanInfo: undefined +31 > var b = foo2("Hello", "World", "!"); + + ~~~~ => Pos: (763 to 766) SpanInfo: {"start":763,"length":3} + >"!" + >:=> (line 31, col 35) to (line 31, col 38) +31 > var b = foo2("Hello", "World", "!"); + + ~~ => Pos: (767 to 768) SpanInfo: undefined +-------------------------------- +32 > // This is simple signle line comment + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (769 to 810) SpanInfo: undefined +-------------------------------- +33 > for (var j = 0; j < b.length; j++) { + + ~~~~~~~~~~~~~ => Pos: (811 to 823) SpanInfo: undefined +33 > for (var j = 0; j < b.length; j++) { + + ~~ => Pos: (824 to 825) SpanInfo: {"start":824,"length":1} + >j + >:=> (line 33, col 13) to (line 33, col 14) +33 > for (var j = 0; j < b.length; j++) { + + ~~~~~ => Pos: (826 to 830) SpanInfo: undefined +33 > for (var j = 0; j < b.length; j++) { + + ~~ => Pos: (831 to 832) SpanInfo: {"start":831,"length":1} + >j + >:=> (line 33, col 20) to (line 33, col 21) +33 > for (var j = 0; j < b.length; j++) { + + ~~ => Pos: (833 to 834) SpanInfo: undefined +33 > for (var j = 0; j < b.length; j++) { + + ~~ => Pos: (835 to 836) SpanInfo: {"start":835,"length":1} + >b + >:=> (line 33, col 24) to (line 33, col 25) +33 > for (var j = 0; j < b.length; j++) { + + ~~~~~~~ => Pos: (837 to 843) SpanInfo: {"start":835,"length":8} + >b.length + >:=> (line 33, col 24) to (line 33, col 32) +33 > for (var j = 0; j < b.length; j++) { + + ~ => Pos: (844 to 844) SpanInfo: undefined +33 > for (var j = 0; j < b.length; j++) { + + ~~ => Pos: (845 to 846) SpanInfo: {"start":845,"length":1} + >j + >:=> (line 33, col 34) to (line 33, col 35) +33 > for (var j = 0; j < b.length; j++) { + + ~~~~~ => Pos: (847 to 851) SpanInfo: undefined +-------------------------------- +34 > b[j].greet(); + + ~~~~~~~~ => Pos: (852 to 859) SpanInfo: undefined +34 > b[j].greet(); + + ~~ => Pos: (860 to 861) SpanInfo: {"start":860,"length":1} + >b + >:=> (line 34, col 8) to (line 34, col 9) +34 > b[j].greet(); + + ~~ => Pos: (862 to 863) SpanInfo: {"start":862,"length":1} + >j + >:=> (line 34, col 10) to (line 34, col 11) +34 > b[j].greet(); + + ~ => Pos: (864 to 864) SpanInfo: undefined +34 > b[j].greet(); + + ~~~~~~ => Pos: (865 to 870) SpanInfo: {"start":860,"length":10} + >b[j].greet + >:=> (line 34, col 8) to (line 34, col 18) +34 > b[j].greet(); + + ~~~ => Pos: (871 to 873) SpanInfo: undefined +-------------------------------- +35 > } + + ~~~~~~ => Pos: (874 to 879) SpanInfo: undefined +-------------------------------- +36 >} + ~ => Pos: (880 to 880) SpanInfo: undefined \ No newline at end of file diff --git a/tests/baselines/reference/nameOrDottedSpan_stmts.baseline b/tests/baselines/reference/nameOrDottedSpan_stmts.baseline new file mode 100644 index 00000000000..d0d35199e81 --- /dev/null +++ b/tests/baselines/reference/nameOrDottedSpan_stmts.baseline @@ -0,0 +1,884 @@ + +1 >function f() { + + ~~~~~~~~~ => Pos: (0 to 8) SpanInfo: undefined +1 >function f() { + + ~~ => Pos: (9 to 10) SpanInfo: {"start":9,"length":1} + >f + >:=> (line 1, col 9) to (line 1, col 10) +1 >function f() { + + ~~~~ => Pos: (11 to 14) SpanInfo: undefined +-------------------------------- +2 > var y; + + ~~~~~~~~ => Pos: (15 to 22) SpanInfo: undefined +2 > var y; + + ~~ => Pos: (23 to 24) SpanInfo: {"start":23,"length":1} + >y + >:=> (line 2, col 8) to (line 2, col 9) +2 > var y; + + ~ => Pos: (25 to 25) SpanInfo: undefined +-------------------------------- +3 > var x = 0; + + ~~~~~~~~ => Pos: (26 to 33) SpanInfo: undefined +3 > var x = 0; + + ~~ => Pos: (34 to 35) SpanInfo: {"start":34,"length":1} + >x + >:=> (line 3, col 8) to (line 3, col 9) +3 > var x = 0; + + ~~~~~ => Pos: (36 to 40) SpanInfo: undefined +-------------------------------- +4 > for (var i = 0; i < 10; i++) { + + ~~~~~~~~~~~~~ => Pos: (41 to 53) SpanInfo: undefined +4 > for (var i = 0; i < 10; i++) { + + ~~ => Pos: (54 to 55) SpanInfo: {"start":54,"length":1} + >i + >:=> (line 4, col 13) to (line 4, col 14) +4 > for (var i = 0; i < 10; i++) { + + ~~~~~ => Pos: (56 to 60) SpanInfo: undefined +4 > for (var i = 0; i < 10; i++) { + + ~~ => Pos: (61 to 62) SpanInfo: {"start":61,"length":1} + >i + >:=> (line 4, col 20) to (line 4, col 21) +4 > for (var i = 0; i < 10; i++) { + + ~~~~~~ => Pos: (63 to 68) SpanInfo: undefined +4 > for (var i = 0; i < 10; i++) { + + ~~ => Pos: (69 to 70) SpanInfo: {"start":69,"length":1} + >i + >:=> (line 4, col 28) to (line 4, col 29) +4 > for (var i = 0; i < 10; i++) { + + ~~~~~ => Pos: (71 to 75) SpanInfo: undefined +-------------------------------- +5 > x += i; + + ~~~~~~~~ => Pos: (76 to 83) SpanInfo: undefined +5 > x += i; + + ~~ => Pos: (84 to 85) SpanInfo: {"start":84,"length":1} + >x + >:=> (line 5, col 8) to (line 5, col 9) +5 > x += i; + + ~~~ => Pos: (86 to 88) SpanInfo: undefined +5 > x += i; + + ~~ => Pos: (89 to 90) SpanInfo: {"start":89,"length":1} + >i + >:=> (line 5, col 13) to (line 5, col 14) +5 > x += i; + + ~ => Pos: (91 to 91) SpanInfo: undefined +-------------------------------- +6 > x *= 0; + + ~~~~~~~~ => Pos: (92 to 99) SpanInfo: undefined +6 > x *= 0; + + ~~ => Pos: (100 to 101) SpanInfo: {"start":100,"length":1} + >x + >:=> (line 6, col 8) to (line 6, col 9) +6 > x *= 0; + + ~~~~~~ => Pos: (102 to 107) SpanInfo: undefined +-------------------------------- +7 > } + + ~~~~~~ => Pos: (108 to 113) SpanInfo: undefined +-------------------------------- +8 > if (x > 17) { + + ~~~~~~~~ => Pos: (114 to 121) SpanInfo: undefined +8 > if (x > 17) { + + ~~ => Pos: (122 to 123) SpanInfo: {"start":122,"length":1} + >x + >:=> (line 8, col 8) to (line 8, col 9) +8 > if (x > 17) { + + ~~~~~~~~ => Pos: (124 to 131) SpanInfo: undefined +-------------------------------- +9 > x /= 9; + + ~~~~~~~~ => Pos: (132 to 139) SpanInfo: undefined +9 > x /= 9; + + ~~ => Pos: (140 to 141) SpanInfo: {"start":140,"length":1} + >x + >:=> (line 9, col 8) to (line 9, col 9) +9 > x /= 9; + + ~~~~~~ => Pos: (142 to 147) SpanInfo: undefined +-------------------------------- +10 > } else { + + ~~~~~~~~~~~~~ => Pos: (148 to 160) SpanInfo: undefined +-------------------------------- +11 > x += 10; + + ~~~~~~~~ => Pos: (161 to 168) SpanInfo: undefined +11 > x += 10; + + ~~ => Pos: (169 to 170) SpanInfo: {"start":169,"length":1} + >x + >:=> (line 11, col 8) to (line 11, col 9) +11 > x += 10; + + ~~~~~~~ => Pos: (171 to 177) SpanInfo: undefined +-------------------------------- +12 > x++; + + ~~~~~~~~ => Pos: (178 to 185) SpanInfo: undefined +12 > x++; + + ~~ => Pos: (186 to 187) SpanInfo: {"start":186,"length":1} + >x + >:=> (line 12, col 8) to (line 12, col 9) +12 > x++; + + ~~~ => Pos: (188 to 190) SpanInfo: undefined +-------------------------------- +13 > } + + ~~~~~~ => Pos: (191 to 196) SpanInfo: undefined +-------------------------------- +14 > var a = [ + + ~~~~~~~~ => Pos: (197 to 204) SpanInfo: undefined +14 > var a = [ + + ~~ => Pos: (205 to 206) SpanInfo: {"start":205,"length":1} + >a + >:=> (line 14, col 8) to (line 14, col 9) +14 > var a = [ + + ~~~~ => Pos: (207 to 210) SpanInfo: undefined +-------------------------------- +15 > 1, + + ~~~~~~~~~~~ => Pos: (211 to 221) SpanInfo: undefined +-------------------------------- +16 > 2, + + ~~~~~~~~~~~ => Pos: (222 to 232) SpanInfo: undefined +-------------------------------- +17 > 3 + + ~~~~~~~~~~ => Pos: (233 to 242) SpanInfo: undefined +-------------------------------- +18 > ]; + + ~~~~~~~ => Pos: (243 to 249) SpanInfo: undefined +-------------------------------- +19 > var obj = { + + ~~~~~~~~ => Pos: (250 to 257) SpanInfo: undefined +19 > var obj = { + + ~~~~ => Pos: (258 to 261) SpanInfo: {"start":258,"length":3} + >obj + >:=> (line 19, col 8) to (line 19, col 11) +19 > var obj = { + + ~~~~ => Pos: (262 to 265) SpanInfo: undefined +-------------------------------- +20 > z: 1, + + ~~~~~~~~ => Pos: (266 to 273) SpanInfo: undefined +20 > z: 1, + + ~~ => Pos: (274 to 275) SpanInfo: {"start":274,"length":1} + >z + >:=> (line 20, col 8) to (line 20, col 9) +20 > z: 1, + + ~~~~ => Pos: (276 to 279) SpanInfo: undefined +-------------------------------- +21 > q: "hello" + + ~~~~~~~~ => Pos: (280 to 287) SpanInfo: undefined +21 > q: "hello" + + ~~ => Pos: (288 to 289) SpanInfo: {"start":288,"length":1} + >q + >:=> (line 21, col 8) to (line 21, col 9) +21 > q: "hello" + + ~ => Pos: (290 to 290) SpanInfo: undefined +21 > q: "hello" + + ~~~~~~~~ => Pos: (291 to 298) SpanInfo: {"start":291,"length":7} + >"hello" + >:=> (line 21, col 11) to (line 21, col 18) +-------------------------------- +22 > }; + + ~~~~~~~ => Pos: (299 to 305) SpanInfo: undefined +-------------------------------- +23 > for (var j in a) { + + ~~~~~~~~~~~~~ => Pos: (306 to 318) SpanInfo: undefined +23 > for (var j in a) { + + ~~ => Pos: (319 to 320) SpanInfo: {"start":319,"length":1} + >j + >:=> (line 23, col 13) to (line 23, col 14) +23 > for (var j in a) { + + ~~~ => Pos: (321 to 323) SpanInfo: undefined +23 > for (var j in a) { + + ~~ => Pos: (324 to 325) SpanInfo: {"start":324,"length":1} + >a + >:=> (line 23, col 18) to (line 23, col 19) +23 > for (var j in a) { + + ~~~ => Pos: (326 to 328) SpanInfo: undefined +-------------------------------- +24 > obj.z = a[j]; + + ~~~~~~~~ => Pos: (329 to 336) SpanInfo: undefined +24 > obj.z = a[j]; + + ~~~~ => Pos: (337 to 340) SpanInfo: {"start":337,"length":3} + >obj + >:=> (line 24, col 8) to (line 24, col 11) +24 > obj.z = a[j]; + + ~~ => Pos: (341 to 342) SpanInfo: {"start":337,"length":5} + >obj.z + >:=> (line 24, col 8) to (line 24, col 13) +24 > obj.z = a[j]; + + ~~ => Pos: (343 to 344) SpanInfo: undefined +24 > obj.z = a[j]; + + ~~ => Pos: (345 to 346) SpanInfo: {"start":345,"length":1} + >a + >:=> (line 24, col 16) to (line 24, col 17) +24 > obj.z = a[j]; + + ~~ => Pos: (347 to 348) SpanInfo: {"start":347,"length":1} + >j + >:=> (line 24, col 18) to (line 24, col 19) +24 > obj.z = a[j]; + + ~~ => Pos: (349 to 350) SpanInfo: undefined +-------------------------------- +25 > var v = 10; + + ~~~~~~~~~~~~ => Pos: (351 to 362) SpanInfo: undefined +25 > var v = 10; + + ~~ => Pos: (363 to 364) SpanInfo: {"start":363,"length":1} + >v + >:=> (line 25, col 12) to (line 25, col 13) +25 > var v = 10; + + ~~~~~~ => Pos: (365 to 370) SpanInfo: undefined +-------------------------------- +26 > } + + ~~~~~~ => Pos: (371 to 376) SpanInfo: undefined +-------------------------------- +27 > try { + + ~~~~~~~~~~ => Pos: (377 to 386) SpanInfo: undefined +-------------------------------- +28 > obj.q = "ohhh"; + + ~~~~~~~~ => Pos: (387 to 394) SpanInfo: undefined +28 > obj.q = "ohhh"; + + ~~~~ => Pos: (395 to 398) SpanInfo: {"start":395,"length":3} + >obj + >:=> (line 28, col 8) to (line 28, col 11) +28 > obj.q = "ohhh"; + + ~~ => Pos: (399 to 400) SpanInfo: {"start":395,"length":5} + >obj.q + >:=> (line 28, col 8) to (line 28, col 13) +28 > obj.q = "ohhh"; + + ~~ => Pos: (401 to 402) SpanInfo: undefined +28 > obj.q = "ohhh"; + + ~~~~~~~ => Pos: (403 to 409) SpanInfo: {"start":403,"length":6} + >"ohhh" + >:=> (line 28, col 16) to (line 28, col 22) +28 > obj.q = "ohhh"; + + ~ => Pos: (410 to 410) SpanInfo: undefined +-------------------------------- +29 > } catch (e) { + + ~~~~~~~~~~~~~ => Pos: (411 to 423) SpanInfo: undefined +29 > } catch (e) { + + ~~ => Pos: (424 to 425) SpanInfo: {"start":424,"length":1} + >e + >:=> (line 29, col 13) to (line 29, col 14) +29 > } catch (e) { + + ~~~ => Pos: (426 to 428) SpanInfo: undefined +-------------------------------- +30 > if (obj.z < 10) { + + ~~~~~~~~~~~~ => Pos: (429 to 440) SpanInfo: undefined +30 > if (obj.z < 10) { + + ~~~~ => Pos: (441 to 444) SpanInfo: {"start":441,"length":3} + >obj + >:=> (line 30, col 12) to (line 30, col 15) +30 > if (obj.z < 10) { + + ~~ => Pos: (445 to 446) SpanInfo: {"start":441,"length":5} + >obj.z + >:=> (line 30, col 12) to (line 30, col 17) +30 > if (obj.z < 10) { + + ~~~~~~~~ => Pos: (447 to 454) SpanInfo: undefined +-------------------------------- +31 > obj.z = 12; + + ~~~~~~~~~~~~ => Pos: (455 to 466) SpanInfo: undefined +31 > obj.z = 12; + + ~~~~ => Pos: (467 to 470) SpanInfo: {"start":467,"length":3} + >obj + >:=> (line 31, col 12) to (line 31, col 15) +31 > obj.z = 12; + + ~~ => Pos: (471 to 472) SpanInfo: {"start":467,"length":5} + >obj.z + >:=> (line 31, col 12) to (line 31, col 17) +31 > obj.z = 12; + + ~~~~~~ => Pos: (473 to 478) SpanInfo: undefined +-------------------------------- +32 > } else { + + ~~~~~~~~~~~~~~~~~ => Pos: (479 to 495) SpanInfo: undefined +-------------------------------- +33 > obj.q = "hmm"; + + ~~~~~~~~~~~~ => Pos: (496 to 507) SpanInfo: undefined +33 > obj.q = "hmm"; + + ~~~~ => Pos: (508 to 511) SpanInfo: {"start":508,"length":3} + >obj + >:=> (line 33, col 12) to (line 33, col 15) +33 > obj.q = "hmm"; + + ~~ => Pos: (512 to 513) SpanInfo: {"start":508,"length":5} + >obj.q + >:=> (line 33, col 12) to (line 33, col 17) +33 > obj.q = "hmm"; + + ~~ => Pos: (514 to 515) SpanInfo: undefined +33 > obj.q = "hmm"; + + ~~~~~~ => Pos: (516 to 521) SpanInfo: {"start":516,"length":5} + >"hmm" + >:=> (line 33, col 20) to (line 33, col 25) +33 > obj.q = "hmm"; + + ~ => Pos: (522 to 522) SpanInfo: undefined +-------------------------------- +34 > } + + ~~~~~~~~~~ => Pos: (523 to 532) SpanInfo: undefined +-------------------------------- +35 > } + + ~~~~~~ => Pos: (533 to 538) SpanInfo: undefined +-------------------------------- +36 > try { + + ~~~~~~~~~~ => Pos: (539 to 548) SpanInfo: undefined +-------------------------------- +37 > throw new Error(); + + ~~~~~~~~~~~~~~~~~~ => Pos: (549 to 566) SpanInfo: undefined +37 > throw new Error(); + + ~~~~~~ => Pos: (567 to 572) SpanInfo: {"start":567,"length":5} + >Error + >:=> (line 37, col 18) to (line 37, col 23) +37 > throw new Error(); + + ~~~ => Pos: (573 to 575) SpanInfo: undefined +-------------------------------- +38 > } catch (e1) { + + ~~~~~~~~~~~~~ => Pos: (576 to 588) SpanInfo: undefined +38 > } catch (e1) { + + ~~~ => Pos: (589 to 591) SpanInfo: {"start":589,"length":2} + >e1 + >:=> (line 38, col 13) to (line 38, col 15) +38 > } catch (e1) { + + ~~~ => Pos: (592 to 594) SpanInfo: undefined +-------------------------------- +39 > var b = e1; + + ~~~~~~~~~~~~ => Pos: (595 to 606) SpanInfo: undefined +39 > var b = e1; + + ~~ => Pos: (607 to 608) SpanInfo: {"start":607,"length":1} + >b + >:=> (line 39, col 12) to (line 39, col 13) +39 > var b = e1; + + ~~ => Pos: (609 to 610) SpanInfo: undefined +39 > var b = e1; + + ~~~ => Pos: (611 to 613) SpanInfo: {"start":611,"length":2} + >e1 + >:=> (line 39, col 16) to (line 39, col 18) +39 > var b = e1; + + ~ => Pos: (614 to 614) SpanInfo: undefined +-------------------------------- +40 > } finally { + + ~~~~~~~~~~~~~~~~ => Pos: (615 to 630) SpanInfo: undefined +-------------------------------- +41 > y = 70; + + ~~~~~~~~ => Pos: (631 to 638) SpanInfo: undefined +41 > y = 70; + + ~~ => Pos: (639 to 640) SpanInfo: {"start":639,"length":1} + >y + >:=> (line 41, col 8) to (line 41, col 9) +41 > y = 70; + + ~~~~~~ => Pos: (641 to 646) SpanInfo: undefined +-------------------------------- +42 > } + + ~~~~~~ => Pos: (647 to 652) SpanInfo: undefined +-------------------------------- +43 > with (obj) { + + ~~~~~~~~~~ => Pos: (653 to 662) SpanInfo: undefined +43 > with (obj) { + + ~~~~ => Pos: (663 to 666) SpanInfo: {"start":663,"length":3} + >obj + >:=> (line 43, col 10) to (line 43, col 13) +43 > with (obj) { + + ~~~ => Pos: (667 to 669) SpanInfo: undefined +-------------------------------- +44 > i = 2; + + ~~~~~~~~ => Pos: (670 to 677) SpanInfo: undefined +44 > i = 2; + + ~~ => Pos: (678 to 679) SpanInfo: {"start":678,"length":1} + >i + >:=> (line 44, col 8) to (line 44, col 9) +44 > i = 2; + + ~~~~~ => Pos: (680 to 684) SpanInfo: undefined +-------------------------------- +45 > z = 10; + + ~~~~~~~~ => Pos: (685 to 692) SpanInfo: undefined +45 > z = 10; + + ~~ => Pos: (693 to 694) SpanInfo: {"start":693,"length":1} + >z + >:=> (line 45, col 8) to (line 45, col 9) +45 > z = 10; + + ~~~~~~ => Pos: (695 to 700) SpanInfo: undefined +-------------------------------- +46 > } + + ~~~~~~ => Pos: (701 to 706) SpanInfo: undefined +-------------------------------- +47 > switch (obj.z) { + + ~~~~~~~~~~~~ => Pos: (707 to 718) SpanInfo: undefined +47 > switch (obj.z) { + + ~~~~ => Pos: (719 to 722) SpanInfo: {"start":719,"length":3} + >obj + >:=> (line 47, col 12) to (line 47, col 15) +47 > switch (obj.z) { + + ~~ => Pos: (723 to 724) SpanInfo: {"start":719,"length":5} + >obj.z + >:=> (line 47, col 12) to (line 47, col 17) +47 > switch (obj.z) { + + ~~~ => Pos: (725 to 727) SpanInfo: undefined +-------------------------------- +48 > case 0: { + + ~~~~~~~~~~~~~~~~~~ => Pos: (728 to 745) SpanInfo: undefined +-------------------------------- +49 > x++; + + ~~~~~~~~~~~~ => Pos: (746 to 757) SpanInfo: undefined +49 > x++; + + ~~ => Pos: (758 to 759) SpanInfo: {"start":758,"length":1} + >x + >:=> (line 49, col 12) to (line 49, col 13) +49 > x++; + + ~~~ => Pos: (760 to 762) SpanInfo: undefined +-------------------------------- +50 > break; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (763 to 781) SpanInfo: undefined +-------------------------------- +51 > + + ~ => Pos: (782 to 782) SpanInfo: undefined +-------------------------------- +52 > } + + ~~~~~~~~~~ => Pos: (783 to 792) SpanInfo: undefined +-------------------------------- +53 > case 1: { + + ~~~~~~~~~~~~~~~~~~ => Pos: (793 to 810) SpanInfo: undefined +-------------------------------- +54 > x--; + + ~~~~~~~~~~~~ => Pos: (811 to 822) SpanInfo: undefined +54 > x--; + + ~~ => Pos: (823 to 824) SpanInfo: {"start":823,"length":1} + >x + >:=> (line 54, col 12) to (line 54, col 13) +54 > x--; + + ~~~ => Pos: (825 to 827) SpanInfo: undefined +-------------------------------- +55 > break; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (828 to 846) SpanInfo: undefined +-------------------------------- +56 > + + ~ => Pos: (847 to 847) SpanInfo: undefined +-------------------------------- +57 > } + + ~~~~~~~~~~ => Pos: (848 to 857) SpanInfo: undefined +-------------------------------- +58 > default: { + + ~~~~~~~~~~~~~~~~~~~ => Pos: (858 to 876) SpanInfo: undefined +-------------------------------- +59 > x *= 2; + + ~~~~~~~~~~~~ => Pos: (877 to 888) SpanInfo: undefined +59 > x *= 2; + + ~~ => Pos: (889 to 890) SpanInfo: {"start":889,"length":1} + >x + >:=> (line 59, col 12) to (line 59, col 13) +59 > x *= 2; + + ~~~~~~ => Pos: (891 to 896) SpanInfo: undefined +-------------------------------- +60 > x = 50; + + ~~~~~~~~~~~~ => Pos: (897 to 908) SpanInfo: undefined +60 > x = 50; + + ~~ => Pos: (909 to 910) SpanInfo: {"start":909,"length":1} + >x + >:=> (line 60, col 12) to (line 60, col 13) +60 > x = 50; + + ~~~~~~ => Pos: (911 to 916) SpanInfo: undefined +-------------------------------- +61 > break; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (917 to 935) SpanInfo: undefined +-------------------------------- +62 > + + ~ => Pos: (936 to 936) SpanInfo: undefined +-------------------------------- +63 > } + + ~~~~~~~~~~ => Pos: (937 to 946) SpanInfo: undefined +-------------------------------- +64 > } + + ~~~~~~ => Pos: (947 to 952) SpanInfo: undefined +-------------------------------- +65 > while (x < 10) { + + ~~~~~~~~~~~ => Pos: (953 to 963) SpanInfo: undefined +65 > while (x < 10) { + + ~~ => Pos: (964 to 965) SpanInfo: {"start":964,"length":1} + >x + >:=> (line 65, col 11) to (line 65, col 12) +65 > while (x < 10) { + + ~~~~~~~~ => Pos: (966 to 973) SpanInfo: undefined +-------------------------------- +66 > x++; + + ~~~~~~~~ => Pos: (974 to 981) SpanInfo: undefined +66 > x++; + + ~~ => Pos: (982 to 983) SpanInfo: {"start":982,"length":1} + >x + >:=> (line 66, col 8) to (line 66, col 9) +66 > x++; + + ~~~ => Pos: (984 to 986) SpanInfo: undefined +-------------------------------- +67 > } + + ~~~~~~ => Pos: (987 to 992) SpanInfo: undefined +-------------------------------- +68 > do { + + ~~~~~~~~~ => Pos: (993 to 1001) SpanInfo: undefined +-------------------------------- +69 > x--; + + ~~~~~~~~ => Pos: (1002 to 1009) SpanInfo: undefined +69 > x--; + + ~~ => Pos: (1010 to 1011) SpanInfo: {"start":1010,"length":1} + >x + >:=> (line 69, col 8) to (line 69, col 9) +69 > x--; + + ~~~ => Pos: (1012 to 1014) SpanInfo: undefined +-------------------------------- +70 > } while (x > 4) + + ~~~~~~~~~~~~~ => Pos: (1015 to 1027) SpanInfo: undefined +70 > } while (x > 4) + + ~~ => Pos: (1028 to 1029) SpanInfo: {"start":1028,"length":1} + >x + >:=> (line 70, col 13) to (line 70, col 14) +70 > } while (x > 4) + + ~~~~~ => Pos: (1030 to 1034) SpanInfo: undefined +-------------------------------- +71 > x = y; + + ~~~~ => Pos: (1035 to 1038) SpanInfo: undefined +71 > x = y; + + ~~ => Pos: (1039 to 1040) SpanInfo: {"start":1039,"length":1} + >x + >:=> (line 71, col 4) to (line 71, col 5) +71 > x = y; + + ~~ => Pos: (1041 to 1042) SpanInfo: undefined +71 > x = y; + + ~~ => Pos: (1043 to 1044) SpanInfo: {"start":1043,"length":1} + >y + >:=> (line 71, col 8) to (line 71, col 9) +71 > x = y; + + ~ => Pos: (1045 to 1045) SpanInfo: undefined +-------------------------------- +72 > var z = (x == 1) ? x + 1 : x - 1; + + ~~~~~~~~ => Pos: (1046 to 1053) SpanInfo: undefined +72 > var z = (x == 1) ? x + 1 : x - 1; + + ~~ => Pos: (1054 to 1055) SpanInfo: {"start":1054,"length":1} + >z + >:=> (line 72, col 8) to (line 72, col 9) +72 > var z = (x == 1) ? x + 1 : x - 1; + + ~~~ => Pos: (1056 to 1058) SpanInfo: undefined +72 > var z = (x == 1) ? x + 1 : x - 1; + + ~~ => Pos: (1059 to 1060) SpanInfo: {"start":1059,"length":1} + >x + >:=> (line 72, col 13) to (line 72, col 14) +72 > var z = (x == 1) ? x + 1 : x - 1; + + ~~~~~~~~ => Pos: (1061 to 1068) SpanInfo: undefined +72 > var z = (x == 1) ? x + 1 : x - 1; + + ~~ => Pos: (1069 to 1070) SpanInfo: {"start":1069,"length":1} + >x + >:=> (line 72, col 23) to (line 72, col 24) +72 > var z = (x == 1) ? x + 1 : x - 1; + + ~~~~~~ => Pos: (1071 to 1076) SpanInfo: undefined +72 > var z = (x == 1) ? x + 1 : x - 1; + + ~~ => Pos: (1077 to 1078) SpanInfo: {"start":1077,"length":1} + >x + >:=> (line 72, col 31) to (line 72, col 32) +72 > var z = (x == 1) ? x + 1 : x - 1; + + ~~~~~ => Pos: (1079 to 1083) SpanInfo: undefined +-------------------------------- +73 > (x == 1) ? x + 1 : x - 1; + + ~~~~~ => Pos: (1084 to 1088) SpanInfo: undefined +73 > (x == 1) ? x + 1 : x - 1; + + ~~ => Pos: (1089 to 1090) SpanInfo: {"start":1089,"length":1} + >x + >:=> (line 73, col 5) to (line 73, col 6) +73 > (x == 1) ? x + 1 : x - 1; + + ~~~~~~~~ => Pos: (1091 to 1098) SpanInfo: undefined +73 > (x == 1) ? x + 1 : x - 1; + + ~~ => Pos: (1099 to 1100) SpanInfo: {"start":1099,"length":1} + >x + >:=> (line 73, col 15) to (line 73, col 16) +73 > (x == 1) ? x + 1 : x - 1; + + ~~~~~~ => Pos: (1101 to 1106) SpanInfo: undefined +73 > (x == 1) ? x + 1 : x - 1; + + ~~ => Pos: (1107 to 1108) SpanInfo: {"start":1107,"length":1} + >x + >:=> (line 73, col 23) to (line 73, col 24) +73 > (x == 1) ? x + 1 : x - 1; + + ~~~~~ => Pos: (1109 to 1113) SpanInfo: undefined +-------------------------------- +74 > x === 1; + + ~~~~ => Pos: (1114 to 1117) SpanInfo: undefined +74 > x === 1; + + ~~ => Pos: (1118 to 1119) SpanInfo: {"start":1118,"length":1} + >x + >:=> (line 74, col 4) to (line 74, col 5) +74 > x === 1; + + ~~~~~~~ => Pos: (1120 to 1126) SpanInfo: undefined +-------------------------------- +75 > x = z = 40; + + ~~~~ => Pos: (1127 to 1130) SpanInfo: undefined +75 > x = z = 40; + + ~~ => Pos: (1131 to 1132) SpanInfo: {"start":1131,"length":1} + >x + >:=> (line 75, col 4) to (line 75, col 5) +75 > x = z = 40; + + ~~ => Pos: (1133 to 1134) SpanInfo: undefined +75 > x = z = 40; + + ~~ => Pos: (1135 to 1136) SpanInfo: {"start":1135,"length":1} + >z + >:=> (line 75, col 8) to (line 75, col 9) +75 > x = z = 40; + + ~~~~~~ => Pos: (1137 to 1142) SpanInfo: undefined +-------------------------------- +76 > eval("y"); + + ~~~~ => Pos: (1143 to 1146) SpanInfo: undefined +76 > eval("y"); + + ~~~~~ => Pos: (1147 to 1151) SpanInfo: {"start":1147,"length":4} + >eval + >:=> (line 76, col 4) to (line 76, col 8) +76 > eval("y"); + + ~~~~ => Pos: (1152 to 1155) SpanInfo: {"start":1152,"length":3} + >"y" + >:=> (line 76, col 9) to (line 76, col 12) +76 > eval("y"); + + ~~ => Pos: (1156 to 1157) SpanInfo: undefined +-------------------------------- +77 > return; + + ~~~~~~~~~~~~ => Pos: (1158 to 1169) SpanInfo: undefined +-------------------------------- +78 >} + + ~~ => Pos: (1170 to 1171) SpanInfo: undefined +-------------------------------- +79 >var b = function () { + + ~~~~ => Pos: (1172 to 1175) SpanInfo: undefined +79 >var b = function () { + + ~~ => Pos: (1176 to 1177) SpanInfo: {"start":1176,"length":1} + >b + >:=> (line 79, col 4) to (line 79, col 5) +79 >var b = function () { + + ~~~~~~~~~~~~~~~~ => Pos: (1178 to 1193) SpanInfo: undefined +-------------------------------- +80 > var x = 10; + + ~~~~~~~~ => Pos: (1194 to 1201) SpanInfo: undefined +80 > var x = 10; + + ~~ => Pos: (1202 to 1203) SpanInfo: {"start":1202,"length":1} + >x + >:=> (line 80, col 8) to (line 80, col 9) +80 > var x = 10; + + ~~~~~~ => Pos: (1204 to 1209) SpanInfo: undefined +-------------------------------- +81 > x = x + 1; + + ~~~~ => Pos: (1210 to 1213) SpanInfo: undefined +81 > x = x + 1; + + ~~ => Pos: (1214 to 1215) SpanInfo: {"start":1214,"length":1} + >x + >:=> (line 81, col 4) to (line 81, col 5) +81 > x = x + 1; + + ~~ => Pos: (1216 to 1217) SpanInfo: undefined +81 > x = x + 1; + + ~~ => Pos: (1218 to 1219) SpanInfo: {"start":1218,"length":1} + >x + >:=> (line 81, col 8) to (line 81, col 9) +81 > x = x + 1; + + ~~~~~ => Pos: (1220 to 1224) SpanInfo: undefined +-------------------------------- +82 >}; + + ~~~ => Pos: (1225 to 1227) SpanInfo: undefined +-------------------------------- +83 >f(); + ~~ => Pos: (1228 to 1229) SpanInfo: {"start":1228,"length":1} + >f + >:=> (line 83, col 0) to (line 83, col 1) +83 >f(); + ~~ => Pos: (1230 to 1231) SpanInfo: undefined \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationArrayLiteralExpressions.ts b/tests/cases/fourslash/breakpointValidationArrayLiteralExpressions.ts new file mode 100644 index 00000000000..efa3e6fbef2 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationArrayLiteralExpressions.ts @@ -0,0 +1,23 @@ +/// + +// @BaselineFile: bpSpan_arrayLiteralExpressions.baseline +// @Filename: bpSpan_arrayLiteralExpressions.ts +////var a = [10, 20, 30]; +////function foo(a: number) { +//// return a; +////} +////a = [foo(30), (function () { +//// return 30; +////})()]; +////function bar() { +//// return a; +////} +////var x = bar()[0]; +////x = (function () { +//// return a; +////})()[x]; +////a[(function () { +//// return x; +////})()]; + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationBinaryExpressions.ts b/tests/cases/fourslash/breakpointValidationBinaryExpressions.ts new file mode 100644 index 00000000000..55cc6ea3ee7 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationBinaryExpressions.ts @@ -0,0 +1,17 @@ +/// + +// @BaselineFile: bpSpan_binaryExpressions.baseline +// @Filename: bpSpan_binaryExpressions.ts +////var x = 10; +////var y = 20; +////x += 30; +////x *= 0; +////x = x + 1; +////x = (function foo() { +//// return y; +////})() + y; +////x = y + 30 + (function foo() { +//// return y; +////})() * 40; + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationBreakOrContinue.ts b/tests/cases/fourslash/breakpointValidationBreakOrContinue.ts new file mode 100644 index 00000000000..f3e92a88dfb --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationBreakOrContinue.ts @@ -0,0 +1,17 @@ +/// + +// @BaselineFile: bpSpan_breakOrContinue.baseline +// @Filename: bpSpan_breakOrContinue.ts +////while (true) { +//// break; +////} +////y: while (true) { +//// break y; +////} +////while (true) { +//// continue; +////} +////z: while (true) { +//// continue z; +////} +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationClass.ts b/tests/cases/fourslash/breakpointValidationClass.ts new file mode 100644 index 00000000000..99209c465b2 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationClass.ts @@ -0,0 +1,53 @@ +/// + +// @BaselineFile: bpSpan_class.baseline +// @Filename: bpSpan_class.ts +////class Greeter { +//// constructor(public greeting: string, ...b: string[]) { +//// } +//// greet() { +//// return "

" + this.greeting + "

"; +//// } +//// private x: string; +//// private x1: number = 10; +//// private fn() { +//// return this.greeting; +//// } +//// get greetings() { +//// return this.greeting; +//// } +//// set greetings(greetings: string) { +//// this.greeting = greetings; +//// } +////} +////class Greeter2 { +////} +////class Greeter1 +////{ +//// constructor(public greeting: string, ...b: string[]) +//// { +//// } +//// greet() +//// { +//// return "

" + this.greeting + "

"; +//// } +//// private x: string; +//// private x1: number = 10; +//// private fn() +//// { +//// return this.greeting; +//// } +//// get greetings() +//// { +//// return this.greeting; +//// } +//// set greetings(greetings: string) +//// { +//// this.greeting = greetings; +//// } +////} +////class Greeter12 +////{ +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/breakpointValidationClassAmbient.ts b/tests/cases/fourslash/breakpointValidationClassAmbient.ts similarity index 100% rename from tests/cases/fourslash_old/breakpointValidationClassAmbient.ts rename to tests/cases/fourslash/breakpointValidationClassAmbient.ts diff --git a/tests/cases/fourslash_old/breakpointValidationClasses.ts b/tests/cases/fourslash/breakpointValidationClasses.ts similarity index 100% rename from tests/cases/fourslash_old/breakpointValidationClasses.ts rename to tests/cases/fourslash/breakpointValidationClasses.ts diff --git a/tests/cases/fourslash/breakpointValidationConditionalExpressions.ts b/tests/cases/fourslash/breakpointValidationConditionalExpressions.ts new file mode 100644 index 00000000000..81a19f3fab1 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationConditionalExpressions.ts @@ -0,0 +1,16 @@ +/// + +// @BaselineFile: bpSpan_conditionalExpressions.baseline +// @Filename: bpSpan_conditionalExpressions.ts +////var x = 10; +////var y = x ? x + 10 : 30; +////var z = (function foo() { +//// return x; +////})() ? y : function bar() { +//// return x; +////} (); +////x = y ? (function () { +//// return z; +////})() : 10; + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/breakpointValidationDebugger.ts b/tests/cases/fourslash/breakpointValidationDebugger.ts similarity index 100% rename from tests/cases/fourslash_old/breakpointValidationDebugger.ts rename to tests/cases/fourslash/breakpointValidationDebugger.ts diff --git a/tests/cases/fourslash/breakpointValidationDo.ts b/tests/cases/fourslash/breakpointValidationDo.ts new file mode 100644 index 00000000000..ce7863a78e2 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationDo.ts @@ -0,0 +1,22 @@ +/// + +// @BaselineFile: bpSpan_do.baseline +// @Filename: bpSpan_do.ts +////var i = 0; +////do +////{ +//// i++; +////} while (i < 10); +////do { +//// i++; +////} while (i < 20); +////do { +//// i++; +////} +////while (i < 30); +////do { +//// i--; +////} while ((function () { +//// return 30 * i; +//// })() !== i); +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationEnums.ts b/tests/cases/fourslash/breakpointValidationEnums.ts new file mode 100644 index 00000000000..9d45462013a --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationEnums.ts @@ -0,0 +1,48 @@ +/// + +// @BaselineFile: bpSpan_enums.baseline +// @Filename: bpSpan_enums.ts +////enum e { +//// x, +//// y, +//// x +////} +////enum e2 { +//// x = 10, +//// y = 10, +//// z, +//// x2 +////} +////enum e3 { +////} +////declare enum e4 { +//// x, +//// y, +//// z, +//// x2 +////} +////enum e11 +////{ +//// x, +//// y, +//// x +////} +////enum e12 +////{ +//// x = 10, +//// y = 10, +//// z, +//// x2 +////} +////enum e13 +////{ +////} +////declare enum e14 +////{ +//// x, +//// y, +//// z, +//// x2 +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/breakpointValidationExportAssignment.ts b/tests/cases/fourslash/breakpointValidationExportAssignment.ts similarity index 100% rename from tests/cases/fourslash_old/breakpointValidationExportAssignment.ts rename to tests/cases/fourslash/breakpointValidationExportAssignment.ts diff --git a/tests/cases/fourslash_old/breakpointValidationFor.ts b/tests/cases/fourslash/breakpointValidationFor.ts similarity index 100% rename from tests/cases/fourslash_old/breakpointValidationFor.ts rename to tests/cases/fourslash/breakpointValidationFor.ts diff --git a/tests/cases/fourslash_old/breakpointValidationForIn.ts b/tests/cases/fourslash/breakpointValidationForIn.ts similarity index 66% rename from tests/cases/fourslash_old/breakpointValidationForIn.ts rename to tests/cases/fourslash/breakpointValidationForIn.ts index da15dd61f10..924433520c7 100644 --- a/tests/cases/fourslash_old/breakpointValidationForIn.ts +++ b/tests/cases/fourslash/breakpointValidationForIn.ts @@ -16,5 +16,11 @@ ////{ //// WScript.Echo(x); ////} +////var z = 10; +////for (x in function foo() { +//// return new String(); +////}) { +//// z++; +////} verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/breakpointValidationFunctionExpressions.ts b/tests/cases/fourslash/breakpointValidationFunctionExpressions.ts similarity index 50% rename from tests/cases/fourslash_old/breakpointValidationFunctionExpressions.ts rename to tests/cases/fourslash/breakpointValidationFunctionExpressions.ts index e47a56cc08f..c4b145270a8 100644 --- a/tests/cases/fourslash_old/breakpointValidationFunctionExpressions.ts +++ b/tests/cases/fourslash/breakpointValidationFunctionExpressions.ts @@ -10,5 +10,17 @@ ////greet("Hello"); ////var incrGreetings = () => greetings++; ////var greetNewMsg = msg => greet(msg); -debugger; +////greetNewMsg = function (msg: string) { +//// return greet(msg); +////}; +////function bar(a = function foo() { +//// return greetings; +////}) { +//// if (!a()) { +//// return a; +//// } +//// return function bar() { +//// return -greetings; +//// }; +////} verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationFunctions.ts b/tests/cases/fourslash/breakpointValidationFunctions.ts new file mode 100644 index 00000000000..0f38394d8e0 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationFunctions.ts @@ -0,0 +1,49 @@ +/// + +// @BaselineFile: bpSpan_functions.baseline +// @Filename: bpSpan_functions.ts +////var greetings = 0; +////function greet(greeting: string): number { +//// greetings++; +//// return greetings; +////} +////function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { +//// greetings++; +//// return greetings; +////} +////function foo(greeting: string, n = 10, x?: string, ...restParams: string[]) +////{ +//// return; +////} +////module m { +//// var greetings = 0; +//// function greet(greeting: string): number { +//// greetings++; +//// return greetings; +//// } +//// function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { +//// greetings++; +//// return greetings; +//// } +//// function foo(greeting: string, n = 10, x?: string, ...restParams: string[]) +//// { +//// return; +//// } +////} +////module m1 { +//// var greetings = 0; +//// export function greet(greeting: string): number { +//// greetings++; +//// return greetings; +//// } +//// export function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { +//// greetings++; +//// return greetings; +//// } +//// export function foo(greeting: string, n = 10, x?: string, ...restParams: string[]) +//// { +//// return; +//// } +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/breakpointValidationIfElse.ts b/tests/cases/fourslash/breakpointValidationIfElse.ts similarity index 69% rename from tests/cases/fourslash_old/breakpointValidationIfElse.ts rename to tests/cases/fourslash/breakpointValidationIfElse.ts index 6df1b844a70..1b5bbc93fb8 100644 --- a/tests/cases/fourslash_old/breakpointValidationIfElse.ts +++ b/tests/cases/fourslash/breakpointValidationIfElse.ts @@ -19,4 +19,9 @@ ////} else { //// i--; ////} +////if (function foo() { +//// return 30; +////} ()) { +//// i++; +////} verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/breakpointValidationImport.ts b/tests/cases/fourslash/breakpointValidationImport.ts similarity index 100% rename from tests/cases/fourslash_old/breakpointValidationImport.ts rename to tests/cases/fourslash/breakpointValidationImport.ts diff --git a/tests/cases/fourslash/breakpointValidationInBlankLine.ts b/tests/cases/fourslash/breakpointValidationInBlankLine.ts new file mode 100644 index 00000000000..03814fd8157 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationInBlankLine.ts @@ -0,0 +1,9 @@ +/// + +// @BaselineFile: bpSpan_inBlankLine.baseline +// @Filename: bpSpan_inBlankLine.ts +////var x = 10; +//// +////var y = 10; + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationInComments.ts b/tests/cases/fourslash/breakpointValidationInComments.ts new file mode 100644 index 00000000000..3369db00eeb --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationInComments.ts @@ -0,0 +1,10 @@ +/// + +// @BaselineFile: bpSpan_inComments.baseline +// @Filename: bpSpan_inComments.ts +/////*comment here*/ var x = 10; /*comment here*/ +////// comment only line +/////*multiline comment +////another line of multiline comment */ var y = 10; // comment here + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationInterface.ts b/tests/cases/fourslash/breakpointValidationInterface.ts new file mode 100644 index 00000000000..07c34190fa8 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationInterface.ts @@ -0,0 +1,29 @@ +/// + +// @BaselineFile: bpSpan_interface.baseline +// @Filename: bpSpan_interface.ts +////interface I { +//// property: string; +//// method(): number; +//// (a: string): string; +//// new (a: string): I; +//// [a: number]: number; +////} +////module m { +//// interface I1 { +//// property: string; +//// method(): number; +//// (a: string): string; +//// new (a: string): I; +//// [a: number]: number; +//// } +//// export interface I2 { +//// property: string; +//// method(): number; +//// (a: string): string; +//// new (a: string): I; +//// [a: number]: number; +//// } +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/breakpointValidationLabeled.ts b/tests/cases/fourslash/breakpointValidationLabeled.ts similarity index 100% rename from tests/cases/fourslash_old/breakpointValidationLabeled.ts rename to tests/cases/fourslash/breakpointValidationLabeled.ts diff --git a/tests/cases/fourslash/breakpointValidationModule.ts b/tests/cases/fourslash/breakpointValidationModule.ts new file mode 100644 index 00000000000..3427cef72b3 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationModule.ts @@ -0,0 +1,42 @@ +/// + +// @BaselineFile: bpSpan_module.baseline +// @Filename: bpSpan_module.ts +////module m2 { +//// var a = 10; +//// a++; +////} +////module m3 { +//// module m4 { +//// export var x = 30; +//// } +//// +//// export function foo() { +//// return m4.x; +//// } +////} +////module m4 { +//// interface I { } +////} +////module m12 +////{ +//// var a = 10; +//// a++; +////} +////module m13 +////{ +//// module m14 +//// { +//// export var x = 30; +//// } +//// +//// export function foo() { +//// return m4.x; +//// } +////} +////module m14 +////{ +//// interface I { } +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/breakpointValidationModuleAmbient.ts b/tests/cases/fourslash/breakpointValidationModuleAmbient.ts similarity index 100% rename from tests/cases/fourslash_old/breakpointValidationModuleAmbient.ts rename to tests/cases/fourslash/breakpointValidationModuleAmbient.ts diff --git a/tests/cases/fourslash_old/breakpointValidationModuleEmpty.ts b/tests/cases/fourslash/breakpointValidationModuleEmpty.ts similarity index 100% rename from tests/cases/fourslash_old/breakpointValidationModuleEmpty.ts rename to tests/cases/fourslash/breakpointValidationModuleEmpty.ts diff --git a/tests/cases/fourslash/breakpointValidationObjectLiteralExpressions.ts b/tests/cases/fourslash/breakpointValidationObjectLiteralExpressions.ts new file mode 100644 index 00000000000..fa05a09187c --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationObjectLiteralExpressions.ts @@ -0,0 +1,33 @@ +/// + +// @BaselineFile: bpSpan_objectLiteralExpressions.baseline +// @Filename: bpSpan_objectLiteralExpressions.ts +////var x = { +//// a: 10, +//// b: () => 10, +//// someMethod() { +//// return "Hello"; +//// }, +//// get y() { +//// return 30; +//// }, +//// set z(x: number) { +//// var bar = x; +//// } +////}; +////var a = ({ +//// a: 10, +//// b: () => 10, +//// someMethod() { +//// return "Hello"; +//// }, +//// get y() { +//// return 30; +//// }, +//// set z(x: number) { +//// var bar = x; +//// } +////}).someMethod; +////a(); + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationParenCallOrNewExpressions.ts b/tests/cases/fourslash/breakpointValidationParenCallOrNewExpressions.ts new file mode 100644 index 00000000000..874a848f461 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationParenCallOrNewExpressions.ts @@ -0,0 +1,35 @@ +/// + +// @BaselineFile: bpSpan_parenCallOrNewExpressions.baseline +// @Filename: bpSpan_parenCallOrNewExpressions.ts +////function foo(a: number) { +//// return a; +////} +////foo((function bar() { +//// return foo(40); +////})()); +////var y = foo((function () { +//// return foo(40); +////})());; +////class greeter { +//// constructor(a: number) { +//// } +////} +////foo(30); +////foo(40 + y); +////y = foo(30); +////y = foo(500 + y); +////new greeter((function bar() { +//// return foo(40); +////})()); +////var anotherGreeter = new greeter((function bar() { +//// return foo(40); +////})()); +////anotherGreeter = new greeter(30); +////anotherGreeter = new greeter(40 + y); +////new greeter(30); +////new greeter(40 + y); +////function foo2(x: number, y: string) { +////} +////foo2(foo(30), foo(40).toString()); +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/breakpointValidationStatements.ts b/tests/cases/fourslash/breakpointValidationStatements.ts similarity index 100% rename from tests/cases/fourslash_old/breakpointValidationStatements.ts rename to tests/cases/fourslash/breakpointValidationStatements.ts diff --git a/tests/cases/fourslash_old/breakpointValidationSwitch.ts b/tests/cases/fourslash/breakpointValidationSwitch.ts similarity index 70% rename from tests/cases/fourslash_old/breakpointValidationSwitch.ts rename to tests/cases/fourslash/breakpointValidationSwitch.ts index 82c5fff9dea..6fbe676d67a 100644 --- a/tests/cases/fourslash_old/breakpointValidationSwitch.ts +++ b/tests/cases/fourslash/breakpointValidationSwitch.ts @@ -31,4 +31,12 @@ //// x = x * 10; //// } ////} +////switch ((function foo() { +//// return x * 30; +////})()) { +//// case (function bar() { +//// return 30; +//// })(): +//// x++; +////} verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/breakpointValidationTryCatchFinally.ts b/tests/cases/fourslash/breakpointValidationTryCatchFinally.ts similarity index 65% rename from tests/cases/fourslash_old/breakpointValidationTryCatchFinally.ts rename to tests/cases/fourslash/breakpointValidationTryCatchFinally.ts index bbeab4f6b00..3aa2b499542 100644 --- a/tests/cases/fourslash_old/breakpointValidationTryCatchFinally.ts +++ b/tests/cases/fourslash/breakpointValidationTryCatchFinally.ts @@ -24,5 +24,13 @@ ////{ //// x = x * 10; ////} +////try { +//// throw (function foo() { +//// new Error(x.toString()); +//// })(); +////} +////finally { +//// x++; +////} verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationTypeAssertionExpressions.ts b/tests/cases/fourslash/breakpointValidationTypeAssertionExpressions.ts new file mode 100644 index 00000000000..9d79f1e3fb3 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationTypeAssertionExpressions.ts @@ -0,0 +1,13 @@ +/// + +// @BaselineFile: bpSpan_typeAssertionExpressions.baseline +// @Filename: bpSpan_typeAssertionExpressions.ts +////class Greeter { +////} +////var a = new Greeter(); +////a = ( new Greeter()); +////a = (function foo() { +//// return new Greeter(); +////})(); + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationUnaryExpressions.ts b/tests/cases/fourslash/breakpointValidationUnaryExpressions.ts new file mode 100644 index 00000000000..8b937154516 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationUnaryExpressions.ts @@ -0,0 +1,15 @@ +/// + +// @BaselineFile: bpSpan_unaryExpressions.baseline +// @Filename: bpSpan_unaryExpressions.ts +////var x = 10; +////var y = 20; +////x++; +////y--; +////typeof (function foo() { +//// return y; +////})(); +////++x; +////++y; + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationVariables.ts b/tests/cases/fourslash/breakpointValidationVariables.ts new file mode 100644 index 00000000000..054826e7e09 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationVariables.ts @@ -0,0 +1,18 @@ +/// + +// @BaselineFile: bpSpan_variables.baseline +// @Filename: bpSpan_variables.ts +////var a = 10; +////var b; +////var c = 10, d, e; +////var c2, d2 = 10; +////module m { +//// var x1; +//// var x2 = 10, x3 = 10; +//// var x4, x5; +//// export var xx1; +//// export var xx2 = 10, xx3 = 10; +//// export var xx4, xx5; +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationWhile.ts b/tests/cases/fourslash/breakpointValidationWhile.ts new file mode 100644 index 00000000000..fa472b77ed3 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationWhile.ts @@ -0,0 +1,22 @@ +/// + +// @BaselineFile: bpSpan_while.baseline +// @Filename: bpSpan_while.ts +////var a = 10; +////while (a == 10) { +//// a++; +////} +////while (a == 10) +////{ +//// a++; +////} +////while (a == 10) a++; +////while (a == 10) +//// a++; +////while ((function () { +//// return 30 * a; +////})() !== a) { +//// a--; +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationWith.ts b/tests/cases/fourslash/breakpointValidationWith.ts new file mode 100644 index 00000000000..84e729d8efe --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationWith.ts @@ -0,0 +1,10 @@ +/// + +// @BaselineFile: bpSpan_with.baseline +// @Filename: bpSpan_with.ts +////var obj: string; +////with (obj) { +//// x = 10; +////} + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/nameOrDottedNameClasses.ts b/tests/cases/fourslash/nameOrDottedNameClasses.ts similarity index 100% rename from tests/cases/fourslash_old/nameOrDottedNameClasses.ts rename to tests/cases/fourslash/nameOrDottedNameClasses.ts diff --git a/tests/cases/fourslash_old/nameOrDottedNameStatements.ts b/tests/cases/fourslash/nameOrDottedNameStatements.ts similarity index 100% rename from tests/cases/fourslash_old/nameOrDottedNameStatements.ts rename to tests/cases/fourslash/nameOrDottedNameStatements.ts diff --git a/tests/cases/fourslash_old/breakpointValidationClass.ts b/tests/cases/fourslash_old/breakpointValidationClass.ts deleted file mode 100644 index e9104bc6d27..00000000000 --- a/tests/cases/fourslash_old/breakpointValidationClass.ts +++ /dev/null @@ -1,23 +0,0 @@ -/// - -// @BaselineFile: bpSpan_class.baseline -// @Filename: bpSpan_class.ts -////class Greeter { -//// constructor(public greeting: string, ...b: string[]) { -//// } -//// greet() { -//// return "

" + this.greeting + "

"; -//// } -//// private x: string; -//// private x1: number = 10; -//// private fn() { -//// return this.greeting; -//// } -//// get greetings() { -//// return this.greeting; -//// } -//// set greetings(greetings: string) { -//// this.greeting = greetings; -//// } -////} -verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/breakpointValidationDo.ts b/tests/cases/fourslash_old/breakpointValidationDo.ts deleted file mode 100644 index 0c1c28b4b44..00000000000 --- a/tests/cases/fourslash_old/breakpointValidationDo.ts +++ /dev/null @@ -1,14 +0,0 @@ -/// - -// @BaselineFile: bpSpan_do.baseline -// @Filename: bpSpan_do.ts -////var i = 0; -////do -////{ -//// i++; -////} while (i < 10); -////do { -//// i++; -////} while (i < 20); - -verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/breakpointValidationEnums.ts b/tests/cases/fourslash_old/breakpointValidationEnums.ts deleted file mode 100644 index 4423941b1e4..00000000000 --- a/tests/cases/fourslash_old/breakpointValidationEnums.ts +++ /dev/null @@ -1,19 +0,0 @@ -/// - -// @BaselineFile: bpSpan_enums.baseline -// @Filename: bpSpan_enums.ts -////enum e { -//// x, -//// y, -//// x -////} -////enum e2 { -//// x = 10, -//// y = 10, -//// z, -//// x2 -////} -////enum e3 { -////} - -verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/breakpointValidationFunctions.ts b/tests/cases/fourslash_old/breakpointValidationFunctions.ts deleted file mode 100644 index 4ab0c7c577e..00000000000 --- a/tests/cases/fourslash_old/breakpointValidationFunctions.ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -// @BaselineFile: bpSpan_functions.baseline -// @Filename: bpSpan_functions.ts -////var greetings = 0; -////function greet(greeting: string): number { -//// greetings++; -//// return greetings; -////} -////function greet2(greeting: string, n = 10, x?: string, ...restParams: string[]): number { -//// greetings++; -//// return greetings; -////} -////function foo(greeting: string, n = 10, x?: string, ...restParams: string[]) -////{ -//// return; -////} -verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/breakpointValidationModule.ts b/tests/cases/fourslash_old/breakpointValidationModule.ts deleted file mode 100644 index ec862853f84..00000000000 --- a/tests/cases/fourslash_old/breakpointValidationModule.ts +++ /dev/null @@ -1,19 +0,0 @@ -/// - -// @BaselineFile: bpSpan_module.baseline -// @Filename: bpSpan_module.ts -////module m2 { -//// var a = 10; -//// a++; -////} -////module m3 { -//// module m4 { -//// export var x = 30; -//// } -//// -//// export function foo() { -//// return m4.x; -//// } -////} - -verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/breakpointValidationVariables.ts b/tests/cases/fourslash_old/breakpointValidationVariables.ts deleted file mode 100644 index 3f581ac80f7..00000000000 --- a/tests/cases/fourslash_old/breakpointValidationVariables.ts +++ /dev/null @@ -1,10 +0,0 @@ -/// - -// @BaselineFile: bpSpan_variables.baseline -// @Filename: bpSpan_variables.ts -////var a = 10; -////var b; -////var c = 10, d, e; -////var c2, d2 = 10; - -verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/breakpointValidationWhile.ts b/tests/cases/fourslash_old/breakpointValidationWhile.ts deleted file mode 100644 index 59d3c4fda3b..00000000000 --- a/tests/cases/fourslash_old/breakpointValidationWhile.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// - -// @BaselineFile: bpSpan_while.baseline -// @Filename: bpSpan_while.ts -////var a = 10; -////while (a == 10) { -//// a++; -////} -////while (a == 10) -////{ -//// a++; -////} -verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/nameOrDottedName_Classes.ts b/tests/cases/fourslash_old/nameOrDottedName_Classes.ts deleted file mode 100644 index 9aa63a7a473..00000000000 --- a/tests/cases/fourslash_old/nameOrDottedName_Classes.ts +++ /dev/null @@ -1,43 +0,0 @@ -/// - -// @BaselineFile: nameOrDottedSpan_classes.baseline -// @Filename: nameOrDottedSpan_classes.ts -////module Foo.Bar { -//// "use strict"; -//// -//// class Greeter { -//// constructor(public greeting: string) { -//// } -//// -//// greet() { -//// return "

" + this.greeting + "

"; -//// } -//// } -//// -//// -//// function foo(greeting: string): Greeter { -//// return new Greeter(greeting); -//// } -//// -//// var greeter = new Greeter("Hello, world!"); -//// var str = greeter.greet(); -//// -//// function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) { -//// var greeters: Greeter[] = []; /* inline block comment */ -//// greeters[0] = new Greeter(greeting); -//// for (var i = 0; i < restGreetings.length; i++) { -//// greeters.push(new Greeter(restGreetings[i])); -//// } -//// -//// return greeters; -//// } -//// -//// var b = foo2("Hello", "World", "!"); -//// // This is simple signle line comment -//// for (var j = 0; j < b.length; j++) { -//// b[j].greet(); -//// } -////} - - -verify.baselineCurrentFileNameOrDottedNameSpans(); \ No newline at end of file diff --git a/tests/cases/fourslash_old/nameOrDottedName_Statements.ts b/tests/cases/fourslash_old/nameOrDottedName_Statements.ts deleted file mode 100644 index 52c9c30a75d..00000000000 --- a/tests/cases/fourslash_old/nameOrDottedName_Statements.ts +++ /dev/null @@ -1,90 +0,0 @@ -/// - -// @BaselineFile: nameOrDottedSpan_stmts.baseline -// @Filename: nameOrDottedSpan_stmts.ts -////function f() { -//// var y; -//// var x = 0; -//// for (var i = 0; i < 10; i++) { -//// x += i; -//// x *= 0; -//// } -//// if (x > 17) { -//// x /= 9; -//// } else { -//// x += 10; -//// x++; -//// } -//// var a = [ -//// 1, -//// 2, -//// 3 -//// ]; -//// var obj = { -//// z: 1, -//// q: "hello" -//// }; -//// for (var j in a) { -//// obj.z = a[j]; -//// var v = 10; -//// } -//// try { -//// obj.q = "ohhh"; -//// } catch (e) { -//// if (obj.z < 10) { -//// obj.z = 12; -//// } else { -//// obj.q = "hmm"; -//// } -//// } -//// try { -//// throw new Error(); -//// } catch (e1) { -//// var b = e1; -//// } finally { -//// y = 70; -//// } -//// with (obj) { -//// i = 2; -//// z = 10; -//// } -//// switch (obj.z) { -//// case 0: { -//// x++; -//// break; -//// -//// } -//// case 1: { -//// x--; -//// break; -//// -//// } -//// default: { -//// x *= 2; -//// x = 50; -//// break; -//// -//// } -//// } -//// while (x < 10) { -//// x++; -//// } -//// do { -//// x--; -//// } while (x > 4) -//// x = y; -//// var z = (x == 1) ? x + 1 : x - 1; -//// (x == 1) ? x + 1 : x - 1; -//// x === 1; -//// x = z = 40; -//// eval("y"); -//// return; -////} -////var b = function () { -//// var x = 10; -//// x = x + 1; -////}; -////f(); - - -verify.baselineCurrentFileNameOrDottedNameSpans(); \ No newline at end of file