diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index ba7c6115812..2a05667ace2 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -987,10 +987,7 @@ module FourSlash { private alignmentForExtraInfo = 50; - public getBreakpointStatementLocation(pos: number, prefixString: string) { - this.taoInvalidReason = 'getBreakpointStatementLocation NYI'; - - var spanInfo = this.languageService.getBreakpointStatementAtPosition(this.activeFile.fileName, pos); + 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()); @@ -1003,9 +1000,72 @@ module FourSlash { } 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'; + return this.languageService.getBreakpointStatementAtPosition(this.activeFile.fileName, pos); + } + public baselineCurrentFileBreakpointLocations() { this.taoInvalidReason = 'baselineCurrentFileBreakpointLocations impossible'; @@ -1013,60 +1073,7 @@ module FourSlash { "Breakpoint Locations for " + this.activeFile.fileName, this.testData.globalOptions[testOptMetadataNames.baselineFile], () => { - 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.getBreakpointStatementLocation(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; - } + return this.baselineCurrentFileLocations(pos => this.getBreakpointStatementLocation(pos)); }, true /* run immediately */); } @@ -1114,7 +1121,7 @@ module FourSlash { } public printBreakpointLocation(pos: number) { - Harness.IO.log("\n**Pos: " + pos + " " + this.getBreakpointStatementLocation(pos, " ")); + Harness.IO.log("\n**Pos: " + pos + " " + this.spanInfoToString(pos, this.getBreakpointStatementLocation(pos), " ")); } public printBreakpointAtCurrentLocation() { @@ -1624,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()); @@ -1639,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() { @@ -1654,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[]) { diff --git a/src/services/services.ts b/src/services/services.ts index 080daa1aa53..5e1c97a7fff 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1950,18 +1950,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; @@ -1994,7 +2008,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)); } @@ -4528,8 +4542,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; } @@ -4679,64 +4694,63 @@ 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); + filename = ts.normalizeSlashes(filename); return BreakpointResolver.spanInSourceFileAtLocation(getCurrentSourceFile(filename), position); } 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_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/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