Innovenergy_trunk/frontend/node_modules/@babel/plugin-transform-block-scoping/lib/loop.js.map

1 line
21 KiB
Plaintext

{"version":3,"names":["collectLoopBodyBindingsVisitor","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","Error","collectCompletionsAndVarsVisitor","Function","LabeledStatement","enter","labelsStack","label","exit","popped","pop","Loop","_","labellessContinueTargets","labellessBreakTargets","SwitchStatement","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","replacement","isForStatement","isForXStatement","left","remove","map","completionId","injected","Set","type","returnStatement","stringLiteral","cloneNode","template","statement","ast","arg","argument","buildUndefinedNode","blockStatement","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()) inClosure = true;\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 }\n }\n if (assign.length > 0) {\n let replacement: t.Node =\n assign.length === 1 ? assign[0] : t.sequenceExpression(assign);\n if (\n !t.isForStatement(varPath.parent, { init: varPath.node }) &&\n !t.isForXStatement(varPath.parent, { left: varPath.node })\n ) {\n replacement = t.expressionStatement(replacement);\n }\n varPath.replaceWith(replacement);\n } else {\n varPath.remove();\n }\n }\n if (varNames.length) {\n bodyStmts.push(\n t.variableDeclaration(\n \"var\",\n varNames.map(name => t.variableDeclarator(t.identifier(name))),\n ),\n );\n }\n\n if (state.breaksContinues.length === 0 && state.returns.length === 0) {\n bodyStmts.push(t.expressionStatement(call));\n } else {\n const completionId = loopPath.scope.generateUid(\"ret\");\n bodyStmts.push(\n t.variableDeclaration(\"var\", [\n t.variableDeclarator(t.identifier(completionId), call),\n ]),\n );\n\n const injected = new Set<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 path.replaceWith(t.returnStatement(t.stringLiteral(name)));\n if (updaterNode) path.insertBefore(t.cloneNode(updaterNode));\n\n if (injected.has(name)) continue;\n injected.add(name);\n\n bodyStmts.push(\n template.statement.ast`\n if (\n ${t.identifier(completionId)} === ${t.stringLiteral(name)}\n ) ${node}\n `,\n );\n }\n if (state.returns.length) {\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 (typeof ${t.identifier(completionId)} === \"object\")\n return ${t.identifier(completionId)}.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;AAOA,MAAMA,8BAA8D,GAAG;EACrE,6BAA6B,CAACC,IAAI,EAAE;IAClCA,IAAI,CAACC,IAAI,EAAE;EACb,CAAC;E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