Download pool/shard010/JavaScript/0062620_shadow-functions.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 806 Bytes
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard010/JavaScript/0062620_shadow-functions.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard010/JavaScript/0062620_shadow-functions.js
-
curl -L -o 0062620_shadow-functions.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard010/JavaScript/0062620_shadow-functions.js
806 Bytes
| import * as t from "../../../types"; | |
| export var metadata = { | |
| group: "builtin-trailing" | |
| }; | |
| function remap(path, key, create) { | |
| // ensure that we're shadowed | |
| if (!path.inShadow()) return; | |
| var fnPath = path.findParent((path) => !path.is("shadow") && (path.isFunction() || path.isProgram())); | |
| var cached = fnPath.getData(key); | |
| if (cached) return cached; | |
| var init = create(); | |
| var id = path.scope.generateUidIdentifier(key); | |
| fnPath.setData(key, id); | |
| fnPath.scope.push({ id, init }); | |
| return id; | |
| } | |
| export function ThisExpression() { | |
| return remap(this, "this", () => t.thisExpression()); | |
| } | |
| export function ReferencedIdentifier(node) { | |
| if (node.name === "arguments" && !node._shadowedFunctionLiteral) { | |
| return remap(this, "arguments", () => t.identifier("arguments")); | |
| } | |
| } | |