@samitouri / QOS-React / commits / eb1d52b01b

[compiler] Refactor createTemporaryPlace

Update createTemporaryPlace to use makeTemporary and also rename makeTemporary to makeTemporaryIdentifier to make it less ambiguous. ghstack-source-id: b5955d3d667064f2ccf7e633ab63df2269dc56fa Pull Request resolved: https://github.com/facebook/react/pull/30585

Sathya Gunsasekaran committed Aug 2, 2024 at 19:26 UTC eb1d52b01bcb47f158bf3f120a67c261523f8f5f
2 files changed +4 -11
compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts
+1 -1
@@ -1205,7 +1205,7 @@ export type ValidIdentifierName = string & {
1205 [opaqueValidIdentifierName]: 'ValidIdentifierName';
1206 };
1207
1208 -export function makeTemporary(
1208 +export function makeTemporaryIdentifier(
1209 id: IdentifierId,
1210 loc: SourceLocation,
1211 ): Identifier {
compiler/packages/babel-plugin-react-compiler/src/HIR/HIRBuilder.ts
+3 -10
@@ -27,7 +27,7 @@ import {
27 makeBlockId,
28 makeIdentifierName,
29 makeInstructionId,
30 - makeTemporary,
30 + makeTemporaryIdentifier,
31 makeType,
32 } from './HIR';
33 import {printInstruction} from './PrintHIR';
@@ -183,7 +183,7 @@ export default class HIRBuilder {
183
184 makeTemporary(loc: SourceLocation): Identifier {
185 const id = this.nextIdentifierId;
186 - return makeTemporary(id, loc);
186 + return makeTemporaryIdentifier(id, loc);
187 }
188
189 #resolveBabelBinding(
@@ -891,14 +891,7 @@ export function createTemporaryPlace(
891 ): Place {
892 return {
893 kind: 'Identifier',
894 - identifier: {
895 - id: env.nextIdentifierId,
896 - mutableRange: {start: makeInstructionId(0), end: makeInstructionId(0)},
897 - name: null,
898 - scope: null,
899 - type: makeType(),
900 - loc,
901 - },
894 + identifier: makeTemporaryIdentifier(env.nextIdentifierId, loc),
895 reactive: false,
896 effect: Effect.Unknown,
897 loc: GeneratedSource,