| | |
| | | }); |
| | | exports.default = _default; |
| | | |
| | | var _helperGetFunctionArity = require("@babel/helper-get-function-arity"); |
| | | |
| | | var _template = require("@babel/template"); |
| | | |
| | | var _t = require("@babel/types"); |
| | |
| | | cloneNode, |
| | | identifier, |
| | | isAssignmentExpression, |
| | | isAssignmentPattern, |
| | | isFunction, |
| | | isIdentifier, |
| | | isLiteral, |
| | |
| | | isObjectMethod, |
| | | isObjectProperty, |
| | | isRegExpLiteral, |
| | | isRestElement, |
| | | isTemplateLiteral, |
| | | isVariableDeclarator, |
| | | toBindingIdentifierName |
| | | } = _t; |
| | | |
| | | function getFunctionArity(node) { |
| | | const count = node.params.findIndex(param => isAssignmentPattern(param) || isRestElement(param)); |
| | | return count === -1 ? node.params.length : count; |
| | | } |
| | | |
| | | const buildPropertyMethodAssignmentWrapper = (0, _template.default)(` |
| | | (function (FUNCTION_KEY) { |
| | | function FUNCTION_ID() { |
| | |
| | | }).expression; |
| | | const params = template.callee.body.body[0].params; |
| | | |
| | | for (let i = 0, len = (0, _helperGetFunctionArity.default)(method); i < len; i++) { |
| | | for (let i = 0, len = getFunctionArity(method); i < len; i++) { |
| | | params.push(scope.generateUidIdentifier("x")); |
| | | } |
| | | |
| | |
| | | parent, |
| | | scope, |
| | | id |
| | | }, localBinding = false) { |
| | | }, localBinding = false, supportUnicodeId = false) { |
| | | if (node.id) return; |
| | | |
| | | if ((isObjectProperty(parent) || isObjectMethod(parent, { |
| | |
| | | return; |
| | | } |
| | | |
| | | if (!supportUnicodeId && isFunction(node) && /[\uD800-\uDFFF]/.test(name)) { |
| | | return; |
| | | } |
| | | |
| | | name = toBindingIdentifierName(name); |
| | | id = identifier(name); |
| | | id[NOT_LOCAL_BINDING] = true; |