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

Trailing comments lost with return and debugger statements #2

Closed
nzakas opened this issue Dec 6, 2014 · 0 comments
Closed

Trailing comments lost with return and debugger statements #2

nzakas opened this issue Dec 6, 2014 · 0 comments

Comments

@nzakas
Copy link
Member

nzakas commented Dec 6, 2014

I noticed that ReturnStatement nodes doesn’t have leadingComments and trailingComments attached in some cases.

The following code example fails and doen’t have leadingComments or trailingComments:

function a() {
    /* before */
    return;
    /* after */
}

The following code examples work:

Without ReturnStatement:

function a() {
    /* before */
    b();
    /* after */
}

Only one leading comment:

function a() {
    /* before */
    return;
}

Only one trailing comment:

function a() {
    return;
    /* after */
}

Same problem with the debugger statement.

Esprima bug: https://code.google.com/p/esprima/issues/detail?id=609

@nzakas nzakas added the bug label Dec 6, 2014
@nzakas nzakas closed this as completed in 8f93f0e Dec 23, 2014
nzakas added a commit that referenced this issue Dec 23, 2014
Fix: Ensure comments are attached for return (fixes #2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant