Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
build.identifier(localVarName),
addressParam)]);
// Use member expression so that this isn't cps'd. Writing as an
// assignment statement doesn't work as it is wrapped in a thunk and
// returned early from the function.
var saveAddress = build.expressionStatement(
build.callExpression(
build.memberExpression(
build.identifier(saveAddressFn[0]),
build.identifier(saveAddressFn[1])
), [
build.identifier(globalVarName),
addressParam]));
var expr = build.functionExpression(
node.id,
node.params,
build.blockStatement([bindAddress, saveAddress].concat(node.body.body))
);
expr.loc = node.loc;
return expr;
}
function store(node) {
switch (node.type) {
// have to add the store argument to each function
case Syntax.FunctionExpression:
return build.functionExpression(node.id,
[storeIdNode].concat(node.params),
node.body);
// pass the store variable at each call (that isn't primitive)
case Syntax.CallExpression:
if (isPrimitive(node.callee)) {
return node;
}
else if (node.arguments.length > 0 &&
node.arguments[0].type === 'Identifier' &&
node.arguments[0].name === 'globalStore') {
return node;
}
else {
return build.callExpression(node.callee,
[storeIdNode].concat(node.arguments));
function naming(node) {
switch (node.type) {
case Syntax.FunctionExpression:
return build.functionExpression(node.id,
[addresses.shift()].concat(node.params),
node.body);
// add a gensym onto the address variable
case Syntax.CallExpression:
if (isPrimitive(node.callee)) {
return node;
} else {
return build.callExpression(node.callee,
[makeAddressExtension(addresses[0])].concat(node.arguments));
}
default:
}
}
addMethod(name, args, body) {
this.body.push(b.methodDefinition(
'method',
b.identifier(name),
b.functionExpression(
null,
args,
b.blockStatement(body))));
}
clause(Syntax.DebuggerStatement, function() {
var body = build.blockStatement([node]);
return metaK(buildCall(build.functionExpression(null, [], body), []));
})
.then(mtime => {
return {
index,
name,
ast: b.functionExpression(
b.identifier(`_${index}`),
[
b.identifier('module'),
b.identifier('exports')
],
b.blockStatement(
moduleAst.body as ESTree.Statement[]
)
),
remove: false,
mtime
};
});
}
function thunkify(node, fail) {
if (types.Program.check(node)) {
return build.program([
build.expressionStatement(
build.functionExpression(
null,
[],
build.blockStatement(returnify(node.body))
)
)
]);
}
else {
return failSafe('thunkify', fail);
}
}
function thunkify(node) {
return build.functionExpression(
null, [],
build.blockStatement([
build.returnStatement(node)
]), false, false);
}