Skip to content

Commit 7cf36c6

Browse files
committed
[compiler] Refactor createTemporaryPlace
Update createTemporaryPlace to use makeTemporary and also rename makeTemporary to makeTemporaryIdentifier to make it less ambiguous. [ghstack-poisoned]
1 parent bae18b4 commit 7cf36c6

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ export type ValidIdentifierName = string & {
12051205
[opaqueValidIdentifierName]: 'ValidIdentifierName';
12061206
};
12071207

1208-
export function makeTemporary(
1208+
export function makeTemporaryIdentifier(
12091209
id: IdentifierId,
12101210
loc: SourceLocation,
12111211
): Identifier {

compiler/packages/babel-plugin-react-compiler/src/HIR/HIRBuilder.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
makeBlockId,
2828
makeIdentifierName,
2929
makeInstructionId,
30-
makeTemporary,
30+
makeTemporaryIdentifier,
3131
makeType,
3232
} from './HIR';
3333
import {printInstruction} from './PrintHIR';
@@ -183,7 +183,7 @@ export default class HIRBuilder {
183183

184184
makeTemporary(loc: SourceLocation): Identifier {
185185
const id = this.nextIdentifierId;
186-
return makeTemporary(id, loc);
186+
return makeTemporaryIdentifier(id, loc);
187187
}
188188

189189
#resolveBabelBinding(
@@ -891,14 +891,7 @@ export function createTemporaryPlace(
891891
): Place {
892892
return {
893893
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),
902895
reactive: false,
903896
effect: Effect.Unknown,
904897
loc: GeneratedSource,

0 commit comments

Comments
 (0)