diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 31ab5d2adec..386970cac5a 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -212,6 +212,7 @@ namespace ts.BreakpointResolver { case SyntaxKind.EnumMember: case SyntaxKind.CallExpression: case SyntaxKind.NewExpression: + case SyntaxKind.BindingElement: // span on complete node return textSpan(node); @@ -222,6 +223,10 @@ namespace ts.BreakpointResolver { case SyntaxKind.Decorator: return spanInNodeArray(node.parent.decorators); + case SyntaxKind.ObjectBindingPattern: + case SyntaxKind.ArrayBindingPattern: + return spanInBindingPattern(node); + // No breakpoint in interface, type alias case SyntaxKind.InterfaceDeclaration: case SyntaxKind.TypeAliasDeclaration: @@ -279,11 +284,30 @@ namespace ts.BreakpointResolver { return spanInPreviousNode(node); } + // initializer of variable declaration go to previous node + if (node.parent.kind === SyntaxKind.VariableDeclaration && + ((node.parent).initializer === node || + isAssignmentOperator(node.kind))) { + return spanInPreviousNode(node); + } + // Default go to parent to set the breakpoint return spanInNode(node.parent); } } + function textSpanFromVariableDeclaration(variableDeclaration: VariableDeclaration): TextSpan { + let declarations = variableDeclaration.parent.declarations; + if (declarations && declarations[0] === variableDeclaration) { + // First declaration - include let keyword + return textSpan(findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); + } + else { + // Span only on this declaration + return textSpan(variableDeclaration); + } + } + function spanInVariableDeclaration(variableDeclaration: VariableDeclaration): TextSpan { // If declaration of for in statement, just set the span in parent if (variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement || @@ -291,36 +315,23 @@ namespace ts.BreakpointResolver { return spanInNode(variableDeclaration.parent.parent); } - let isParentVariableStatement = variableDeclaration.parent.parent.kind === SyntaxKind.VariableStatement; - let isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === SyntaxKind.ForStatement && contains(((variableDeclaration.parent.parent).initializer).declarations, variableDeclaration); - let declarations = isParentVariableStatement - ? (variableDeclaration.parent.parent).declarationList.declarations - : isDeclarationOfForStatement - ? ((variableDeclaration.parent.parent).initializer).declarations - : undefined; + // If this is a destructuring pattern set breakpoint in binding pattern + if (isBindingPattern(variableDeclaration.name)) { + return spanInBindingPattern(variableDeclaration.name); + } // 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 let keyword - return textSpan(variableDeclaration.parent, variableDeclaration); - } - else { - Debug.assert(isDeclarationOfForStatement); - // Include let keyword from for statement declarations in the span - return textSpan(findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); - } - } - else { - // Span only on this declaration - return textSpan(variableDeclaration); - } + return textSpanFromVariableDeclaration(variableDeclaration); } - else if (declarations && declarations[0] !== variableDeclaration) { + + let declarations = variableDeclaration.parent.declarations; + if (declarations && declarations[0] !== variableDeclaration) { // If we cant set breakpoint on this declaration, set it on previous one - let indexOfCurrentDeclaration = indexOf(declarations, variableDeclaration); - return spanInVariableDeclaration(declarations[indexOfCurrentDeclaration - 1]); + // Because the variable declaration may be binding pattern and + // we would like to set breakpoint in last binding element if thats the case, + // use preceding token instead + return spanInNode(findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent)); } } @@ -421,6 +432,24 @@ namespace ts.BreakpointResolver { } } + function spanInBindingPattern(bindingPattern: BindingPattern): TextSpan { + // Set breakpoint in first binding element + let firstBindingElement = forEach(bindingPattern.elements, + element => element.kind !== SyntaxKind.OmittedExpression ? element : undefined); + + if (firstBindingElement) { + return spanInNode(firstBindingElement); + } + + // Empty binding pattern of binding element, set breakpoint on binding element + if (bindingPattern.parent.kind === SyntaxKind.BindingElement) { + return spanInNode(bindingPattern.parent); + } + + // Variable declaration is used as the span + return textSpanFromVariableDeclaration(bindingPattern.parent); + } + // Tokens: function spanInOpenBraceToken(node: Node): TextSpan { switch (node.parent.kind) { @@ -472,6 +501,11 @@ namespace ts.BreakpointResolver { } return undefined; + case SyntaxKind.ObjectBindingPattern: + // Breakpoint in last binding element or binding pattern if it contains no elements + let bindingPattern = node.parent; + return spanInNode(lastOrUndefined(bindingPattern.elements) || bindingPattern); + // Default to parent node default: return spanInNode(node.parent); diff --git a/tests/baselines/reference/bpSpanDestructuringVariableStatement.baseline b/tests/baselines/reference/bpSpanDestructuringVariableStatement.baseline index b554d4b969b..3939c66c56e 100644 --- a/tests/baselines/reference/bpSpanDestructuringVariableStatement.baseline +++ b/tests/baselines/reference/bpSpanDestructuringVariableStatement.baseline @@ -47,21 +47,31 @@ -------------------------------- 11 >var { name: nameA } = robotA; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (247 to 276) SpanInfo: {"start":247,"length":28} - >var { name: nameA } = robotA - >:=> (line 11, col 0) to (line 11, col 28) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (247 to 276) SpanInfo: {"start":253,"length":11} + >name: nameA + >:=> (line 11, col 6) to (line 11, col 17) -------------------------------- 12 >var { name: nameB, skill: skillB } = robotB; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (277 to 321) SpanInfo: {"start":277,"length":43} - >var { name: nameB, skill: skillB } = robotB - >:=> (line 12, col 0) to (line 12, col 43) + ~~~~~~~~~~~~~~~~~~ => Pos: (277 to 294) SpanInfo: {"start":283,"length":11} + >name: nameB + >:=> (line 12, col 6) to (line 12, col 17) +12 >var { name: nameB, skill: skillB } = robotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (295 to 321) SpanInfo: {"start":296,"length":13} + >skill: skillB + >:=> (line 12, col 19) to (line 12, col 32) -------------------------------- 13 >var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (322 to 401) SpanInfo: {"start":322,"length":78} - >var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" } - >:=> (line 13, col 0) to (line 13, col 78) + ~~~~~~~~~~~~~~~~~~ => Pos: (322 to 339) SpanInfo: {"start":328,"length":11} + >name: nameC + >:=> (line 13, col 6) to (line 13, col 17) +13 >var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (340 to 401) SpanInfo: {"start":341,"length":13} + >skill: skillC + >:=> (line 13, col 19) to (line 13, col 32) -------------------------------- 14 >if (nameA == nameB) { diff --git a/tests/baselines/reference/bpSpanDestructuringVariableStatement1.baseline b/tests/baselines/reference/bpSpanDestructuringVariableStatement1.baseline index 774869428d6..ce1edbb0ee9 100644 --- a/tests/baselines/reference/bpSpanDestructuringVariableStatement1.baseline +++ b/tests/baselines/reference/bpSpanDestructuringVariableStatement1.baseline @@ -50,27 +50,37 @@ ~~~~~~~~~~~~~~ => Pos: (247 to 260) SpanInfo: undefined 11 >var a: string, { name: nameA } = robotA; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (261 to 287) SpanInfo: {"start":262,"length":24} - >{ name: nameA } = robotA - >:=> (line 11, col 15) to (line 11, col 39) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (261 to 287) SpanInfo: {"start":264,"length":11} + >name: nameA + >:=> (line 11, col 17) to (line 11, col 28) -------------------------------- 12 >var b: string, { name: nameB, skill: skillB } = robotB; ~~~~~~~~~~~~~~ => Pos: (288 to 301) SpanInfo: undefined 12 >var b: string, { name: nameB, skill: skillB } = robotB; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (302 to 343) SpanInfo: {"start":303,"length":39} - >{ name: nameB, skill: skillB } = robotB - >:=> (line 12, col 15) to (line 12, col 54) + ~~~~~~~~~~~~~~~ => Pos: (302 to 316) SpanInfo: {"start":305,"length":11} + >name: nameB + >:=> (line 12, col 17) to (line 12, col 28) +12 >var b: string, { name: nameB, skill: skillB } = robotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (317 to 343) SpanInfo: {"start":318,"length":13} + >skill: skillB + >:=> (line 12, col 30) to (line 12, col 43) -------------------------------- 13 >var c: string, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; ~~~~~~~~~~~~~~ => Pos: (344 to 357) SpanInfo: undefined 13 >var c: string, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (358 to 434) SpanInfo: {"start":359,"length":74} - >{ name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" } - >:=> (line 13, col 15) to (line 13, col 89) + ~~~~~~~~~~~~~~~ => Pos: (358 to 372) SpanInfo: {"start":361,"length":11} + >name: nameC + >:=> (line 13, col 17) to (line 13, col 28) +13 >var c: string, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (373 to 434) SpanInfo: {"start":374,"length":13} + >skill: skillC + >:=> (line 13, col 30) to (line 13, col 43) -------------------------------- 14 > @@ -78,9 +88,9 @@ -------------------------------- 15 >var { name: nameA } = robotA, a = hello; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (436 to 464) SpanInfo: {"start":436,"length":28} - >var { name: nameA } = robotA - >:=> (line 15, col 0) to (line 15, col 28) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (436 to 464) SpanInfo: {"start":442,"length":11} + >name: nameA + >:=> (line 15, col 6) to (line 15, col 17) 15 >var { name: nameA } = robotA, a = hello; ~~~~~~~~~~~~ => Pos: (465 to 476) SpanInfo: {"start":466,"length":9} @@ -89,9 +99,14 @@ -------------------------------- 16 >var { name: nameB, skill: skillB } = robotB, b = " hello"; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (477 to 520) SpanInfo: {"start":477,"length":43} - >var { name: nameB, skill: skillB } = robotB - >:=> (line 16, col 0) to (line 16, col 43) + ~~~~~~~~~~~~~~~~~~ => Pos: (477 to 494) SpanInfo: {"start":483,"length":11} + >name: nameB + >:=> (line 16, col 6) to (line 16, col 17) +16 >var { name: nameB, skill: skillB } = robotB, b = " hello"; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (495 to 520) SpanInfo: {"start":496,"length":13} + >skill: skillB + >:=> (line 16, col 19) to (line 16, col 32) 16 >var { name: nameB, skill: skillB } = robotB, b = " hello"; ~~~~~~~~~~~~~~~=> Pos: (521 to 535) SpanInfo: {"start":522,"length":12} @@ -100,9 +115,14 @@ -------------------------------- 17 >var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c = hello; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (536 to 614) SpanInfo: {"start":536,"length":78} - >var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" } - >:=> (line 17, col 0) to (line 17, col 78) + ~~~~~~~~~~~~~~~~~~ => Pos: (536 to 553) SpanInfo: {"start":542,"length":11} + >name: nameC + >:=> (line 17, col 6) to (line 17, col 17) +17 >var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c = hello; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (554 to 614) SpanInfo: {"start":555,"length":13} + >skill: skillC + >:=> (line 17, col 19) to (line 17, col 32) 17 >var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c = hello; ~~~~~~~~~~~~=> Pos: (615 to 626) SpanInfo: {"start":616,"length":9} @@ -120,9 +140,9 @@ >:=> (line 19, col 0) to (line 19, col 13) 19 >var a = hello, { name: nameA } = robotA, a1= "hello"; - ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (642 to 667) SpanInfo: {"start":643,"length":24} - >{ name: nameA } = robotA - >:=> (line 19, col 15) to (line 19, col 39) + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (642 to 667) SpanInfo: {"start":645,"length":11} + >name: nameA + >:=> (line 19, col 17) to (line 19, col 28) 19 >var a = hello, { name: nameA } = robotA, a1= "hello"; ~~~~~~~~~~~~~~=> Pos: (668 to 681) SpanInfo: {"start":669,"length":11} @@ -136,9 +156,14 @@ >:=> (line 20, col 0) to (line 20, col 13) 20 >var b = hello, { name: nameB, skill: skillB } = robotB, b1 = "hello"; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (696 to 736) SpanInfo: {"start":697,"length":39} - >{ name: nameB, skill: skillB } = robotB - >:=> (line 20, col 15) to (line 20, col 54) + ~~~~~~~~~~~~~~~ => Pos: (696 to 710) SpanInfo: {"start":699,"length":11} + >name: nameB + >:=> (line 20, col 17) to (line 20, col 28) +20 >var b = hello, { name: nameB, skill: skillB } = robotB, b1 = "hello"; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (711 to 736) SpanInfo: {"start":712,"length":13} + >skill: skillB + >:=> (line 20, col 30) to (line 20, col 43) 20 >var b = hello, { name: nameB, skill: skillB } = robotB, b1 = "hello"; ~~~~~~~~~~~~~~~=> Pos: (737 to 751) SpanInfo: {"start":738,"length":12} @@ -152,9 +177,14 @@ >:=> (line 21, col 0) to (line 21, col 13) 21 >var c = hello, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c1 = hello; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (766 to 841) SpanInfo: {"start":767,"length":74} - >{ name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" } - >:=> (line 21, col 15) to (line 21, col 89) + ~~~~~~~~~~~~~~~ => Pos: (766 to 780) SpanInfo: {"start":769,"length":11} + >name: nameC + >:=> (line 21, col 17) to (line 21, col 28) +21 >var c = hello, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c1 = hello; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (781 to 841) SpanInfo: {"start":782,"length":13} + >skill: skillC + >:=> (line 21, col 30) to (line 21, col 43) 21 >var c = hello, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c1 = hello; ~~~~~~~~~~~~~=> Pos: (842 to 854) SpanInfo: {"start":843,"length":10} diff --git a/tests/baselines/reference/bpSpanDestructuringVariableStatementDefaultValues.baseline b/tests/baselines/reference/bpSpanDestructuringVariableStatementDefaultValues.baseline index ce6062f70e2..60ee5897d48 100644 --- a/tests/baselines/reference/bpSpanDestructuringVariableStatementDefaultValues.baseline +++ b/tests/baselines/reference/bpSpanDestructuringVariableStatementDefaultValues.baseline @@ -47,21 +47,31 @@ -------------------------------- 11 >var { name: nameA = "" } = robotA; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (247 to 289) SpanInfo: {"start":247,"length":41} - >var { name: nameA = "" } = robotA - >:=> (line 11, col 0) to (line 11, col 41) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (247 to 289) SpanInfo: {"start":253,"length":24} + >name: nameA = "" + >:=> (line 11, col 6) to (line 11, col 30) -------------------------------- 12 >var { name: nameB = "", skill: skillB = "" } = robotB; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (290 to 370) SpanInfo: {"start":290,"length":79} - >var { name: nameB = "", skill: skillB = "" } = robotB - >:=> (line 12, col 0) to (line 12, col 79) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (290 to 320) SpanInfo: {"start":296,"length":24} + >name: nameB = "" + >:=> (line 12, col 6) to (line 12, col 30) +12 >var { name: nameB = "", skill: skillB = "" } = robotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (321 to 370) SpanInfo: {"start":322,"length":36} + >skill: skillB = "" + >:=> (line 12, col 32) to (line 12, col 68) -------------------------------- 13 >var { name: nameC = "", skill: skillC = "" } = { name: "Edger", skill: "cutting edges" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (371 to 486) SpanInfo: {"start":371,"length":114} - >var { name: nameC = "", skill: skillC = "" } = { name: "Edger", skill: "cutting edges" } - >:=> (line 13, col 0) to (line 13, col 114) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (371 to 401) SpanInfo: {"start":377,"length":24} + >name: nameC = "" + >:=> (line 13, col 6) to (line 13, col 30) +13 >var { name: nameC = "", skill: skillC = "" } = { name: "Edger", skill: "cutting edges" }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (402 to 486) SpanInfo: {"start":403,"length":36} + >skill: skillC = "" + >:=> (line 13, col 32) to (line 13, col 68) -------------------------------- 14 >if (nameA == nameB) { diff --git a/tests/baselines/reference/bpSpanDestructuringVariableStatementNestedObjectBindingPattern.baseline b/tests/baselines/reference/bpSpanDestructuringVariableStatementNestedObjectBindingPattern.baseline index 4878c375bd7..66f814ada9c 100644 --- a/tests/baselines/reference/bpSpanDestructuringVariableStatementNestedObjectBindingPattern.baseline +++ b/tests/baselines/reference/bpSpanDestructuringVariableStatementNestedObjectBindingPattern.baseline @@ -57,21 +57,76 @@ -------------------------------- 14 >var { skills: { primary: primaryA, secondary: secondaryA } } = robotA; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (349 to 419) SpanInfo: {"start":349,"length":69} - >var { skills: { primary: primaryA, secondary: secondaryA } } = robotA - >:=> (line 14, col 0) to (line 14, col 69) + ~~~~~~~~~~~~~ => Pos: (349 to 361) SpanInfo: {"start":355,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 14, col 6) to (line 14, col 58) +14 >var { skills: { primary: primaryA, secondary: secondaryA } } = robotA; + + ~~~~~~~~~~~~~~~~~~~~~ => Pos: (362 to 382) SpanInfo: {"start":365,"length":17} + >primary: primaryA + >:=> (line 14, col 16) to (line 14, col 33) +14 >var { skills: { primary: primaryA, secondary: secondaryA } } = robotA; + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (383 to 406) SpanInfo: {"start":384,"length":21} + >secondary: secondaryA + >:=> (line 14, col 35) to (line 14, col 56) +14 >var { skills: { primary: primaryA, secondary: secondaryA } } = robotA; + + ~~~~~~~~~~~~~=> Pos: (407 to 419) SpanInfo: {"start":355,"length":52} + >skills: { primary: primaryA, secondary: secondaryA } + >:=> (line 14, col 6) to (line 14, col 58) -------------------------------- 15 >var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (420 to 503) SpanInfo: {"start":420,"length":82} - >var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB - >:=> (line 15, col 0) to (line 15, col 82) + ~~~~~~~~~~~~~~~~~~ => Pos: (420 to 437) SpanInfo: {"start":426,"length":11} + >name: nameB + >:=> (line 15, col 6) to (line 15, col 17) +15 >var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB; + + ~~~~~~~~ => Pos: (438 to 445) SpanInfo: {"start":439,"length":52} + >skills: { primary: primaryB, secondary: secondaryB } + >:=> (line 15, col 19) to (line 15, col 71) +15 >var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB; + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (446 to 466) SpanInfo: {"start":449,"length":17} + >primary: primaryB + >:=> (line 15, col 29) to (line 15, col 46) +15 >var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB; + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (467 to 490) SpanInfo: {"start":468,"length":21} + >secondary: secondaryB + >:=> (line 15, col 48) to (line 15, col 69) +15 >var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB; + + ~~~~~~~~~~~~~=> Pos: (491 to 503) SpanInfo: {"start":439,"length":52} + >skills: { primary: primaryB, secondary: secondaryB } + >:=> (line 15, col 19) to (line 15, col 71) -------------------------------- 16 >var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (504 to 659) SpanInfo: {"start":504,"length":154} - >var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } - >:=> (line 16, col 0) to (line 16, col 154) + ~~~~~~~~~~~~~~~~~~ => Pos: (504 to 521) SpanInfo: {"start":510,"length":11} + >name: nameC + >:=> (line 16, col 6) to (line 16, col 17) +16 >var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; + + ~~~~~~~~ => Pos: (522 to 529) SpanInfo: {"start":523,"length":52} + >skills: { primary: primaryB, secondary: secondaryB } + >:=> (line 16, col 19) to (line 16, col 71) +16 >var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; + + ~~~~~~~~~~~~~~~~~~~~~=> Pos: (530 to 550) SpanInfo: {"start":533,"length":17} + >primary: primaryB + >:=> (line 16, col 29) to (line 16, col 46) +16 >var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; + + ~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (551 to 574) SpanInfo: {"start":552,"length":21} + >secondary: secondaryB + >:=> (line 16, col 48) to (line 16, col 69) +16 >var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (575 to 659) SpanInfo: {"start":523,"length":52} + >skills: { primary: primaryB, secondary: secondaryB } + >:=> (line 16, col 19) to (line 16, col 71) -------------------------------- 17 > diff --git a/tests/baselines/reference/bpSpanDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.baseline b/tests/baselines/reference/bpSpanDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.baseline index 51ccda7ce26..75b37a0231e 100644 --- a/tests/baselines/reference/bpSpanDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.baseline +++ b/tests/baselines/reference/bpSpanDestructuringVariableStatementNestedObjectBindingPatternWithDefaultValues.baseline @@ -57,237 +57,183 @@ -------------------------------- 14 >var { - ~~~~~~ => Pos: (351 to 356) SpanInfo: {"start":351,"length":164} - >var { - > skills: { + ~~~~~~ => Pos: (351 to 356) SpanInfo: {"start":361,"length":143} + >skills: { > primary: primaryA = "noSkill", > secondary: secondaryA = "noSkill" > } = { primary: "noSkill", secondary: "noSkill" } - >} = robotA - >:=> (line 14, col 0) to (line 19, col 10) + >:=> (line 15, col 4) to (line 18, col 52) -------------------------------- 15 > skills: { - ~~~~~~~~~~~~~~ => Pos: (357 to 370) SpanInfo: {"start":351,"length":164} - >var { - > skills: { + ~~~~~~~~~~~ => Pos: (357 to 367) SpanInfo: {"start":361,"length":143} + >skills: { > primary: primaryA = "noSkill", > secondary: secondaryA = "noSkill" > } = { primary: "noSkill", secondary: "noSkill" } - >} = robotA - >:=> (line 14, col 0) to (line 19, col 10) + >:=> (line 15, col 4) to (line 18, col 52) +15 > skills: { + + ~~~ => Pos: (368 to 370) SpanInfo: {"start":379,"length":29} + >primary: primaryA = "noSkill" + >:=> (line 16, col 8) to (line 16, col 37) -------------------------------- 16 > primary: primaryA = "noSkill", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (371 to 409) SpanInfo: {"start":351,"length":164} - >var { - > skills: { - > primary: primaryA = "noSkill", - > secondary: secondaryA = "noSkill" - > } = { primary: "noSkill", secondary: "noSkill" } - >} = robotA - >:=> (line 14, col 0) to (line 19, col 10) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (371 to 409) SpanInfo: {"start":379,"length":29} + >primary: primaryA = "noSkill" + >:=> (line 16, col 8) to (line 16, col 37) -------------------------------- 17 > secondary: secondaryA = "noSkill" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (410 to 451) SpanInfo: {"start":351,"length":164} - >var { - > skills: { - > primary: primaryA = "noSkill", - > secondary: secondaryA = "noSkill" - > } = { primary: "noSkill", secondary: "noSkill" } - >} = robotA - >:=> (line 14, col 0) to (line 19, col 10) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (410 to 451) SpanInfo: {"start":418,"length":33} + >secondary: secondaryA = "noSkill" + >:=> (line 17, col 8) to (line 17, col 41) -------------------------------- 18 > } = { primary: "noSkill", secondary: "noSkill" } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (452 to 504) SpanInfo: {"start":351,"length":164} - >var { - > skills: { + ~~~~~ => Pos: (452 to 456) SpanInfo: {"start":418,"length":33} + >secondary: secondaryA = "noSkill" + >:=> (line 17, col 8) to (line 17, col 41) +18 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (457 to 504) SpanInfo: {"start":361,"length":143} + >skills: { > primary: primaryA = "noSkill", > secondary: secondaryA = "noSkill" > } = { primary: "noSkill", secondary: "noSkill" } - >} = robotA - >:=> (line 14, col 0) to (line 19, col 10) + >:=> (line 15, col 4) to (line 18, col 52) -------------------------------- 19 >} = robotA; - ~~~~~~~~~~~~ => Pos: (505 to 516) SpanInfo: {"start":351,"length":164} - >var { - > skills: { + ~~~~~~~~~~~~ => Pos: (505 to 516) SpanInfo: {"start":361,"length":143} + >skills: { > primary: primaryA = "noSkill", > secondary: secondaryA = "noSkill" > } = { primary: "noSkill", secondary: "noSkill" } - >} = robotA - >:=> (line 14, col 0) to (line 19, col 10) + >:=> (line 15, col 4) to (line 18, col 52) -------------------------------- 20 >var { - ~~~~~~ => Pos: (517 to 522) SpanInfo: {"start":517,"length":201} - >var { - > name: nameB = "noNameSpecified", - > skills: { - > primary: primaryB = "noSkill", - > secondary: secondaryB = "noSkill" - > } = { primary: "noSkill", secondary: "noSkill" } - >} = robotB - >:=> (line 20, col 0) to (line 26, col 10) + ~~~~~~ => Pos: (517 to 522) SpanInfo: {"start":527,"length":31} + >name: nameB = "noNameSpecified" + >:=> (line 21, col 4) to (line 21, col 35) -------------------------------- 21 > name: nameB = "noNameSpecified", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (523 to 559) SpanInfo: {"start":517,"length":201} - >var { - > name: nameB = "noNameSpecified", - > skills: { - > primary: primaryB = "noSkill", - > secondary: secondaryB = "noSkill" - > } = { primary: "noSkill", secondary: "noSkill" } - >} = robotB - >:=> (line 20, col 0) to (line 26, col 10) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (523 to 559) SpanInfo: {"start":527,"length":31} + >name: nameB = "noNameSpecified" + >:=> (line 21, col 4) to (line 21, col 35) -------------------------------- 22 > skills: { - ~~~~~~~~~~~~~~ => Pos: (560 to 573) SpanInfo: {"start":517,"length":201} - >var { - > name: nameB = "noNameSpecified", - > skills: { + ~~~~~~~~~~~ => Pos: (560 to 570) SpanInfo: {"start":564,"length":143} + >skills: { > primary: primaryB = "noSkill", > secondary: secondaryB = "noSkill" > } = { primary: "noSkill", secondary: "noSkill" } - >} = robotB - >:=> (line 20, col 0) to (line 26, col 10) + >:=> (line 22, col 4) to (line 25, col 52) +22 > skills: { + + ~~~ => Pos: (571 to 573) SpanInfo: {"start":582,"length":29} + >primary: primaryB = "noSkill" + >:=> (line 23, col 8) to (line 23, col 37) -------------------------------- 23 > primary: primaryB = "noSkill", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (574 to 612) SpanInfo: {"start":517,"length":201} - >var { - > name: nameB = "noNameSpecified", - > skills: { - > primary: primaryB = "noSkill", - > secondary: secondaryB = "noSkill" - > } = { primary: "noSkill", secondary: "noSkill" } - >} = robotB - >:=> (line 20, col 0) to (line 26, col 10) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (574 to 612) SpanInfo: {"start":582,"length":29} + >primary: primaryB = "noSkill" + >:=> (line 23, col 8) to (line 23, col 37) -------------------------------- 24 > secondary: secondaryB = "noSkill" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (613 to 654) SpanInfo: {"start":517,"length":201} - >var { - > name: nameB = "noNameSpecified", - > skills: { - > primary: primaryB = "noSkill", - > secondary: secondaryB = "noSkill" - > } = { primary: "noSkill", secondary: "noSkill" } - >} = robotB - >:=> (line 20, col 0) to (line 26, col 10) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (613 to 654) SpanInfo: {"start":621,"length":33} + >secondary: secondaryB = "noSkill" + >:=> (line 24, col 8) to (line 24, col 41) -------------------------------- 25 > } = { primary: "noSkill", secondary: "noSkill" } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (655 to 707) SpanInfo: {"start":517,"length":201} - >var { - > name: nameB = "noNameSpecified", - > skills: { + ~~~~~ => Pos: (655 to 659) SpanInfo: {"start":621,"length":33} + >secondary: secondaryB = "noSkill" + >:=> (line 24, col 8) to (line 24, col 41) +25 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (660 to 707) SpanInfo: {"start":564,"length":143} + >skills: { > primary: primaryB = "noSkill", > secondary: secondaryB = "noSkill" > } = { primary: "noSkill", secondary: "noSkill" } - >} = robotB - >:=> (line 20, col 0) to (line 26, col 10) + >:=> (line 22, col 4) to (line 25, col 52) -------------------------------- 26 >} = robotB; - ~~~~~~~~~~~~ => Pos: (708 to 719) SpanInfo: {"start":517,"length":201} - >var { - > name: nameB = "noNameSpecified", - > skills: { + ~~~~~~~~~~~~ => Pos: (708 to 719) SpanInfo: {"start":564,"length":143} + >skills: { > primary: primaryB = "noSkill", > secondary: secondaryB = "noSkill" > } = { primary: "noSkill", secondary: "noSkill" } - >} = robotB - >:=> (line 20, col 0) to (line 26, col 10) + >:=> (line 22, col 4) to (line 25, col 52) -------------------------------- 27 >var { - ~~~~~~ => Pos: (720 to 725) SpanInfo: {"start":720,"length":280} - >var { - > name: nameC = "noNameSpecified", - > skills: { - > primary: primaryB = "noSkill", - > secondary: secondaryB = "noSkill" - > } = { primary: "noSkill", secondary: "noSkill" } - >} = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } - >:=> (line 27, col 0) to (line 33, col 89) + ~~~~~~ => Pos: (720 to 725) SpanInfo: {"start":730,"length":31} + >name: nameC = "noNameSpecified" + >:=> (line 28, col 4) to (line 28, col 35) -------------------------------- 28 > name: nameC = "noNameSpecified", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (726 to 762) SpanInfo: {"start":720,"length":280} - >var { - > name: nameC = "noNameSpecified", - > skills: { - > primary: primaryB = "noSkill", - > secondary: secondaryB = "noSkill" - > } = { primary: "noSkill", secondary: "noSkill" } - >} = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } - >:=> (line 27, col 0) to (line 33, col 89) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (726 to 762) SpanInfo: {"start":730,"length":31} + >name: nameC = "noNameSpecified" + >:=> (line 28, col 4) to (line 28, col 35) -------------------------------- 29 > skills: { - ~~~~~~~~~~~~~~ => Pos: (763 to 776) SpanInfo: {"start":720,"length":280} - >var { - > name: nameC = "noNameSpecified", - > skills: { + ~~~~~~~~~~~ => Pos: (763 to 773) SpanInfo: {"start":767,"length":143} + >skills: { > primary: primaryB = "noSkill", > secondary: secondaryB = "noSkill" > } = { primary: "noSkill", secondary: "noSkill" } - >} = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } - >:=> (line 27, col 0) to (line 33, col 89) + >:=> (line 29, col 4) to (line 32, col 52) +29 > skills: { + + ~~~ => Pos: (774 to 776) SpanInfo: {"start":785,"length":29} + >primary: primaryB = "noSkill" + >:=> (line 30, col 8) to (line 30, col 37) -------------------------------- 30 > primary: primaryB = "noSkill", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (777 to 815) SpanInfo: {"start":720,"length":280} - >var { - > name: nameC = "noNameSpecified", - > skills: { - > primary: primaryB = "noSkill", - > secondary: secondaryB = "noSkill" - > } = { primary: "noSkill", secondary: "noSkill" } - >} = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } - >:=> (line 27, col 0) to (line 33, col 89) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (777 to 815) SpanInfo: {"start":785,"length":29} + >primary: primaryB = "noSkill" + >:=> (line 30, col 8) to (line 30, col 37) -------------------------------- 31 > secondary: secondaryB = "noSkill" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (816 to 857) SpanInfo: {"start":720,"length":280} - >var { - > name: nameC = "noNameSpecified", - > skills: { - > primary: primaryB = "noSkill", - > secondary: secondaryB = "noSkill" - > } = { primary: "noSkill", secondary: "noSkill" } - >} = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } - >:=> (line 27, col 0) to (line 33, col 89) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (816 to 857) SpanInfo: {"start":824,"length":33} + >secondary: secondaryB = "noSkill" + >:=> (line 31, col 8) to (line 31, col 41) -------------------------------- 32 > } = { primary: "noSkill", secondary: "noSkill" } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (858 to 910) SpanInfo: {"start":720,"length":280} - >var { - > name: nameC = "noNameSpecified", - > skills: { + ~~~~~ => Pos: (858 to 862) SpanInfo: {"start":824,"length":33} + >secondary: secondaryB = "noSkill" + >:=> (line 31, col 8) to (line 31, col 41) +32 > } = { primary: "noSkill", secondary: "noSkill" } + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (863 to 910) SpanInfo: {"start":767,"length":143} + >skills: { > primary: primaryB = "noSkill", > secondary: secondaryB = "noSkill" > } = { primary: "noSkill", secondary: "noSkill" } - >} = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } - >:=> (line 27, col 0) to (line 33, col 89) + >:=> (line 29, col 4) to (line 32, col 52) -------------------------------- 33 >} = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (911 to 1001) SpanInfo: {"start":720,"length":280} - >var { - > name: nameC = "noNameSpecified", - > skills: { + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=> Pos: (911 to 1001) SpanInfo: {"start":767,"length":143} + >skills: { > primary: primaryB = "noSkill", > secondary: secondaryB = "noSkill" > } = { primary: "noSkill", secondary: "noSkill" } - >} = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } - >:=> (line 27, col 0) to (line 33, col 89) + >:=> (line 29, col 4) to (line 32, col 52) -------------------------------- 34 >