Skip to content

Commit

Permalink
[compiler][be] Promote destructured params to temporaries
Browse files Browse the repository at this point in the history
Addresses a follow-up from the previous PR. Destructured function params are currently not eagerly promoted to temporaries: we wait until PromotedUsedTemporaries. But params _always_ have to be named, so we can promote when constructing HIR.

ghstack-source-id: ec0c6bec7349c207770fb93dabb9253650f6f0fc
Pull Request resolved: #30332
  • Loading branch information
josephsavona committed Jul 15, 2024
1 parent 3997def commit f8647b9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export function lower(
reactive: false,
loc: param.node.loc ?? GeneratedSource,
};
promoteTemporary(place.identifier);
params.push(place);
lowerAssignment(
builder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import {
ValidIdentifierName,
getHookKind,
makeIdentifierName,
promoteTemporary,
} from "../HIR/HIR";
import { printIdentifier, printPlace } from "../HIR/PrintHIR";
import { eachPatternOperand } from "../HIR/visitors";
Expand Down Expand Up @@ -278,16 +277,6 @@ export function codegenFunction(
pruneUnusedLValues(reactiveFunction);
pruneHoistedContexts(reactiveFunction);

/*
* TODO: temporary function params (due to destructuring) should always be
* promoted so that they can be renamed
*/
for (const param of reactiveFunction.params) {
const place = param.kind === "Identifier" ? param : param.place;
if (place.identifier.name === null) {
promoteTemporary(place.identifier);
}
}
const identifiers = renameVariables(reactiveFunction);
logReactiveFunction("Outline", reactiveFunction);
const codegen = codegenReactiveFunction(
Expand Down

0 comments on commit f8647b9

Please sign in to comment.