dillon1000/react
Commit
Browse files Rename variables during BuildHIR
Per design discussion, this PR changes BuildHIR to maintain the invariant that, for each distinct variable in the input, that all references to that variable in the HIR will have the same unique `name` _and_ same unique `id`. Phrased differently: Identifiers with the same id will have the same name and vice-versa. This isn't an invariant we maintain throughout compilation — SSA form changes the `id`s — but crucially, ensuring that the `name` is also unique allows us to understand later which identifiers referred to the same original variable and which were different. Follow-up PRs will ensure that we maintain variable identifiers in the output as well, in all cases except shadowing (and for shadowing, we'll rewrite identifiers inside lambdas).
Changed paths5 files
First-parent comparisoncompiler/forget/src/HIR/BuildHIR.ts ModifiedA compiler/forget/src/HIR/Globals.ts AddedM compiler/forget/src/HIR/HIRBuilder.ts ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/type-test-return-type-inference.expect.md ModifiedPatch
Files changed
Rendering syntax-highlighted changes…