Fix missing inner comments in function expressions (#13825)
This commit is contained in:
parent
c2f747c9b9
commit
6029252bec
@ -84,6 +84,7 @@ export function _functionHead(this: Printer, node: any) {
|
||||
}
|
||||
this.word("function");
|
||||
if (node.generator) this.token("*");
|
||||
this.printInnerComments(node);
|
||||
|
||||
this.space();
|
||||
if (node.id) {
|
||||
|
||||
7
packages/babel-generator/test/fixtures/comments/function-inner-comment/input.js
vendored
Normal file
7
packages/babel-generator/test/fixtures/comments/function-inner-comment/input.js
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
const f = function /*foo*/ () {};
|
||||
const g = async function /*foo*/ () {};
|
||||
const h = async /*foo*/ function () {};
|
||||
const i = function* /*foo*/ () {};
|
||||
const j = function/*foo*/* () {};
|
||||
const k = async function* /*foo*/ () {};
|
||||
const l = function (/*foo*/) {};
|
||||
3
packages/babel-generator/test/fixtures/comments/function-inner-comment/options.json
vendored
Normal file
3
packages/babel-generator/test/fixtures/comments/function-inner-comment/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"retainLines": true
|
||||
}
|
||||
7
packages/babel-generator/test/fixtures/comments/function-inner-comment/output.js
vendored
Normal file
7
packages/babel-generator/test/fixtures/comments/function-inner-comment/output.js
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
const f = function /*foo*/ () {};
|
||||
const g = async function /*foo*/ () {};
|
||||
const h = async function /*foo*/ () {};
|
||||
const i = function* /*foo*/ () {};
|
||||
const j = function* /*foo*/ () {};
|
||||
const k = async function* /*foo*/ () {};
|
||||
const l = function /*foo*/ () {};
|
||||
Loading…
x
Reference in New Issue
Block a user