Permalink
Browse files

[327279] Can't create JavaScript line breakpoint

  • Loading branch information...
1 parent 889e257 commit 31c71feeb3c07f67f7b64c2a8b85d0b18b9e37e9 nitind committed Oct 11, 2010
@@ -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)
@@ -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: {

0 comments on commit 31c71fe

Please sign in to comment.