the-forest/client/node_modules/@babel/plugin-transform-parameters/lib/rest.js.map
2024-09-17 20:35:18 -04:00

1 line
24 KiB
Plaintext

{"version":3,"names":["_core","require","_shadowUtils","buildRest","template","statement","restIndex","expression","restIndexImpure","restLength","referencesRest","path","state","node","name","scope","bindingIdentifierEquals","outerBinding","memberExpressionOptimisationVisitor","Scope","skip","Flow","isTypeCastExpression","Function","oldNoOptimise","noOptimise","traverse","ReferencedIdentifier","deopted","parentPath","listKey","key","offset","isMemberExpression","object","grandparentPath","argsOptEligible","isAssignmentExpression","left","isLVal","isForXStatement","isUpdateExpression","isUnaryExpression","operator","isCallExpression","isNewExpression","callee","computed","get","isBaseType","candidates","push","cause","property","isSpreadElement","call","arguments","length","references","BindingIdentifier","getParamsCount","count","params","t","isIdentifier","hasRest","isRestElement","optimiseIndexGetter","argsId","offsetLiteral","numericLiteral","index","parent","isNumericLiteral","value","binaryExpression","cloneNode","isPure","temp","generateUidIdentifierBasedOnNode","id","kind","replaceWith","ARGUMENTS","OFFSET","INDEX","REF","replacedParentPath","offsetTestPath","valRes","evaluate","confident","buildUndefinedNode","optimiseLengthGetter","convertFunctionRest","restPath","shadowedParams","Set","collectShadowedParamsNames","needsIIFE","size","needsOuterBinding","iifeVisitor","ensureBlock","set","blockStatement","buildScopeIIFE","body","rest","pop","isPattern","pattern","generateUidIdentifier","declar","variableDeclaration","variableDeclarator","unshift","rename","identifier","paramsCount","argumentsNode","getBindingIdentifier","clonedArgsId","map","start","len","arrKey","arrLen","conditionalExpression","loop","ARRAY_KEY","ARRAY_LEN","START","ARRAY","KEY","LEN","target","getEarliestCommonAncestorFrom","getStatementParent","findParent","isLoop","isFunction","insertBefore"],"sources":["../src/rest.ts"],"sourcesContent":["import { template, types as t } from \"@babel/core\";\nimport type { NodePath, Visitor } from \"@babel/core\";\n\nimport {\n iifeVisitor,\n collectShadowedParamsNames,\n buildScopeIIFE,\n} from \"./shadow-utils.ts\";\n\nconst buildRest = template.statement(`\n for (var LEN = ARGUMENTS.length,\n ARRAY = new Array(ARRAY_LEN),\n KEY = START;\n KEY < LEN;\n KEY++) {\n ARRAY[ARRAY_KEY] = ARGUMENTS[KEY];\n }\n`);\n\nconst restIndex = template.expression(`\n (INDEX < OFFSET || ARGUMENTS.length <= INDEX) ? undefined : ARGUMENTS[INDEX]\n`);\n\nconst restIndexImpure = template.expression(`\n REF = INDEX, (REF < OFFSET || ARGUMENTS.length <= REF) ? undefined : ARGUMENTS[REF]\n`);\n\nconst restLength = template.expression(`\n ARGUMENTS.length <= OFFSET ? 0 : ARGUMENTS.length - OFFSET\n`);\n\nfunction referencesRest(\n path: NodePath<t.Identifier | t.JSXIdentifier>,\n state: State,\n) {\n if (path.node.name === state.name) {\n // Check rest parameter is not shadowed by a binding in another scope.\n return path.scope.bindingIdentifierEquals(state.name, state.outerBinding);\n }\n\n return false;\n}\n\ntype Candidate = {\n cause: \"argSpread\" | \"indexGetter\" | \"lengthGetter\";\n path: NodePath<t.Identifier | t.JSXIdentifier>;\n};\n\ntype State = {\n references: NodePath<t.Identifier | t.JSXIdentifier>[];\n offset: number;\n\n argumentsNode: t.Identifier;\n outerBinding: t.Identifier;\n\n // candidate member expressions we could optimise if there are no other references\n candidates: Candidate[];\n\n // local rest binding name\n name: string;\n\n /*\n It may be possible to optimize the output code in certain ways, such as\n not generating code to initialize an array (perhaps substituting direct\n references to arguments[i] or arguments.length for reads of the\n corresponding rest parameter property) or positioning the initialization\n code so that it may not have to execute depending on runtime conditions.\n\n This property tracks eligibility for optimization. \"deopted\" means give up\n and don't perform optimization. For example, when any of rest's elements /\n properties is assigned to at the top level, or referenced at all in a\n nested function.\n */\n deopted: boolean;\n noOptimise?: boolean;\n};\n\nconst memberExpressionOptimisationVisitor: Visitor<State> = {\n Scope(path, state) {\n // check if this scope has a local binding that will shadow the rest parameter\n if (!path.scope.bindingIdentifierEquals(state.name, state.outerBinding)) {\n path.skip();\n }\n },\n\n Flow(path: NodePath<t.Flow>) {\n // Do not skip TypeCastExpressions as the contain valid non flow code\n if (path.isTypeCastExpression()) return;\n // don't touch reference in type annotations\n path.skip();\n },\n\n Function(path, state) {\n // Detect whether any reference to rest is contained in nested functions to\n // determine if deopt is necessary.\n const oldNoOptimise = state.noOptimise;\n state.noOptimise = true;\n path.traverse(memberExpressionOptimisationVisitor, state);\n state.noOptimise = oldNoOptimise;\n\n // Skip because optimizing references to rest would refer to the `arguments`\n // of the nested function.\n path.skip();\n },\n\n ReferencedIdentifier(path, state) {\n const { node } = path;\n\n // we can't guarantee the purity of arguments\n if (node.name === \"arguments\") {\n state.deopted = true;\n }\n\n // is this a referenced identifier and is it referencing the rest parameter?\n if (!referencesRest(path, state)) return;\n\n if (state.noOptimise) {\n state.deopted = true;\n } else {\n const { parentPath } = path;\n\n // Is this identifier the right hand side of a default parameter?\n if (\n parentPath.listKey === \"params\" &&\n (parentPath.key as number) < state.offset\n ) {\n return;\n }\n\n // ex: `args[0]`\n // ex: `args.whatever`\n if (parentPath.isMemberExpression({ object: node })) {\n const grandparentPath = parentPath.parentPath;\n\n const argsOptEligible =\n !state.deopted &&\n !(\n // ex: `args[0] = \"whatever\"`\n (\n (grandparentPath.isAssignmentExpression() &&\n parentPath.node === grandparentPath.node.left) ||\n // ex: `[args[0]] = [\"whatever\"]`\n grandparentPath.isLVal() ||\n // ex: `for (rest[0] in this)`\n // ex: `for (rest[0] of this)`\n grandparentPath.isForXStatement() ||\n // ex: `++args[0]`\n // ex: `args[0]--`\n grandparentPath.isUpdateExpression() ||\n // ex: `delete args[0]`\n grandparentPath.isUnaryExpression({ operator: \"delete\" }) ||\n // ex: `args[0]()`\n // ex: `new args[0]()`\n // ex: `new args[0]`\n ((grandparentPath.isCallExpression() ||\n grandparentPath.isNewExpression()) &&\n parentPath.node === grandparentPath.node.callee)\n )\n );\n\n if (argsOptEligible) {\n if (parentPath.node.computed) {\n // if we know that this member expression is referencing a number then\n // we can safely optimise it\n if (parentPath.get(\"property\").isBaseType(\"number\")) {\n state.candidates.push({ cause: \"indexGetter\", path });\n return;\n }\n } else if (\n // @ts-expect-error .length must not be a private name\n parentPath.node.property.name === \"length\"\n ) {\n // args.length\n state.candidates.push({ cause: \"lengthGetter\", path });\n return;\n }\n }\n }\n\n // we can only do these optimizations if the rest variable would match\n // the arguments exactly\n // optimise single spread args in calls\n // ex: fn(...args)\n if (state.offset === 0 && parentPath.isSpreadElement()) {\n const call = parentPath.parentPath;\n if (call.isCallExpression() && call.node.arguments.length === 1) {\n state.candidates.push({ cause: \"argSpread\", path });\n return;\n }\n }\n\n state.references.push(path);\n }\n },\n\n /**\n * Deopt on use of a binding identifier with the same name as our rest param.\n *\n * See https://github.com/babel/babel/issues/2091\n */\n\n BindingIdentifier(path, state) {\n if (referencesRest(path, state)) {\n state.deopted = true;\n }\n },\n};\n\nfunction getParamsCount(node: t.Function) {\n let count = node.params.length;\n // skip the first parameter if it is a TypeScript 'this parameter'\n if (count > 0 && t.isIdentifier(node.params[0], { name: \"this\" })) {\n count -= 1;\n }\n return count;\n}\n\nfunction hasRest(node: t.Function) {\n const length = node.params.length;\n return length > 0 && t.isRestElement(node.params[length - 1]);\n}\n\nfunction optimiseIndexGetter(\n path: NodePath<t.Identifier | t.JSXIdentifier>,\n argsId: t.Identifier,\n offset: number,\n) {\n const offsetLiteral = t.numericLiteral(offset);\n let index;\n const parent = path.parent as t.MemberExpression;\n\n if (t.isNumericLiteral(parent.property)) {\n index = t.numericLiteral(parent.property.value + offset);\n } else if (offset === 0) {\n // Avoid unnecessary '+ 0'\n index = parent.property;\n } else {\n index = t.binaryExpression(\n \"+\",\n parent.property,\n t.cloneNode(offsetLiteral),\n );\n }\n\n const { scope, parentPath } = path;\n if (!scope.isPure(index)) {\n const temp = scope.generateUidIdentifierBasedOnNode(index);\n scope.push({ id: temp, kind: \"var\" });\n parentPath.replaceWith(\n restIndexImpure({\n ARGUMENTS: argsId,\n OFFSET: offsetLiteral,\n INDEX: index,\n REF: t.cloneNode(temp),\n }),\n );\n } else {\n parentPath.replaceWith(\n restIndex({\n ARGUMENTS: argsId,\n OFFSET: offsetLiteral,\n INDEX: index,\n }),\n );\n const replacedParentPath = parentPath as NodePath<t.ConditionalExpression>;\n\n // See if we can statically evaluate the first test (i.e. index < offset)\n // and optimize the AST accordingly.\n const offsetTestPath = replacedParentPath.get(\n \"test\",\n ) as NodePath<t.BinaryExpression>;\n const valRes = offsetTestPath.get(\"left\").evaluate();\n if (valRes.confident) {\n if (valRes.value === true) {\n replacedParentPath.replaceWith(scope.buildUndefinedNode());\n } else {\n offsetTestPath.replaceWith(offsetTestPath.get(\"right\"));\n }\n }\n }\n}\n\nfunction optimiseLengthGetter(\n path: NodePath<t.Identifier | t.JSXIdentifier>,\n argsId: t.Identifier,\n offset: number,\n) {\n if (offset) {\n path.parentPath.replaceWith(\n restLength({\n ARGUMENTS: argsId,\n OFFSET: t.numericLiteral(offset),\n }),\n );\n } else {\n path.replaceWith(argsId);\n }\n}\n\nexport default function convertFunctionRest(path: NodePath<t.Function>) {\n const { node, scope } = path;\n if (!hasRest(node)) return false;\n\n const restPath = path.get(\n `params.${node.params.length - 1}.argument`,\n ) as NodePath<t.Pattern | t.Identifier>;\n\n if (!restPath.isIdentifier()) {\n const shadowedParams = new Set<string>();\n collectShadowedParamsNames(restPath, path.scope, shadowedParams);\n\n let needsIIFE = shadowedParams.size > 0;\n if (!needsIIFE) {\n const state = {\n needsOuterBinding: false,\n scope,\n };\n restPath.traverse(iifeVisitor, state);\n needsIIFE = state.needsOuterBinding;\n }\n\n if (needsIIFE) {\n path.ensureBlock();\n path.set(\n \"body\",\n t.blockStatement([\n buildScopeIIFE(shadowedParams, path.node.body as t.BlockStatement),\n ]),\n );\n }\n }\n\n let rest = restPath.node;\n node.params.pop(); // This returns 'rest'\n\n if (t.isPattern(rest)) {\n const pattern = rest;\n rest = scope.generateUidIdentifier(\"ref\");\n\n const declar = t.variableDeclaration(\"let\", [\n t.variableDeclarator(pattern, rest),\n ]);\n path.ensureBlock();\n (node.body as t.BlockStatement).body.unshift(declar);\n } else if (rest.name === \"arguments\") {\n scope.rename(rest.name);\n }\n\n const argsId = t.identifier(\"arguments\");\n const paramsCount = getParamsCount(node);\n\n // check and optimise for extremely common cases\n const state: State = {\n references: [],\n offset: paramsCount,\n argumentsNode: argsId,\n outerBinding: scope.getBindingIdentifier(rest.name),\n candidates: [],\n name: rest.name,\n deopted: false,\n };\n\n path.traverse(memberExpressionOptimisationVisitor, state);\n\n // There are only \"shorthand\" references\n if (!state.deopted && !state.references.length) {\n for (const { path, cause } of state.candidates) {\n const clonedArgsId = t.cloneNode(argsId);\n switch (cause) {\n case \"indexGetter\":\n optimiseIndexGetter(path, clonedArgsId, state.offset);\n break;\n case \"lengthGetter\":\n optimiseLengthGetter(path, clonedArgsId, state.offset);\n break;\n default:\n path.replaceWith(clonedArgsId);\n }\n }\n return true;\n }\n\n state.references.push(...state.candidates.map(({ path }) => path));\n\n const start = t.numericLiteral(paramsCount);\n const key = scope.generateUidIdentifier(\"key\");\n const len = scope.generateUidIdentifier(\"len\");\n\n let arrKey, arrLen;\n if (paramsCount) {\n // this method has additional params, so we need to subtract\n // the index of the current argument position from the\n // position in the array that we want to populate\n arrKey = t.binaryExpression(\"-\", t.cloneNode(key), t.cloneNode(start));\n\n // we need to work out the size of the array that we're\n // going to store all the rest parameters\n //\n // we need to add a check to avoid constructing the array\n // with <0 if there are less arguments than params as it'll\n // cause an error\n arrLen = t.conditionalExpression(\n t.binaryExpression(\">\", t.cloneNode(len), t.cloneNode(start)),\n t.binaryExpression(\"-\", t.cloneNode(len), t.cloneNode(start)),\n t.numericLiteral(0),\n );\n } else {\n arrKey = t.identifier(key.name);\n arrLen = t.identifier(len.name);\n }\n\n const loop = buildRest({\n ARGUMENTS: argsId,\n ARRAY_KEY: arrKey,\n ARRAY_LEN: arrLen,\n START: start,\n ARRAY: rest,\n KEY: key,\n LEN: len,\n });\n\n if (state.deopted) {\n (node.body as t.BlockStatement).body.unshift(loop);\n } else {\n let target = path\n .getEarliestCommonAncestorFrom(state.references)\n .getStatementParent();\n\n // don't perform the allocation inside a loop\n target.findParent(path => {\n if (path.isLoop()) {\n target = path;\n } else {\n // Stop crawling up if this is a function.\n return path.isFunction();\n }\n });\n\n target.insertBefore(loop);\n }\n\n return true;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,YAAA,GAAAD,OAAA;AAMA,MAAME,SAAS,GAAGC,cAAQ,CAACC,SAAS,CAAE;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC;AAEF,MAAMC,SAAS,GAAGF,cAAQ,CAACG,UAAU,CAAE;AACvC;AACA,CAAC,CAAC;AAEF,MAAMC,eAAe,GAAGJ,cAAQ,CAACG,UAAU,CAAE;AAC7C;AACA,CAAC,CAAC;AAEF,MAAME,UAAU,GAAGL,cAAQ,CAACG,UAAU,CAAE;AACxC;AACA,CAAC,CAAC;AAEF,SAASG,cAAcA,CACrBC,IAA8C,EAC9CC,KAAY,EACZ;EACA,IAAID,IAAI,CAACE,IAAI,CAACC,IAAI,KAAKF,KAAK,CAACE,IAAI,EAAE;IAEjC,OAAOH,IAAI,CAACI,KAAK,CAACC,uBAAuB,CAACJ,KAAK,CAACE,IAAI,EAAEF,KAAK,CAACK,YAAY,CAAC;EAC3E;EAEA,OAAO,KAAK;AACd;AAoCA,MAAMC,mCAAmD,GAAG;EAC1DC,KAAKA,CAACR,IAAI,EAAEC,KAAK,EAAE;IAEjB,IAAI,CAACD,IAAI,CAACI,KAAK,CAACC,uBAAuB,CAACJ,KAAK,CAACE,IAAI,EAAEF,KAAK,CAACK,YAAY,CAAC,EAAE;MACvEN,IAAI,CAACS,IAAI,CAAC,CAAC;IACb;EACF,CAAC;EAEDC,IAAIA,CAACV,IAAsB,EAAE;IAE3B,IAAIA,IAAI,CAACW,oBAAoB,CAAC,CAAC,EAAE;IAEjCX,IAAI,CAACS,IAAI,CAAC,CAAC;EACb,CAAC;EAEDG,QAAQA,CAACZ,IAAI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