babel / babylon

PSA: moved into babel/babel as @babel/parser -->

Home Page:https://github.com/babel/babel/tree/master/packages/babel-parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong leading comments in body when parsing function

Alphapage opened this issue · comments

Hello,
You can find an example: https://astexplorer.net/#/gist/0b644cf2308d56067cb8ac917c91f151/0b11735e5c90f30abe210c1271050e8a809e4ae4

Input Code

var o = {
    
    test(arg//an arg
    ,arg2//arg2
    ,arg3//arg3
      // arg33
    )//comment
  //comment2
  {
        console.log(arg)
    }
} 

Babylon/Babel Configuration

Babylon v6 and v7

Expected Behavior

I think body BlockStatement should not insert function parameters comments to leading comments or objectMethod, function and class method should add trailing comments.

Current Behavior

last parameter comments of function or method are added to body leading comments.
no trailing comments in function tree

Your Environment

software version
Babylon 6 or 7
node 6.10
npm *
Operating System *

Thank you in advance for your answers.

commented

Hey @Alphapage! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

This issue has been moved to babel/babel#6683.