Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/lib/lambda/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,13 @@ function replace(nameToReplace: Name, replacer: Expr, expression: Expr): Expr {
// 1: isn't free in the replacer
// 2: isn't free in the expression body
// 3: isn't captured by an intermediate function in the expression body
// 4: isn't the argument name that is being replaced.
const freeInExpressionBody = getFreeVars(expression.body).map(
(node) => node.name
);
const argNames = getAllArgumentNames(expression.body);
let newName = generateNewName(
freeInReplacer.concat(freeInExpressionBody, argNames)
freeInReplacer.concat(freeInExpressionBody, argNames, [nameToReplace])
);

// And make that the new function arg name
Expand Down