Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[327279] Can't create JavaScript line breakpoint

  • Loading branch information...
commit 31c71feeb3c07f67f7b64c2a8b85d0b18b9e37e9 1 parent 889e257
nitind authored
View
13 ...e.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/BreakpointLocationFinder.java
@@ -246,13 +246,6 @@ public int getLineNumber() {
}
/* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#preVisit(org.eclipse.wst.jsdt.core.dom.ASTNode)
- */
- public void preVisit(ASTNode node) {
- super.preVisit(node);
- }
-
- /* (non-Javadoc)
* @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#visit(org.eclipse.wst.jsdt.core.dom.AnonymousClassDeclaration)
*/
public boolean visit(AnonymousClassDeclaration node) {
@@ -315,8 +308,8 @@ public boolean visit(Assignment node) {
public boolean visit(Block node) {
if(visit(node, false)) {
if(node.statements().isEmpty() && node.getParent().getNodeType() == ASTNode.FUNCTION_DECLARATION) {
- int offset = node.getStartPosition();
- this.linenumber = lineNumber(offset + node.getLength() - 1);
+ int offset = node.getStartPosition() + node.getLength() - 1;
+ this.linenumber = lineNumber(offset);
this.found = true;
this.location = LINE;
this.offset = offset;
@@ -894,7 +887,7 @@ public boolean visit(VariableDeclarationFragment node) {
* @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#visit(org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement)
*/
public boolean visit(VariableDeclarationStatement node) {
- return visit(node, false);
+ return visit(node, node.getParent().getNodeType() == ASTNode.BLOCK);
}
/* (non-Javadoc)
View
6 ...se.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/ToggleBreakpointAdapter.java
@@ -398,7 +398,11 @@ public void toggleBreakpoints(IWorkbenchPart part, ISelection selection) throws
return;
}
case BreakpointLocationFinder.LINE: {
- toggleLineBreakpoint(part, (ITextSelection) selection, root.getElementAt(finder.getOffset()), finder.getLineNumber());
+ IJavaScriptElement element = root.getElementAt(finder.getOffset());
+ if(element == null) {
+ element = root;
+ }
+ toggleLineBreakpoint(part, (ITextSelection) selection, element, finder.getLineNumber());
return;
}
case BreakpointLocationFinder.FUNCTION: {
Please sign in to comment.
Something went wrong with that request. Please try again.