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

[estree] attach comments after directives at the end of file #14920

Merged
merged 3 commits into from Sep 13, 2022

Commits on Sep 12, 2022

  1. fix: for ESTree, attach comments when a directive is followed by a co…

    …mment, then EOF
    
    If a source file contains 1) a directive, followed by 2) a comment, and nothing else, then `@babel/parser` attaches the comment to the `Directive` node as a trailing comment.
    
    The ESTree plugin handles `Directive` nodes by creating an `ExpressionStatement` node, then transferring information from the `Directive` node to the `ExpressionStatement` node. Previously, at the time it transfers information, comments hadn't yet been attached to the `Directive` node. And even if they had been, the ESTree plugin didn't do anything with comments attached to the `Directive` node. As a result, the source file's comment wasn't attached to any node in the resulting AST.
    
    With this change, the ESTree plugin generates an AST in which the comment is attached to the `ExpressionStatement` node as a trailing comment.
    hegemonic committed Sep 12, 2022
    Copy the full SHA
    14b764d View commit details
    Browse the repository at this point in the history

Commits on Sep 13, 2022

  1. Copy the full SHA
    cac1252 View commit details
    Browse the repository at this point in the history
  2. Better typechecking

    nicolo-ribaudo committed Sep 13, 2022
    Copy the full SHA
    79bfb2b View commit details
    Browse the repository at this point in the history