Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect comment node position #533

Closed
nabice opened this issue Apr 11, 2019 · 2 comments
Closed

Incorrect comment node position #533

nabice opened this issue Apr 11, 2019 · 2 comments

Comments

@nabice
Copy link

nabice commented Apr 11, 2019

Here move all comment nodes to root node

for (Comment c : scannedComments) {
root.addComment(c);
}

When we change the parent of comment node:

public void setParent(AstNode parent) {
if (parent == this.parent) {
return;
}
// Convert position back to absolute.
if (this.parent != null) {
setRelative(-this.parent.getPosition());
}
this.parent = parent;
if (parent != null) {
setRelative(parent.getPosition());
}
}

setRelative do not work fine.

// Convert position back to absolute.
if (this.parent != null) {
setRelative(-this.parent.getPosition());
}

@rbri
Copy link
Collaborator

rbri commented Apr 11, 2019

Can you please add a more general description of your problem and some kind of test case / sample code.

@nabice
Copy link
Author

nabice commented Apr 11, 2019

sample code:

function a() {
    //testtest                                                                                                         
   function b() {
        //password                                                                                                     
    }
}

Absolute Position of //password should be 56, but 23 we got

nabice added a commit to nabice/rhino that referenced this issue Apr 23, 2019
nabice added a commit to nabice/rhino that referenced this issue Apr 24, 2019
@gbrail gbrail closed this as completed in b4153c8 Apr 24, 2019
gbrail pushed a commit that referenced this issue Apr 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants