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: 07d4ec0d7db3875833abd94d5a18df4b69969f05
Pull Request resolved: #30332
  • Loading branch information
josephsavona committed Jul 15, 2024
1 parent 3997def commit 1c80938
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 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 @@ -278,16 +278,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 1c80938

Please sign in to comment.