diff --git a/compiler/forget/src/HIR/BuildHIR.ts b/compiler/forget/src/HIR/BuildHIR.ts index 7af5f6717f..0029754899 100644 --- a/compiler/forget/src/HIR/BuildHIR.ts +++ b/compiler/forget/src/HIR/BuildHIR.ts @@ -623,7 +623,7 @@ function lowerStatement( const kind = nodeKind === "let" ? InstructionKind.Let : InstructionKind.Const; for (const declaration of stmt.get("declarations")) { - const id = lowerLVal(builder, declaration.get("id")); + const id = declaration.get("id"); const init = declaration.get("init"); let value: InstructionValue; if (init.hasNode()) { @@ -632,15 +632,16 @@ function lowerStatement( value = { kind: "Primitive", value: undefined, - loc: id.loc, + loc: id.node.loc ?? GeneratedSource, }; } - builder.push({ - id: makeInstructionId(0), - lvalue: { place: id, kind }, - value, - loc: declaration.node.loc ?? GeneratedSource, - }); + lowerAssignment( + builder, + stmt.node.loc ?? GeneratedSource, + kind, + id, + value + ); } return; } @@ -1343,3 +1344,19 @@ function lowerLVal(builder: HIRBuilder, exprPath: NodePath): Place { } } } + +function lowerAssignment( + builder: HIRBuilder, + loc: SourceLocation, + kind: InstructionKind, + lvalue: NodePath, + value: InstructionValue +): void { + const id = lowerLVal(builder, lvalue); + builder.push({ + id: makeInstructionId(0), + lvalue: { place: id, kind }, + value, + loc, + }); +} diff --git a/compiler/forget/src/__tests__/fixtures/hir/component.expect.md b/compiler/forget/src/__tests__/fixtures/hir/component.expect.md index 52cc6b8760..e529c173dc 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/component.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/component.expect.md @@ -38,9 +38,9 @@ bb0: [1] Const mutate items$30:TProp = read props$29.items [2] Const mutate maxItems$31:TProp = read props$29.maxItems [3] Const mutate renderedItems$32_@0:TPrimitive[3:33] = Array [] - [4] Const mutate seen$33_@0[3:33] = New mutate Set$6() + [4] Const mutate seen$33_@0[3:33] = New mutate Set$5() [5] Const mutate $34:TPrimitive = 0 - [6] Const mutate max$35_@2:TPrimitive = Call mutate Math$8.max(read $34:TPrimitive, read maxItems$31:TProp) + [6] Const mutate max$35_@2:TPrimitive = Call mutate Math$7.max(read $34:TPrimitive, read maxItems$31:TProp) [7] For init=bb3 test=bb1 loop=bb5 update=bb4 fallthrough=bb2 bb3: predecessor blocks: bb0 @@ -114,10 +114,10 @@ function Component( [2] Const mutate maxItems$31:TProp = read props$29.maxItems scope @0 [3:33] deps=[read maxItems$31:TProp, read items$30.length, read items$30] out=[renderedItems$32_@0] { [3] Const mutate renderedItems$32_@0:TPrimitive[3:33] = Array [] - [4] Const mutate seen$33_@0[3:33] = New mutate Set$6() + [4] Const mutate seen$33_@0[3:33] = New mutate Set$5() [5] Const mutate $34:TPrimitive = 0 scope @2 [6:7] deps=[read maxItems$31:TProp] out=[max$35_@2] { - [6] Const mutate max$35_@2:TPrimitive = Call mutate Math$8.max(read $34:TPrimitive, read maxItems$31:TProp) + [6] Const mutate max$35_@2:TPrimitive = Call mutate Math$7.max(read $34:TPrimitive, read maxItems$31:TProp) } for ( [8] Let mutate i$36_@0:TPrimitive[3:33] = 0 @@ -184,12 +184,12 @@ function Component$0(props$29) { let renderedItems$32; if (c_0 || c_1 || c_2) { renderedItems$32 = []; - const seen$33 = new Set$6(); + const seen$33 = new Set$5(); const c_4 = $[4] !== maxItems$31; let max$35; if (c_4) { - max$35 = Math$8.max(0, maxItems$31); + max$35 = Math$7.max(0, maxItems$31); $[4] = maxItems$31; $[5] = max$35; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md b/compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md index a8538c0731..5267a5bc93 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md @@ -70,7 +70,7 @@ function foo$0() {} ``` bb0: [1] Const mutate x$11_@0 = Array [] - [2] Const mutate y$12_@1 = Call read useFreeze$4:TFunction(freeze x$11_@0) + [2] Const mutate y$12_@1 = Call read useFreeze$3:TFunction(freeze x$11_@0) [3] Call mutate foo$5:TFunction(read y$12_@1, read x$11_@0) [4] Const mutate $13 = "\n " [5] Const mutate $14 = "\n " @@ -89,7 +89,7 @@ function Component( [1] Const mutate x$11_@0 = Array [] } scope @1 [2:3] deps=[freeze x$11_@0] out=[y$12_@1] { - [2] Const mutate y$12_@1 = Call read useFreeze$4:TFunction(freeze x$11_@0) + [2] Const mutate y$12_@1 = Call read useFreeze$3:TFunction(freeze x$11_@0) } [3] Call mutate foo$5:TFunction(read y$12_@1, read x$11_@0) [4] Const mutate $13 = "\n " @@ -120,7 +120,7 @@ function Component$0(props$10) { let y$12; if (c_1) { - y$12 = useFreeze$4(x$11); + y$12 = useFreeze$3(x$11); $[1] = x$11; $[2] = y$12; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md index 0d1fb0af6f..d9b5bd443c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md @@ -129,8 +129,8 @@ function Foo$0() {} ``` bb0: - [1] Const mutate a$9_@1[1:7] = Call mutate compute$3:TFunction(read props$8.a) - [2] Const mutate b$10_@1[1:7] = Call mutate compute$3:TFunction(read props$8.b) + [1] Const mutate a$9_@1[1:7] = Call mutate compute$2:TFunction(read props$8.a) + [2] Const mutate b$10_@1[1:7] = Call mutate compute$2:TFunction(read props$8.b) [3] If (read props$8.c) then:bb2 else:bb1 fallthrough=bb1 bb2: predecessor blocks: bb0 @@ -150,8 +150,8 @@ function Component( props, ) { scope @1 [1:7] deps=[read props$8.a, read props$8.b, read props$8.c] out=[a$9_@1] { - [1] Const mutate a$9_@1[1:7] = Call mutate compute$3:TFunction(read props$8.a) - [2] Const mutate b$10_@1[1:7] = Call mutate compute$3:TFunction(read props$8.b) + [1] Const mutate a$9_@1[1:7] = Call mutate compute$2:TFunction(read props$8.a) + [2] Const mutate b$10_@1[1:7] = Call mutate compute$2:TFunction(read props$8.b) if (read props$8.c) { [4] Call mutate mutate$5:TFunction(mutate a$9_@1) [5] Call mutate mutate$5:TFunction(mutate b$10_@1) @@ -175,8 +175,8 @@ function Component$0(props$8) { const c_2 = $[2] !== props$8.c; let a$9; if (c_0 || c_1 || c_2) { - a$9 = compute$3(props$8.a); - const b$10 = compute$3(props$8.b); + a$9 = compute$2(props$8.a); + const b$10 = compute$2(props$8.b); if (props$8.c) { mutate$5(a$9); diff --git a/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md b/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md index d350395eee..0b5a7088ce 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md @@ -28,8 +28,8 @@ function Foo() {} ``` bb0: - [1] Const mutate a$8_@0 = Call mutate compute$3:TFunction(read props$7.a) - [2] Const mutate b$9_@1 = Call mutate compute$3:TFunction(read props$7.b) + [1] Const mutate a$8_@0 = Call mutate compute$2:TFunction(read props$7.a) + [2] Const mutate b$9_@1 = Call mutate compute$2:TFunction(read props$7.b) [3] Const mutate t6$10_@2 = JSX [4] Return read t6$10_@2 ``` @@ -41,10 +41,10 @@ function Component( props, ) { scope @0 [1:2] deps=[read props$7.a] out=[a$8_@0] { - [1] Const mutate a$8_@0 = Call mutate compute$3:TFunction(read props$7.a) + [1] Const mutate a$8_@0 = Call mutate compute$2:TFunction(read props$7.a) } scope @1 [2:3] deps=[read props$7.b] out=[b$9_@1] { - [2] Const mutate b$9_@1 = Call mutate compute$3:TFunction(read props$7.b) + [2] Const mutate b$9_@1 = Call mutate compute$2:TFunction(read props$7.b) } scope @2 [3:4] deps=[freeze a$8_@0, freeze b$9_@1] out=[$10_@2] { [3] Const mutate $10_@2 = JSX @@ -62,7 +62,7 @@ function Component$0(props$7) { const c_0 = $[0] !== props$7.a; let a$8; if (c_0) { - a$8 = compute$3(props$7.a); + a$8 = compute$2(props$7.a); $[0] = props$7.a; $[1] = a$8; } else { @@ -73,7 +73,7 @@ function Component$0(props$7) { let b$9; if (c_2) { - b$9 = compute$3(props$7.b); + b$9 = compute$2(props$7.b); $[2] = props$7.b; $[3] = b$9; } else { diff --git a/compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md index efb11d82f3..4013924b82 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md @@ -100,8 +100,8 @@ function Foo$0() {} ``` bb0: - [1] Const mutate a$9_@0[1:6] = Call mutate compute$3:TFunction(read props$8.a) - [2] Const mutate b$10_@0[1:6] = Call mutate compute$3:TFunction(read props$8.b) + [1] Const mutate a$9_@0[1:6] = Call mutate compute$2:TFunction(read props$8.a) + [2] Const mutate b$10_@0[1:6] = Call mutate compute$2:TFunction(read props$8.b) [3] If (read props$8.c) then:bb2 else:bb1 fallthrough=bb1 bb2: predecessor blocks: bb0 @@ -120,8 +120,8 @@ function Component( props, ) { scope @0 [1:6] deps=[read props$8.a, read props$8.b, read props$8.c] out=[a$9_@0, b$10_@0] { - [1] Const mutate a$9_@0[1:6] = Call mutate compute$3:TFunction(read props$8.a) - [2] Const mutate b$10_@0[1:6] = Call mutate compute$3:TFunction(read props$8.b) + [1] Const mutate a$9_@0[1:6] = Call mutate compute$2:TFunction(read props$8.a) + [2] Const mutate b$10_@0[1:6] = Call mutate compute$2:TFunction(read props$8.b) if (read props$8.c) { [4] Call mutate foo$5:TFunction(mutate a$9_@0, mutate b$10_@0) } @@ -145,8 +145,8 @@ function Component$0(props$8) { let a$9; let b$10; if (c_0 || c_1 || c_2) { - a$9 = compute$3(props$8.a); - b$10 = compute$3(props$8.b); + a$9 = compute$2(props$8.a); + b$10 = compute$2(props$8.b); if (props$8.c) { foo$5(a$9, b$10); diff --git a/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md b/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md index f03b116dfd..cb7f26ce3e 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md @@ -28,8 +28,8 @@ function Foo() {} ``` bb0: - [1] Const mutate a$9_@0[1:4] = Call mutate compute$3:TFunction(read props$8.a) - [2] Const mutate b$10_@0[1:4] = Call mutate compute$3:TFunction(read props$8.b) + [1] Const mutate a$9_@0[1:4] = Call mutate compute$2:TFunction(read props$8.a) + [2] Const mutate b$10_@0[1:4] = Call mutate compute$2:TFunction(read props$8.b) [3] Call mutate foo$5:TFunction(mutate a$9_@0, mutate b$10_@0) [4] Const mutate t6$11_@1 = JSX [5] Return read t6$11_@1 @@ -42,8 +42,8 @@ function Component( props, ) { scope @0 [1:4] deps=[read props$8.a, read props$8.b] out=[a$9_@0, b$10_@0] { - [1] Const mutate a$9_@0[1:4] = Call mutate compute$3:TFunction(read props$8.a) - [2] Const mutate b$10_@0[1:4] = Call mutate compute$3:TFunction(read props$8.b) + [1] Const mutate a$9_@0[1:4] = Call mutate compute$2:TFunction(read props$8.a) + [2] Const mutate b$10_@0[1:4] = Call mutate compute$2:TFunction(read props$8.b) [3] Call mutate foo$5:TFunction(mutate a$9_@0, mutate b$10_@0) } scope @1 [4:5] deps=[freeze a$9_@0, freeze b$10_@0] out=[$11_@1] { @@ -64,8 +64,8 @@ function Component$0(props$8) { let a$9; let b$10; if (c_0 || c_1) { - a$9 = compute$3(props$8.a); - b$10 = compute$3(props$8.b); + a$9 = compute$2(props$8.a); + b$10 = compute$2(props$8.b); foo$5(a$9, b$10); $[0] = props$8.a; $[1] = props$8.b; diff --git a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md index 8c77655861..6227fc14be 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md @@ -70,7 +70,7 @@ bb0: [4] Const mutate d$14_@1:TObject[2:15] = Object { c: read c$13_@2:TObject } [5] Const mutate x$15_@1:TObject[2:15] = Object { } [6] Reassign store x$15_@1.b[2:15] = read b$12_@1 - [7] Const mutate y$16_@1[2:15] = Call mutate mutate$8:TFunction(mutate x$15_@1:TObject, mutate d$14_@1:TObject) + [7] Const mutate y$16_@1[2:15] = Call mutate mutate$7:TFunction(mutate x$15_@1:TObject, mutate d$14_@1:TObject) [8] If (read a$11_@0:TObject) then:bb1 else:bb1 fallthrough=bb1 bb1: predecessor blocks: bb0 @@ -87,7 +87,7 @@ bb7: bb9: predecessor blocks: bb7 [13] Const mutate $17:TPrimitive = null - [14] Call mutate mutate$8:TFunction(mutate x$15_@1:TObject, read $17:TPrimitive) + [14] Call mutate mutate$7:TFunction(mutate x$15_@1:TObject, read $17:TPrimitive) [15] Return ``` @@ -107,7 +107,7 @@ function Component( [4] Const mutate d$14_@1:TObject[2:15] = Object { c: read c$13_@2:TObject } [5] Const mutate x$15_@1:TObject[2:15] = Object { } [6] Reassign store x$15_@1.b[2:15] = read b$12_@1 - [7] Const mutate y$16_@1[2:15] = Call mutate mutate$8:TFunction(mutate x$15_@1:TObject, mutate d$14_@1:TObject) + [7] Const mutate y$16_@1[2:15] = Call mutate mutate$7:TFunction(mutate x$15_@1:TObject, mutate d$14_@1:TObject) if (read a$11_@0:TObject) { } if (read b$12_@1) { @@ -119,7 +119,7 @@ function Component( if (read y$16_@1) { } [13] Const mutate $17:TPrimitive = null - [14] Call mutate mutate$8:TFunction(mutate x$15_@1:TObject, read $17:TPrimitive) + [14] Call mutate mutate$7:TFunction(mutate x$15_@1:TObject, read $17:TPrimitive) return } @@ -153,7 +153,7 @@ function Component$0(props$10) { }; const x$15 = {}; x$15.b = b$12; - const y$16 = mutate$8(x$15, d$14); + const y$16 = mutate$7(x$15, d$14); if (a$11) { } @@ -170,7 +170,7 @@ function Component$0(props$10) { if (y$16) { } - mutate$8(x$15, null); + mutate$7(x$15, null); } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md index 8fc9c80d62..5c3be6c255 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md @@ -42,7 +42,7 @@ function Foo$0() {} bb0: [1] Const mutate a$7_@0[1:4] = Array [] [2] Const mutate b$8_@0:TObject[1:4] = Object { } - [3] Const mutate c$9_@0[1:4] = New mutate Foo$5(mutate a$7_@0, mutate b$8_@0:TObject) + [3] Const mutate c$9_@0[1:4] = New mutate Foo$4(mutate a$7_@0, mutate b$8_@0:TObject) [4] Return freeze c$9_@0 ``` @@ -55,7 +55,7 @@ function Component( scope @0 [1:4] deps=[] out=[c$9_@0] { [1] Const mutate a$7_@0[1:4] = Array [] [2] Const mutate b$8_@0:TObject[1:4] = Object { } - [3] Const mutate c$9_@0[1:4] = New mutate Foo$5(mutate a$7_@0, mutate b$8_@0:TObject) + [3] Const mutate c$9_@0[1:4] = New mutate Foo$4(mutate a$7_@0, mutate b$8_@0:TObject) } return freeze c$9_@0 } @@ -71,7 +71,7 @@ function Component$0(props$6) { if ($[0] === Symbol.for("react.memo_cache_sentinel")) { const a$7 = []; const b$8 = {}; - c$9 = new Foo$5(a$7, b$8); + c$9 = new Foo$4(a$7, b$8); $[0] = c$9; } else { c$9 = $[0]; diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-binary-operator.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-binary-operator.expect.md index e209113e31..4defdc8da4 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-binary-operator.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-binary-operator.expect.md @@ -16,8 +16,8 @@ function component() { ``` bb0: - [1] Const mutate a$7_@0:TPrimitive = Call mutate some$2:TFunction() - [2] Const mutate b$8_@1:TPrimitive = Call mutate someOther$4:TFunction() + [1] Const mutate a$7_@0:TPrimitive = Call mutate some$1:TFunction() + [2] Const mutate b$8_@1:TPrimitive = Call mutate someOther$3:TFunction() [3] Const mutate $9:TPrimitive = Binary read a$7_@0:TPrimitive > read b$8_@1:TPrimitive [4] If (read $9:TPrimitive) then:bb2 else:bb1 fallthrough=bb1 bb2: @@ -35,10 +35,10 @@ bb1: function component( ) { scope @0 [1:2] deps=[] out=[a$7_@0] { - [1] Const mutate a$7_@0:TPrimitive = Call mutate some$2:TFunction() + [1] Const mutate a$7_@0:TPrimitive = Call mutate some$1:TFunction() } scope @1 [2:3] deps=[] out=[b$8_@1] { - [2] Const mutate b$8_@1:TPrimitive = Call mutate someOther$4:TFunction() + [2] Const mutate b$8_@1:TPrimitive = Call mutate someOther$3:TFunction() } [3] Const mutate $9:TPrimitive = Binary read a$7_@0:TPrimitive > read b$8_@1:TPrimitive if (read $9:TPrimitive) { @@ -56,7 +56,7 @@ function component$0() { const $ = React.useMemoCache(); let a$7; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - a$7 = some$2(); + a$7 = some$1(); $[0] = a$7; } else { a$7 = $[0]; @@ -65,7 +65,7 @@ function component$0() { let b$8; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { - b$8 = someOther$4(); + b$8 = someOther$3(); $[1] = b$8; } else { b$8 = $[1]; diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-test-field-load-binary-op.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-test-field-load-binary-op.expect.md index e3d43d61e9..d70c0be5b0 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-test-field-load-binary-op.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-test-field-load-binary-op.expect.md @@ -19,8 +19,8 @@ function component() { ``` bb0: - [1] Const mutate t0$10_@0:TPrimitive = Call mutate makeSomePrimitive$2:TFunction() - [2] Const mutate t1$11_@1:TPrimitive = Call mutate makeSomePrimitive$2:TFunction() + [1] Const mutate t0$10_@0:TPrimitive = Call mutate makeSomePrimitive$1:TFunction() + [2] Const mutate t1$11_@1:TPrimitive = Call mutate makeSomePrimitive$1:TFunction() [3] Const mutate x$12_@2:TObject = Object { u: read t0$10_@0:TPrimitive, v: read t1$11_@1:TPrimitive } [4] Const mutate u$13:TPrimitive = read x$12_@2.u [5] Const mutate v$14:TPrimitive = read x$12_@2.v @@ -39,10 +39,10 @@ bb1: function component( ) { scope @0 [1:2] deps=[] out=[$10_@0] { - [1] Const mutate $10_@0:TPrimitive = Call mutate makeSomePrimitive$2:TFunction() + [1] Const mutate $10_@0:TPrimitive = Call mutate makeSomePrimitive$1:TFunction() } scope @1 [2:3] deps=[] out=[$11_@1] { - [2] Const mutate $11_@1:TPrimitive = Call mutate makeSomePrimitive$2:TFunction() + [2] Const mutate $11_@1:TPrimitive = Call mutate makeSomePrimitive$1:TFunction() } scope @2 [3:4] deps=[read $10_@0:TPrimitive, read $11_@1:TPrimitive] out=[x$12_@2] { [3] Const mutate x$12_@2:TObject = Object { u: read $10_@0:TPrimitive, v: read $11_@1:TPrimitive } @@ -66,7 +66,7 @@ function component$0() { const $ = React.useMemoCache(); let t0$10; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - t0$10 = makeSomePrimitive$2(); + t0$10 = makeSomePrimitive$1(); $[0] = t0$10; } else { t0$10 = $[0]; @@ -75,7 +75,7 @@ function component$0() { let t1$11; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { - t1$11 = makeSomePrimitive$2(); + t1$11 = makeSomePrimitive$1(); $[1] = t1$11; } else { t1$11 = $[1]; diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-test-polymorphic.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-test-polymorphic.expect.md index b60864b6ed..06ead4275c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-test-polymorphic.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-test-polymorphic.expect.md @@ -22,7 +22,7 @@ function component() { ``` bb0: - [1] Const mutate p$7_@0:TPrimitive = Call mutate makePrimitive$2:TFunction() + [1] Const mutate p$7_@0:TPrimitive = Call mutate makePrimitive$1:TFunction() [2] Binary read p$7_@0:TPrimitive + read p$7_@0:TPrimitive [3] Const mutate o$8_@1:TObject = Object { } [4] Const mutate x$9_@2:TObject[4:8] = Object { } @@ -39,7 +39,7 @@ bb0: function component( ) { scope @0 [1:2] deps=[] out=[p$7_@0] { - [1] Const mutate p$7_@0:TPrimitive = Call mutate makePrimitive$2:TFunction() + [1] Const mutate p$7_@0:TPrimitive = Call mutate makePrimitive$1:TFunction() } [2] Binary read p$7_@0:TPrimitive + read p$7_@0:TPrimitive scope @1 [3:4] deps=[] out=[o$8_@1] { @@ -64,7 +64,7 @@ function component$0() { const $ = React.useMemoCache(); let p$7; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - p$7 = makePrimitive$2(); + p$7 = makePrimitive$1(); $[0] = p$7; } else { p$7 = $[0]; diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-test-return-type-inference.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-test-return-type-inference.expect.md index 6a65fc3b1d..38bf888b61 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-test-return-type-inference.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-test-return-type-inference.expect.md @@ -18,8 +18,8 @@ function component() { ``` bb0: - [1] Const mutate x$7_@0:TPrimitive = Call mutate foo$2:TFunction() - [2] Const mutate y$8_@1:TPrimitive = Call mutate foo$2:TFunction() + [1] Const mutate x$7_@0:TPrimitive = Call mutate foo$1:TFunction() + [2] Const mutate y$8_@1:TPrimitive = Call mutate foo$1:TFunction() [3] Const mutate $9:TPrimitive = Binary read x$7_@0:TPrimitive > read y$8_@1:TPrimitive [4] If (read $9:TPrimitive) then:bb2 else:bb1 fallthrough=bb1 bb2: @@ -28,7 +28,7 @@ bb2: [6] Goto bb1 bb1: predecessor blocks: bb2 bb0 - [7] Const mutate z$12_@3 = Call mutate foo$2:TFunction() + [7] Const mutate z$12_@3 = Call mutate foo$1:TFunction() [8] Return ``` @@ -38,16 +38,16 @@ bb1: function component( ) { scope @0 [1:2] deps=[] out=[x$7_@0] { - [1] Const mutate x$7_@0:TPrimitive = Call mutate foo$2:TFunction() + [1] Const mutate x$7_@0:TPrimitive = Call mutate foo$1:TFunction() } scope @1 [2:3] deps=[] out=[y$8_@1] { - [2] Const mutate y$8_@1:TPrimitive = Call mutate foo$2:TFunction() + [2] Const mutate y$8_@1:TPrimitive = Call mutate foo$1:TFunction() } [3] Const mutate $9:TPrimitive = Binary read x$7_@0:TPrimitive > read y$8_@1:TPrimitive if (read $9:TPrimitive) { [5] Const mutate z$10_@2:TObject = Object { } } - [7] Const mutate z$12_@3 = Call mutate foo$2:TFunction() + [7] Const mutate z$12_@3 = Call mutate foo$1:TFunction() return } @@ -60,7 +60,7 @@ function component$0() { const $ = React.useMemoCache(); let x$7; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$7 = foo$2(); + x$7 = foo$1(); $[0] = x$7; } else { x$7 = $[0]; @@ -69,7 +69,7 @@ function component$0() { let y$8; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { - y$8 = foo$2(); + y$8 = foo$1(); $[1] = y$8; } else { y$8 = $[1]; @@ -79,7 +79,7 @@ function component$0() { const z$10 = {}; } - const z$12 = foo$2(); + const z$12 = foo$1(); } ```