Fix missing inner comments in function expressions (#13825)

This commit is contained in:
overlookmotel 2021-10-07 22:34:12 +01:00 committed by GitHub
parent c2f747c9b9
commit 6029252bec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 0 deletions

View File

@ -84,6 +84,7 @@ export function _functionHead(this: Printer, node: any) {
} }
this.word("function"); this.word("function");
if (node.generator) this.token("*"); if (node.generator) this.token("*");
this.printInnerComments(node);
this.space(); this.space();
if (node.id) { if (node.id) {

View 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*/) {};

View File

@ -0,0 +1,3 @@
{
"retainLines": true
}

View 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*/ () {};