Bug Report
Bugs maybe
Current Behavior
See the below astexplorer.net screenshots, the second var decl haven't leading comments:


If the first decl ends by semi, it works fine
Input Code
- REPL or Repo link if applicable:
I write a plugin to transform my code, it works with the leading comments
var s = `
/**
* @test
*/
const a = {
b: 42
}
/**
* @test
*/
const c = 42
`
require('@babel/core').transform(s, { plugins: [
function plugin(path) {
return {
visitor: {
VariableDeclaration(path) { console.log(path.node.leadingComments, path.toString()) }
}
}
}
]})
output:

Environment

Bug Report
Bugs maybe
Current Behavior
See the below astexplorer.net screenshots, the second var decl haven't leading comments:
If the first decl ends by semi, it works fine
Input Code
I write a plugin to transform my code, it works with the leading comments
output:
Environment