保誠-保戶業務員媒合平台
HelenHuang
2022-06-09 9bdb95c9e34cef640534e5e5a1e2225a80442000
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);
  }
}