node-ejs-renderer/node_modules/@babel/plugin-transform-block-scoping/lib/loop.js.map
2024-06-09 13:55:01 -04:00

1 line
24 KiB
Plaintext

{"version":3,"names":["_core","require","collectLoopBodyBindingsVisitor","Expression|Declaration|Loop","path","skip","Scope","state","isFunctionParent","bindings","scope","name","Object","keys","binding","kind","blockScoped","push","getLoopBodyBindings","loopPath","traverse","getUsageInBody","seen","WeakSet","capturedInClosure","constantViolations","filterMap","inBody","inClosure","relativeLoopLocation","id","isUpdateExpression","get","isAssignmentExpression","add","node","references","referencePaths","has","hasConstantViolations","length","usages","concat","bodyPath","currPath","parentPath","isFunction","isClass","isMethod","Error","collectCompletionsAndVarsVisitor","Function","LabeledStatement","enter","labelsStack","label","exit","popped","pop","Loop","_","labellessContinueTargets","labellessBreakTargets","SwitchStatement","BreakStatement|ContinueStatement","includes","isBreakStatement","breaksContinues","ReturnStatement","returns","VariableDeclaration","parent","loopNode","isVarInLoopHead","vars","wrapLoopBody","captured","updatedBindingsUsages","callArgs","closureParams","updater","updatedUsage","t","identifier","innerName","generateUid","assignmentExpression","replaceWith","fn","functionExpression","toBlock","body","call","callExpression","fnParent","findParent","p","async","generator","yieldExpression","awaitExpression","updaterNode","expressionStatement","sequenceExpression","varPath","insertBefore","variableDeclaration","variableDeclarator","bodyStmts","varNames","assign","decl","declarations","getBindingIdentifiers","init","isForXStatement","left","replacement","remove","pushContainer","map","labelNum","returnNum","type","addComment","returnStatement","numericLiteral","cloneNode","template","statement","ast","completionId","isVariableDeclaration","injected","i","indexOf","hasInjected","arg","argument","buildUndefinedNode","blockStatement","isForStatement","key","list","result","item","mapped"],"sources":["../src/loop.ts"],"sourcesContent":["import { template, types as t } from \"@babel/core\";\nimport type { NodePath, Visitor, Binding } from \"@babel/traverse\";\n\ninterface LoopBodyBindingsState {\n blockScoped: Binding[];\n}\n\nconst collectLoopBodyBindingsVisitor: Visitor<LoopBodyBindingsState> = {\n \"Expression|Declaration|Loop\"(path) {\n path.skip();\n },\n Scope(path, state) {\n if (path.isFunctionParent()) path.skip();\n\n const { bindings } = path.scope;\n for (const name of Object.keys(bindings)) {\n const binding = bindings[name];\n if (\n binding.kind === \"let\" ||\n binding.kind === \"const\" ||\n binding.kind === \"hoisted\"\n ) {\n state.blockScoped.push(binding);\n }\n }\n },\n};\n\nexport function getLoopBodyBindings(loopPath: NodePath<t.Loop>) {\n const state: LoopBodyBindingsState = { blockScoped: [] };\n loopPath.traverse(collectLoopBodyBindingsVisitor, state);\n return state.blockScoped;\n}\n\nexport function getUsageInBody(binding: Binding, loopPath: NodePath<t.Loop>) {\n // UpdateExpressions are counted both as a reference and a mutation,\n // so we need to de-duplicate them.\n const seen = new WeakSet<t.Node>();\n\n let capturedInClosure = false;\n\n const constantViolations = filterMap(binding.constantViolations, path => {\n const { inBody, inClosure } = relativeLoopLocation(path, loopPath);\n if (!inBody) return null;\n capturedInClosure ||= inClosure;\n\n const id = path.isUpdateExpression()\n ? path.get(\"argument\")\n : path.isAssignmentExpression()\n ? path.get(\"left\")\n : null;\n if (id) seen.add(id.node);\n return id as NodePath<t.Identifier> | null;\n });\n\n const references = filterMap(binding.referencePaths, path => {\n if (seen.has(path.node)) return null;\n\n const { inBody, inClosure } = relativeLoopLocation(path, loopPath);\n if (!inBody) return null;\n capturedInClosure ||= inClosure;\n\n return path as NodePath<t.Identifier>;\n });\n\n return {\n capturedInClosure,\n hasConstantViolations: constantViolations.length > 0,\n usages: references.concat(constantViolations),\n };\n}\n\nfunction relativeLoopLocation(path: NodePath, loopPath: NodePath<t.Loop>) {\n const bodyPath = loopPath.get(\"body\");\n let inClosure = false;\n\n for (let currPath = path; currPath; currPath = currPath.parentPath) {\n if (currPath.isFunction() || currPath.isClass() || currPath.isMethod()) {\n inClosure = true;\n }\n if (currPath === bodyPath) {\n return { inBody: true, inClosure };\n } else if (currPath === loopPath) {\n return { inBody: false, inClosure };\n }\n }\n\n throw new Error(\n \"Internal Babel error: path is not in loop. Please report this as a bug.\",\n );\n}\n\ninterface CompletionsAndVarsState {\n breaksContinues: NodePath<t.BreakStatement | t.ContinueStatement>[];\n returns: NodePath<t.ReturnStatement>[];\n labelsStack: string[];\n labellessContinueTargets: number;\n labellessBreakTargets: number;\n\n vars: NodePath<t.VariableDeclaration>[];\n loopNode: t.Loop;\n}\n\nconst collectCompletionsAndVarsVisitor: Visitor<CompletionsAndVarsState> = {\n Function(path) {\n path.skip();\n },\n LabeledStatement: {\n enter({ node }, state) {\n state.labelsStack.push(node.label.name);\n },\n exit({ node }, state) {\n const popped = state.labelsStack.pop();\n if (popped !== node.label.name) {\n throw new Error(\"Assertion failure. Please report this bug to Babel.\");\n }\n },\n },\n Loop: {\n enter(_, state) {\n state.labellessContinueTargets++;\n state.labellessBreakTargets++;\n },\n exit(_, state) {\n state.labellessContinueTargets--;\n state.labellessBreakTargets--;\n },\n },\n SwitchStatement: {\n enter(_, state) {\n state.labellessBreakTargets++;\n },\n exit(_, state) {\n state.labellessBreakTargets--;\n },\n },\n \"BreakStatement|ContinueStatement\"(\n path: NodePath<t.BreakStatement | t.ContinueStatement>,\n state,\n ) {\n const { label } = path.node;\n if (label) {\n if (state.labelsStack.includes(label.name)) return;\n } else if (\n path.isBreakStatement()\n ? state.labellessBreakTargets > 0\n : state.labellessContinueTargets > 0\n ) {\n return;\n }\n state.breaksContinues.push(path);\n },\n ReturnStatement(path, state) {\n state.returns.push(path);\n },\n VariableDeclaration(path, state) {\n if (path.parent === state.loopNode && isVarInLoopHead(path)) return;\n if (path.node.kind === \"var\") state.vars.push(path);\n },\n};\n\nexport function wrapLoopBody(\n loopPath: NodePath<t.Loop>,\n captured: string[],\n updatedBindingsUsages: Map<string, NodePath<t.Identifier>[]>,\n) {\n const loopNode = loopPath.node;\n const state: CompletionsAndVarsState = {\n breaksContinues: [],\n returns: [],\n labelsStack: [],\n labellessBreakTargets: 0,\n labellessContinueTargets: 0,\n vars: [],\n loopNode,\n };\n loopPath.traverse(collectCompletionsAndVarsVisitor, state);\n\n const callArgs = [];\n const closureParams = [];\n const updater = [];\n for (const [name, updatedUsage] of updatedBindingsUsages) {\n callArgs.push(t.identifier(name));\n\n const innerName = loopPath.scope.generateUid(name);\n closureParams.push(t.identifier(innerName));\n updater.push(\n t.assignmentExpression(\"=\", t.identifier(name), t.identifier(innerName)),\n );\n for (const path of updatedUsage) path.replaceWith(t.identifier(innerName));\n }\n for (const name of captured) {\n if (updatedBindingsUsages.has(name)) continue; // already injected\n callArgs.push(t.identifier(name));\n closureParams.push(t.identifier(name));\n }\n\n const id = loopPath.scope.generateUid(\"loop\");\n const fn = t.functionExpression(\n null,\n closureParams,\n t.toBlock(loopNode.body),\n );\n let call: t.Expression = t.callExpression(t.identifier(id), callArgs);\n\n const fnParent = loopPath.findParent(p => p.isFunction());\n if (fnParent) {\n const { async, generator } = fnParent.node as t.Function;\n fn.async = async;\n fn.generator = generator;\n if (generator) call = t.yieldExpression(call, true);\n else if (async) call = t.awaitExpression(call);\n }\n\n const updaterNode =\n updater.length > 0\n ? t.expressionStatement(t.sequenceExpression(updater))\n : null;\n if (updaterNode) fn.body.body.push(updaterNode);\n\n // NOTE: Calling .insertBefore on the loop path might cause the\n // loop to be moved in the AST. For example, in\n // if (true) for (let x of y) ...\n // .insertBefore will replace the loop with a block:\n // if (true) { var _loop = ...; for (let x of y) ... }\n // All subsequent operations in this function on the loop node\n // must not assume that loopPath still represents the loop.\n // TODO: Consider using a function declaration\n const [varPath] = loopPath.insertBefore(\n t.variableDeclaration(\"var\", [t.variableDeclarator(t.identifier(id), fn)]),\n ) as [NodePath<t.VariableDeclaration>];\n\n const bodyStmts: t.Statement[] = [];\n\n const varNames: string[] = [];\n for (const varPath of state.vars) {\n const assign = [];\n for (const decl of varPath.node.declarations) {\n varNames.push(...Object.keys(t.getBindingIdentifiers(decl.id)));\n if (decl.init) {\n assign.push(t.assignmentExpression(\"=\", decl.id, decl.init));\n } else if (t.isForXStatement(varPath.parent, { left: varPath.node })) {\n assign.push(decl.id as t.Identifier);\n }\n }\n if (assign.length > 0) {\n const replacement: t.Node =\n assign.length === 1 ? assign[0] : t.sequenceExpression(assign);\n varPath.replaceWith(replacement);\n } else {\n varPath.remove();\n }\n }\n if (varNames.length) {\n varPath.pushContainer(\n \"declarations\",\n varNames.map(name => t.variableDeclarator(t.identifier(name))),\n );\n }\n\n const labelNum = state.breaksContinues.length;\n const returnNum = state.returns.length;\n if (labelNum + returnNum === 0) {\n bodyStmts.push(t.expressionStatement(call));\n } else if (labelNum === 1 && returnNum === 0) {\n for (const path of state.breaksContinues) {\n const { node } = path;\n const { type, label } = node;\n let name = type === \"BreakStatement\" ? \"break\" : \"continue\";\n if (label) name += \" \" + label.name;\n path.replaceWith(\n t.addComment(\n t.returnStatement(t.numericLiteral(1)),\n \"trailing\",\n \" \" + name,\n true,\n ),\n );\n if (updaterNode) path.insertBefore(t.cloneNode(updaterNode));\n\n bodyStmts.push(\n template.statement.ast`\n if (${call}) ${node}\n `,\n );\n }\n } else {\n const completionId = loopPath.scope.generateUid(\"ret\");\n\n if (varPath.isVariableDeclaration()) {\n varPath.pushContainer(\"declarations\", [\n t.variableDeclarator(t.identifier(completionId)),\n ]);\n bodyStmts.push(\n t.expressionStatement(\n t.assignmentExpression(\"=\", t.identifier(completionId), call),\n ),\n );\n } else {\n bodyStmts.push(\n t.variableDeclaration(\"var\", [\n t.variableDeclarator(t.identifier(completionId), call),\n ]),\n );\n }\n\n const injected: string[] = [];\n for (const path of state.breaksContinues) {\n const { node } = path;\n const { type, label } = node;\n let name = type === \"BreakStatement\" ? \"break\" : \"continue\";\n if (label) name += \" \" + label.name;\n\n let i = injected.indexOf(name);\n const hasInjected = i !== -1;\n if (!hasInjected) {\n injected.push(name);\n i = injected.length - 1;\n }\n\n path.replaceWith(\n t.addComment(\n t.returnStatement(t.numericLiteral(i)),\n \"trailing\",\n \" \" + name,\n true,\n ),\n );\n if (updaterNode) path.insertBefore(t.cloneNode(updaterNode));\n\n if (hasInjected) continue;\n\n bodyStmts.push(\n template.statement.ast`\n if (${t.identifier(completionId)} === ${t.numericLiteral(i)}) ${node}\n `,\n );\n }\n\n if (returnNum) {\n for (const path of state.returns) {\n const arg = path.node.argument || path.scope.buildUndefinedNode();\n path.replaceWith(\n template.statement.ast`\n return { v: ${arg} };\n `,\n );\n }\n\n bodyStmts.push(\n template.statement.ast`\n if (${t.identifier(completionId)}) return ${t.identifier(\n completionId,\n )}.v;\n `,\n );\n }\n }\n\n loopNode.body = t.blockStatement(bodyStmts);\n\n return varPath;\n}\n\nexport function isVarInLoopHead(path: NodePath<t.VariableDeclaration>) {\n if (t.isForStatement(path.parent)) return path.key === \"init\";\n if (t.isForXStatement(path.parent)) return path.key === \"left\";\n return false;\n}\n\nfunction filterMap<T, U extends object>(list: T[], fn: (item: T) => U | null) {\n const result: U[] = [];\n for (const item of list) {\n const mapped = fn(item);\n if (mapped) result.push(mapped);\n }\n return result;\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAOA,MAAMC,8BAA8D,GAAG;EACrE,6BAA6BC,CAACC,IAAI,EAAE;IAClCA,IAAI,CAACC,IAAI,CAAC,CAAC;EACb,CAAC;EACDC,KAAKA,CAACF,IAAI,EAAEG,KAAK,EAAE;IACjB,IAAIH,IAAI,CAACI,gBAAgB,CAAC,CAAC,EAAEJ,IAAI,CAACC,IAAI,CAAC,CAAC;IAExC,MAAM;MAAEI;IAAS,CAAC,GAAGL,IAAI,CAACM,KAAK;IAC/B,KAAK,MAAMC,IAAI,IAAIC,MAAM,CAACC,IAAI,CAACJ,QAAQ,CAAC,EAAE;MACxC,MAAMK,OAAO,GAAGL,QAAQ,CAACE,IAAI,CAAC;MAC9B,IACEG,OAAO,CAACC,IAAI,KAAK,KAAK,IACtBD,OAAO,CAACC,IAAI,KAAK,OAAO,IACxBD,OAAO,CAACC,IAAI,KAAK,SAAS,EAC1B;QACAR,KAAK,CAACS,WAAW,CAACC,IAAI,CAACH,OAAO,CAAC;MACjC;IACF;EACF;AACF,CAAC;AAEM,SAASI,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