Fix the array binding pattern breakpoint span of variable declaration statement

This commit is contained in:
Sheetal Nandi
2015-12-17 16:39:23 -08:00
parent 960e8a7698
commit adcc685456
5 changed files with 37 additions and 77 deletions

View File

@@ -245,6 +245,9 @@ namespace ts.BreakpointResolver {
case SyntaxKind.CloseBraceToken:
return spanInCloseBraceToken(node);
case SyntaxKind.CloseBracketToken:
return spanInCloseBracketToken(node);
case SyntaxKind.OpenParenToken:
return spanInOpenParenToken(node);
@@ -512,6 +515,19 @@ namespace ts.BreakpointResolver {
}
}
function spanInCloseBracketToken(node: Node): TextSpan {
switch (node.parent.kind) {
case SyntaxKind.ArrayBindingPattern:
// Breakpoint in last binding element or binding pattern if it contains no elements
let bindingPattern = <BindingPattern>node.parent;
return spanInNode(lastOrUndefined(bindingPattern.elements) || bindingPattern);
// Default to parent node
default:
return spanInNode(node.parent);
}
}
function spanInOpenParenToken(node: Node): TextSpan {
if (node.parent.kind === SyntaxKind.DoStatement) {
// Go to while keyword and do action instead