From 9bdb95c9e34cef640534e5e5a1e2225a80442000 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期四, 09 六月 2022 15:48:15 +0800 Subject: [PATCH] TODO#139894 [ footer -最下方說明與保經代合作 ] 文案修改 --- PAMapp/node_modules/@babel/helper-wrap-function/lib/index.js | 31 +++++++++++++++---------------- 1 files changed, 15 insertions(+), 16 deletions(-) diff --git a/PAMapp/node_modules/@babel/helper-wrap-function/lib/index.js b/PAMapp/node_modules/@babel/helper-wrap-function/lib/index.js index 62df6c2..b8e87e6 100644 --- a/PAMapp/node_modules/@babel/helper-wrap-function/lib/index.js +++ b/PAMapp/node_modules/@babel/helper-wrap-function/lib/index.js @@ -57,7 +57,7 @@ path.get("body.body.0.argument.callee.arguments.0").unwrapFunctionEnvironment(); } -function plainFunction(path, callId, noNewArrows) { +function plainFunction(path, callId, noNewArrows, ignoreFunctionLength) { const node = path.node; const isDeclaration = path.isFunctionDeclaration(); const functionId = node.id; @@ -76,22 +76,21 @@ } const built = callExpression(callId, [node]); + const params = []; + + for (const param of node.params) { + if (isAssignmentPattern(param) || isRestElement(param)) { + break; + } + + params.push(path.scope.generateUidIdentifier("x")); + } + const container = wrapper({ NAME: functionId || null, REF: path.scope.generateUidIdentifier(functionId ? functionId.name : "ref"), FUNCTION: built, - PARAMS: node.params.reduce((acc, param) => { - acc.done = acc.done || isAssignmentPattern(param) || isRestElement(param); - - if (!acc.done) { - acc.params.push(path.scope.generateUidIdentifier("x")); - } - - return acc; - }, { - params: [], - done: false - }).params + PARAMS: params }); if (isDeclaration) { @@ -108,7 +107,7 @@ }); } - if (!retFunction || retFunction.id || node.params.length) { + if (!retFunction || retFunction.id || !ignoreFunctionLength && params.length) { path.replaceWith(container); } else { path.replaceWith(built); @@ -116,10 +115,10 @@ } } -function wrapFunction(path, callId, noNewArrows = true) { +function wrapFunction(path, callId, noNewArrows = true, ignoreFunctionLength = false) { if (path.isMethod()) { classOrObjectMethod(path, callId); } else { - plainFunction(path, callId, noNewArrows); + plainFunction(path, callId, noNewArrows, ignoreFunctionLength); } } \ No newline at end of file -- Gitblit v1.8.0