diff --git a/compiler/forget/src/CompilerPipeline.ts b/compiler/forget/src/CompilerPipeline.ts index 6cd73a4158..e89dbe5b6e 100644 --- a/compiler/forget/src/CompilerPipeline.ts +++ b/compiler/forget/src/CompilerPipeline.ts @@ -14,13 +14,13 @@ import { inferTypes, lower, } from "./HIR"; +import { ReactiveFunction } from "./HIR/HIR"; import { buildReactiveFunction, codegenReactiveFunction, flattenReactiveLoops, inferReactiveScopes, inferReactiveScopeVariables, - printReactiveFunction, propagateScopeDependencies, pruneUnusedLabels, pruneUnusedScopes, @@ -30,9 +30,9 @@ import { eliminateRedundantPhi, enterSSA, leaveSSA } from "./SSA"; import { logHIRFunction } from "./Utils/logger"; export type CompilerResult = { - ir: HIRFunction; ast: t.Function; - scopes: string; + ir: HIRFunction; + reactiveFunction: ReactiveFunction; }; export default function ( @@ -73,12 +73,11 @@ export default function ( propagateScopeDependencies(reactiveFunction); pruneUnusedScopes(reactiveFunction); renameVariables(reactiveFunction); - const scopes = printReactiveFunction(reactiveFunction); const ast = codegenReactiveFunction(reactiveFunction); return { ast, ir, - scopes, + reactiveFunction, }; } diff --git a/compiler/forget/src/__tests__/fixtures/hir/_bug_conditional-break-labeled.expect.md b/compiler/forget/src/__tests__/fixtures/hir/_bug_conditional-break-labeled.expect.md index 0511d9c238..2605d96223 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/_bug_conditional-break-labeled.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/_bug_conditional-break-labeled.expect.md @@ -20,40 +20,6 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Const mutate a$4_@0[1:7] = Array [] - [2] Call mutate a$4_@0.push(read props$3.a) - [3] If (read props$3.b) then:bb1 else:bb2 fallthrough=bb2 -bb2: - predecessor blocks: bb0 - [4] Call mutate a$4_@0.push(read props$3.c) - [5] Goto bb1 -bb1: - predecessor blocks: bb0 bb2 - [6] Call mutate a$4_@0.push(read props$3.d) - [7] Return freeze a$4_@0 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - [1] Const mutate a$4_@0[1:7] = Array [] - [2] Call mutate a$4_@0.push(read props$3.a) - if (read props$3.b) { - [6] Call mutate a$4_@0.push(read props$3.d) - return freeze a$4_@0 - } - [4] Call mutate a$4_@0.push(read props$3.c) -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/_bug_expression-with-assignment.expect.md b/compiler/forget/src/__tests__/fixtures/hir/_bug_expression-with-assignment.expect.md index 0ec94a3e82..18f2b3d870 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/_bug_expression-with-assignment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/_bug_expression-with-assignment.expect.md @@ -11,31 +11,6 @@ function f() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$4:TPrimitive = 1 - [2] Const mutate x$0$5:TPrimitive = 2 - [3] Const mutate $6:TPrimitive = Binary read x$0$5:TPrimitive + read x$0$5:TPrimitive - [4] Const mutate $7:TPrimitive = Binary read $6:TPrimitive + read x$0$5:TPrimitive - [5] Return read $7:TPrimitive -``` - -## Reactive Scopes - -``` -function f( -) { - [1] Const mutate x$4:TPrimitive = 1 - [2] Const mutate x$0$5:TPrimitive = 2 - [3] Const mutate $6:TPrimitive = Binary read x$0$5:TPrimitive + read x$0$5:TPrimitive - [4] Const mutate $7:TPrimitive = Binary read $6:TPrimitive + read x$0$5:TPrimitive - return read $7:TPrimitive -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path-mutate.expect.md index ed9bdb7c5a..93183c72e4 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path-mutate.expect.md @@ -13,35 +13,6 @@ function component() { ``` -## HIR - -``` -bb0: - [1] Const mutate z$5_@0[1:7] = Array [] - [2] Const mutate y$6_@0:TObject[1:7] = Object { } - [3] Reassign store y$6_@0.z[1:7] = read z$5_@0 - [4] Const mutate x$7_@0:TObject[1:7] = Object { } - [5] Reassign store x$7_@0.y[1:7] = read y$6_@0:TObject - [6] Call mutate mutate$4:TFunction(mutate x$7_@0.y.z) - [7] Return -``` - -## Reactive Scopes - -``` -function component( -) { - [1] Const mutate z$5_@0[1:7] = Array [] - [2] Const mutate y$6_@0:TObject[1:7] = Object { } - [3] Reassign store y$6_@0.z[1:7] = read z$5_@0 - [4] Const mutate x$7_@0:TObject[1:7] = Object { } - [5] Reassign store x$7_@0.y[1:7] = read y$6_@0:TObject - [6] Call mutate mutate$4:TFunction(mutate x$7_@0.y.z) - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path.expect.md b/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path.expect.md index 78cfb7633c..7ace2cdec6 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path.expect.md @@ -13,39 +13,6 @@ function component() { ``` -## HIR - -``` -bb0: - [1] Const mutate z$4_@0 = Array [] - [2] Const mutate y$5_@1:TObject[2:4] = Object { } - [3] Reassign store y$5_@1.z[2:4] = read z$4_@0 - [4] Const mutate x$6_@2:TObject[4:6] = Object { } - [5] Reassign store x$6_@2.y[4:6] = read y$5_@1:TObject - [6] Return freeze x$6_@2:TObject -``` - -## Reactive Scopes - -``` -function component( -) { - scope @0 [1:2] deps=[] out=[z$4_@0] { - [1] Const mutate z$4_@0 = Array [] - } - scope @1 [2:4] deps=[read z$4_@0] out=[y$5_@1] { - [2] Const mutate y$5_@1:TObject[2:4] = Object { } - [3] Reassign store y$5_@1.z[2:4] = read z$4_@0 - } - scope @2 [4:6] deps=[read y$5_@1:TObject] out=[x$6_@2] { - [4] Const mutate x$6_@2:TObject[4:6] = Object { } - [5] Reassign store x$6_@2.y[4:6] = read y$5_@1:TObject - } - return freeze x$6_@2:TObject -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/alias-while.expect.md b/compiler/forget/src/__tests__/fixtures/hir/alias-while.expect.md index e9959003b5..837819c87c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/alias-while.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/alias-while.expect.md @@ -23,61 +23,6 @@ function mutate(x, y) {} ``` -## HIR - -``` -bb0: - [1] Let mutate a$8_@0:TObject[1:12] = Object { } - [2] Let mutate b$9_@0:TObject[1:12] = Object { } - [3] Let mutate c$10_@0:TObject[1:12] = Object { } - [4] While test=bb1 loop=bb3 fallthrough=bb2 -bb1: - predecessor blocks: bb0 bb3 - [5] If (read cond$7) then:bb3 else:bb2 fallthrough=bb2 -bb3: - predecessor blocks: bb1 - [6] Const mutate z$13_@0[1:12] = read a$8_@0:TObject - [7] Reassign mutate a$8_@0:TObject[1:12] = read b$9_@0:TObject - [8] Reassign mutate b$9_@0:TObject[1:12] = read c$10_@0:TObject - [9] Reassign mutate c$10_@0:TObject[1:12] = read z$13_@0 - [10] Call mutate mutate$6:TFunction(mutate a$8_@0:TObject, mutate b$9_@0:TObject) - [11] Goto(Continue) bb1 -bb2: - predecessor blocks: bb1 - [12] read a$8_@0:TObject - [13] read b$9_@0:TObject - [14] read c$10_@0:TObject - [15] Return freeze a$8_@0:TObject -``` - -## Reactive Scopes - -``` -function foo( - cond, -) { - scope @0 [1:12] deps=[read cond$7] out=[a$8_@0, b$9_@0, c$10_@0] { - [1] Let mutate a$8_@0:TObject[1:12] = Object { } - [2] Let mutate b$9_@0:TObject[1:12] = Object { } - [3] Let mutate c$10_@0:TObject[1:12] = Object { } - while ( - read cond$7 - ) { - [6] Const mutate z$13_@0[1:12] = read a$8_@0:TObject - [7] Reassign mutate a$8_@0:TObject[1:12] = read b$9_@0:TObject - [8] Reassign mutate b$9_@0:TObject[1:12] = read c$10_@0:TObject - [9] Reassign mutate c$10_@0:TObject[1:12] = read z$13_@0 - [10] Call mutate mutate$6:TFunction(mutate a$8_@0:TObject, mutate b$9_@0:TObject) - } - } - [12] read a$8_@0:TObject - [13] read b$9_@0:TObject - [14] read c$10_@0:TObject - return freeze a$8_@0:TObject -} - -``` - ## Code ```javascript @@ -117,25 +62,6 @@ function foo(cond) { } ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function mutate( - x, - y, -) { - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md b/compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md index d5ee6d83c0..63851dcb60 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md @@ -16,37 +16,6 @@ function g(a) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$5:TPrimitive = 1 - [2] Const mutate $6:TPrimitive = 1 - [3] Const mutate x$0$7:TPrimitive = Binary read x$5:TPrimitive + read $6:TPrimitive - [4] Const mutate $8:TPrimitive = 1 - [5] Const mutate x$1$9:TPrimitive = Binary read x$0$7:TPrimitive + read $8:TPrimitive - [6] Const mutate $10:TPrimitive = 1 - [7] Const mutate x$2$11:TPrimitive = Binary read x$1$9:TPrimitive >>> read $10:TPrimitive - [8] Return -``` - -## Reactive Scopes - -``` -function f( -) { - [1] Const mutate x$5:TPrimitive = 1 - [2] Const mutate $6:TPrimitive = 1 - [3] Const mutate x$0$7:TPrimitive = Binary read x$5:TPrimitive + read $6:TPrimitive - [4] Const mutate $8:TPrimitive = 1 - [5] Const mutate x$1$9:TPrimitive = Binary read x$0$7:TPrimitive + read $8:TPrimitive - [6] Const mutate $10:TPrimitive = 1 - [7] Const mutate x$2$11:TPrimitive = Binary read x$1$9:TPrimitive >>> read $10:TPrimitive - return -} - -``` - ## Code ```javascript @@ -58,34 +27,6 @@ function f() { } ``` -## HIR - -``` -bb0: - [1] Const mutate $6:TPrimitive = 1 - [2] Const mutate $7:TPrimitive = Binary read a$5_@0.b.c + read $6:TPrimitive - [3] Reassign read a$5_@0.b.c[0:6] = read $7:TPrimitive - [4] Const mutate $8:TPrimitive = 2 - [5] Reassign mutate a$5_@0.b.c[0:6] = Binary read a$5_@0.b.c * read $8:TPrimitive - [6] Return -``` - -## Reactive Scopes - -``` -function g( - a, -) { - [1] Const mutate $6:TPrimitive = 1 - [2] Const mutate $7:TPrimitive = Binary read a$5_@0.b.c + read $6:TPrimitive - [3] Reassign read a$5_@0.b.c[0:6] = read $7:TPrimitive - [4] Const mutate $8:TPrimitive = 2 - [5] Reassign mutate a$5_@0.b.c[0:6] = Binary read a$5_@0.b.c * read $8:TPrimitive - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/call.expect.md b/compiler/forget/src/__tests__/fixtures/hir/call.expect.md index 829d041c0c..7875dd9fed 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/call.expect.md @@ -15,67 +15,12 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function foo( -) { - return -} - -``` - ## Code ```javascript function foo() {} ``` -## HIR - -``` -bb0: - [1] Const mutate a$10_@0[1:7] = Array [] - [2] Const mutate b$11_@0:TObject[1:7] = Object { } - [3] Call mutate foo$4:TFunction(mutate a$10_@0, mutate b$11_@0:TObject) - [4] Const mutate $12:TPrimitive = "div" - [5] Const mutate _$13_@1 = JSX - [6] Call mutate foo$4:TFunction(mutate b$11_@0:TObject) - [7] Const mutate $14:TPrimitive = "div" - [8] Const mutate t4$15_@2 = JSX - [9] Return read t4$15_@2 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - scope @0 [1:7] deps=[] out=[a$10_@0, b$11_@0] { - [1] Const mutate a$10_@0[1:7] = Array [] - [2] Const mutate b$11_@0:TObject[1:7] = Object { } - [3] Call mutate foo$4:TFunction(mutate a$10_@0, mutate b$11_@0:TObject) - [4] Const mutate $12:TPrimitive = "div" - [5] Const mutate _$13_@1 = JSX - [6] Call mutate foo$4:TFunction(mutate b$11_@0:TObject) - } - [7] Const mutate $14:TPrimitive = "div" - scope @2 [8:9] deps=[read a$10_@0, freeze b$11_@0:TObject] out=[$15_@2] { - [8] Const mutate $15_@2 = JSX - } - return read $15_@2 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/complex-while.expect.md b/compiler/forget/src/__tests__/fixtures/hir/complex-while.expect.md index ea2162539c..5eb07aca89 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/complex-while.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/complex-while.expect.md @@ -14,50 +14,6 @@ function foo(a, b, c) { ``` -## HIR - -``` -bb0: - [1] If (read a$4) then:bb3 else:bb1 fallthrough=bb1 -bb3: - predecessor blocks: bb0 - [2] While test=bb4 loop=bb6 fallthrough=bb1 -bb4: - predecessor blocks: bb3 bb7 - [3] If (read b$5) then:bb6 else:bb1 fallthrough=bb1 -bb6: - predecessor blocks: bb4 - [4] If (read c$6) then:bb1 else:bb7 fallthrough=bb7 -bb7: - predecessor blocks: bb6 - [5] Goto(Continue) bb4 -bb1: - predecessor blocks: bb6 bb4 bb0 - [6] Return -``` - -## Reactive Scopes - -``` -function foo( - a, - b, - c, -) { - if (read a$4) { - while ( - read b$5 - ) { - if (read c$6) { - break - } - } - } - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/component.expect.md b/compiler/forget/src/__tests__/fixtures/hir/component.expect.md index 3c7ffce948..f256b40321 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/component.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/component.expect.md @@ -31,146 +31,6 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Const mutate items$30 = read props$29.items - [2] Const mutate maxItems$31 = read props$29.maxItems - [3] Const mutate renderedItems$32_@0[3:33] = Array [] - [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$7.max(read $34:TPrimitive, read maxItems$31) - [7] For init=bb3 test=bb1 loop=bb5 update=bb4 fallthrough=bb2 -bb3: - predecessor blocks: bb0 - [8] Let mutate i$36_@0:TPrimitive[3:33] = 0 - [9] Goto bb1 -bb1: - predecessor blocks: bb3 bb4 - [10] Const mutate $39:TPrimitive = Binary read i$36_@0:TPrimitive < read items$30.length - [11] If (read $39:TPrimitive) then:bb5 else:bb2 fallthrough=bb2 -bb5: - predecessor blocks: bb1 - [12] Const mutate item$40_@0:TPrimitive[3:33] = Call read items$30.at(read i$36_@0:TPrimitive) - [13] Const mutate $41:TPrimitive = null - [14] Const mutate $42:TPrimitive = Binary read item$40_@0:TPrimitive == read $41:TPrimitive - [15] Let mutate $46_@0[3:33] = undefined - [15] If (read $42:TPrimitive) then:bb10 else:bb11 fallthrough=bb9 -bb10: - predecessor blocks: bb5 - [16] Const mutate $43:TPrimitive = read $42:TPrimitive - [17] Reassign mutate $46_@0[3:33] = read $43:TPrimitive - [17] Goto bb9 -bb11: - predecessor blocks: bb5 - [18] Const mutate $45_@0[3:33] = Call mutate seen$33_@0.has(mutate item$40_@0:TPrimitive) - [19] Reassign mutate $46_@0[3:33] = read $45_@0 - [19] Goto bb9 -bb9: - predecessor blocks: bb10 bb11 - [20] If (read $46_@0) then:bb7 else:bb6 fallthrough=bb6 -bb7: - predecessor blocks: bb9 - [21] Goto(Continue) bb4 -bb6: - predecessor blocks: bb9 - [22] Call mutate seen$33_@0.add(mutate item$40_@0:TPrimitive) - [23] Const mutate $49:TPrimitive = "div" - [24] Const mutate $50_@4 = JSX {freeze item$40_@0:TPrimitive} - [25] Call mutate renderedItems$32_@0.push(read $50_@4) - [26] Const mutate $55:TPrimitive = Binary read renderedItems$32_@0.length >= read max$35_@2:TPrimitive - [27] If (read $55:TPrimitive) then:bb2 else:bb12 fallthrough=bb12 -bb12: - predecessor blocks: bb6 - [28] Goto(Continue) bb4 -bb4: - predecessor blocks: bb7 bb12 - [29] Const mutate $56:TPrimitive = 1 - [30] Reassign mutate i$36_@0:TPrimitive[3:33] = Binary read i$36_@0:TPrimitive + read $56:TPrimitive - [31] read i$36_@0:TPrimitive - [32] Goto bb1 -bb2: - predecessor blocks: bb6 bb1 - [33] Const mutate count$66 = read renderedItems$32_@0.length - [34] Const mutate $67:TPrimitive = "div" - [35] Const mutate $68:TPrimitive = "\n " - [36] Const mutate $69:TPrimitive = "h1" - [37] Const mutate $70:TPrimitive = " Items" - [38] Const mutate t7$71_@5 = JSX {freeze count$66}{read $70:TPrimitive} - [39] Const mutate $72:TPrimitive = "\n " - [40] Const mutate $73:TPrimitive = "\n " - [41] Const mutate t10$74_@6 = JSX {read $68:TPrimitive}{read t7$71_@5}{read $72:TPrimitive}{freeze renderedItems$32_@0}{read $73:TPrimitive} - [42] Return read t10$74_@6 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - [1] Const mutate items$30 = read props$29.items - [2] Const mutate maxItems$31 = read props$29.maxItems - scope @0 [3:33] deps=[read maxItems$31, read items$30.length, read items$30] out=[renderedItems$32_@0] { - [3] Const mutate renderedItems$32_@0[3:33] = Array [] - [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] out=[max$35_@2] { - [6] Const mutate max$35_@2:TPrimitive = Call mutate Math$7.max(read $34:TPrimitive, read maxItems$31) - } - for ( - [8] Let mutate i$36_@0:TPrimitive[3:33] = 0 - ; - [10] Const mutate $39:TPrimitive = Binary read i$36_@0:TPrimitive < read items$30.length - read $39:TPrimitive - ; - [29] Const mutate $56:TPrimitive = 1 - [30] Reassign mutate i$36_@0:TPrimitive[3:33] = Binary read i$36_@0:TPrimitive + read $56:TPrimitive - read i$36_@0:TPrimitive - ) { - [12] Const mutate item$40_@0:TPrimitive[3:33] = Call read items$30.at(read i$36_@0:TPrimitive) - [13] Const mutate $41:TPrimitive = null - [14] Const mutate $42:TPrimitive = Binary read item$40_@0:TPrimitive == read $41:TPrimitive - [15] Let mutate $46_@0[3:33] = undefined - if (read $42:TPrimitive) { - [16] Const mutate $43:TPrimitive = read $42:TPrimitive - [17] Reassign mutate $46_@0[3:33] = read $43:TPrimitive - } else { - [18] Const mutate $45_@0[3:33] = Call mutate seen$33_@0.has(mutate item$40_@0:TPrimitive) - [19] Reassign mutate $46_@0[3:33] = read $45_@0 - } - if (read $46_@0) { - continue - } - [22] Call mutate seen$33_@0.add(mutate item$40_@0:TPrimitive) - [23] Const mutate $49:TPrimitive = "div" - [24] Const mutate $50_@4 = JSX {freeze item$40_@0:TPrimitive} - [25] Call mutate renderedItems$32_@0.push(read $50_@4) - [26] Const mutate $55:TPrimitive = Binary read renderedItems$32_@0.length >= read max$35_@2:TPrimitive - if (read $55:TPrimitive) { - break - } - } - } - [33] Const mutate count$66 = read renderedItems$32_@0.length - [34] Const mutate $67:TPrimitive = "div" - [35] Const mutate $68:TPrimitive = "\n " - [36] Const mutate $69:TPrimitive = "h1" - [37] Const mutate $70:TPrimitive = " Items" - scope @5 [38:39] deps=[freeze count$66] out=[$71_@5] { - [38] Const mutate $71_@5 = JSX {freeze count$66}{read $70:TPrimitive} - } - [39] Const mutate $72:TPrimitive = "\n " - [40] Const mutate $73:TPrimitive = "\n " - scope @6 [41:42] deps=[read $71_@5, freeze renderedItems$32_@0] out=[$74_@6] { - [41] Const mutate $74_@6 = JSX {read $68:TPrimitive}{read $71_@5}{read $72:TPrimitive}{freeze renderedItems$32_@0}{read $73:TPrimitive} - } - return read $74_@6 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md b/compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md index c6cbd8ea7d..bb3d9693ac 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md @@ -74,43 +74,6 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Const mutate a_DEBUG$5_@0[1:7] = Array [] - [2] Call mutate a_DEBUG$5_@0.push(read props$4.a) - [3] If (read props$4.b) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [4] Const mutate $6:TPrimitive = null - [5] Return read $6:TPrimitive -bb1: - predecessor blocks: bb0 - [6] Call mutate a_DEBUG$5_@0.push(read props$4.d) - [7] Return freeze a_DEBUG$5_@0 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - scope @0 [1:7] deps=[read props$4.a, read props$4.b, read props$4.d] out=[a_DEBUG$5_@0] { - [1] Const mutate a_DEBUG$5_@0[1:7] = Array [] - [2] Call mutate a_DEBUG$5_@0.push(read props$4.a) - if (read props$4.b) { - [4] Const mutate $6:TPrimitive = null - return read $6:TPrimitive - } - [6] Call mutate a_DEBUG$5_@0.push(read props$4.d) - } - return freeze a_DEBUG$5_@0 -} - -``` - ## Code ```javascript @@ -141,42 +104,6 @@ function Component(props) { } ``` -## HIR - -``` -bb0: - [1] Const mutate a$4_@0[1:7] = Array [] - [2] Call mutate a$4_@0.push(read props$3.a) - [3] If (read props$3.b) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [4] Call mutate a$4_@0.push(read props$3.c) - [5] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [6] Call mutate a$4_@0.push(read props$3.d) - [7] Return freeze a$4_@0 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - scope @0 [1:7] deps=[read props$3.a, read props$3.b, read props$3.c, read props$3.d] out=[a$4_@0] { - [1] Const mutate a$4_@0[1:7] = Array [] - [2] Call mutate a$4_@0.push(read props$3.a) - if (read props$3.b) { - [4] Call mutate a$4_@0.push(read props$3.c) - } - [6] Call mutate a$4_@0.push(read props$3.d) - } - return freeze a$4_@0 -} - -``` - ## Code ```javascript @@ -209,45 +136,6 @@ function Component(props) { } ``` -## HIR - -``` -bb0: - [1] Const mutate a$5_@0[1:8] = Array [] - [2] Call mutate a$5_@0.push(read props$4.a) - [3] If (read props$4.b) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [4] Call mutate a$5_@0.push(read props$4.c) - [5] Const mutate $6:TPrimitive = null - [6] Return read $6:TPrimitive -bb1: - predecessor blocks: bb0 - [7] Call mutate a$5_@0.push(read props$4.d) - [8] Return freeze a$5_@0 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - scope @0 [1:8] deps=[read props$4.a, read props$4.b, read props$4.c, read props$4.d] out=[a$5_@0] { - [1] Const mutate a$5_@0[1:8] = Array [] - [2] Call mutate a$5_@0.push(read props$4.a) - if (read props$4.b) { - [4] Call mutate a$5_@0.push(read props$4.c) - [5] Const mutate $6:TPrimitive = null - return read $6:TPrimitive - } - [7] Call mutate a$5_@0.push(read props$4.d) - } - return freeze a$5_@0 -} - -``` - ## Code ```javascript @@ -281,43 +169,6 @@ function Component(props) { } ``` -## HIR - -``` -bb0: - [1] Const mutate a$4_@0[1:7] = Array [] - [2] Call mutate a$4_@0.push(read props$3.a) - [3] If (read props$3.b) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [4] Call mutate a$4_@0.push(read props$3.c) - [5] Return freeze a$4_@0 -bb1: - predecessor blocks: bb0 - [6] Call mutate a$4_@0.push(read props$3.d) - [7] Return freeze a$4_@0 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - scope @0 [1:7] deps=[read props$3.a, read props$3.b, read props$3.c, read props$3.d] out=[a$4_@0] { - [1] Const mutate a$4_@0[1:7] = Array [] - [2] Call mutate a$4_@0.push(read props$3.a) - if (read props$3.b) { - [4] Call mutate a$4_@0.push(read props$3.c) - return freeze a$4_@0 - } - [6] Call mutate a$4_@0.push(read props$3.d) - } - return freeze a$4_@0 -} - -``` - ## Code ```javascript @@ -351,40 +202,6 @@ function Component(props) { } ``` -## HIR - -``` -bb0: - [1] Const mutate a$4_@0[1:7] = Array [] - [2] Call mutate a$4_@0.push(read props$3.a) - [3] If (read props$3.b) then:bb1 else:bb2 fallthrough=bb2 -bb2: - predecessor blocks: bb0 - [4] Call mutate a$4_@0.push(read props$3.c) - [5] Goto bb1 -bb1: - predecessor blocks: bb0 bb2 - [6] Call mutate a$4_@0.push(read props$3.d) - [7] Return freeze a$4_@0 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - [1] Const mutate a$4_@0[1:7] = Array [] - [2] Call mutate a$4_@0.push(read props$3.a) - if (read props$3.b) { - [6] Call mutate a$4_@0.push(read props$3.d) - return freeze a$4_@0 - } - [4] Call mutate a$4_@0.push(read props$3.c) -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md b/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md index 7762fd9d94..bc9eacd80e 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md @@ -31,54 +31,6 @@ function mayMutate() {} ``` -## HIR - -``` -bb0: - [1] Const mutate a$7_@0[1:9] = Array [] - [2] Const mutate b$8_@0[1:9] = Array [] - [3] If (read b$8_@0) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [4] Call mutate a$7_@0.push(read props$6.p0) - [5] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [6] If (read props$6.p1) then:bb4 else:bb3 fallthrough=bb3 -bb4: - predecessor blocks: bb1 - [7] Call mutate b$8_@0.push(read props$6.p2) - [8] Goto bb3 -bb3: - predecessor blocks: bb4 bb1 - [9] Const mutate t6$16_@2 = JSX - [10] Return read t6$16_@2 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - scope @0 [1:9] deps=[read props$6.p0, read props$6.p1, read props$6.p2] out=[a$7_@0] { - [1] Const mutate a$7_@0[1:9] = Array [] - [2] Const mutate b$8_@0[1:9] = Array [] - if (read b$8_@0) { - [4] Call mutate a$7_@0.push(read props$6.p0) - } - if (read props$6.p1) { - [7] Call mutate b$8_@0.push(read props$6.p2) - } - } - scope @2 [9:10] deps=[freeze a$7_@0, freeze b$8_@0] out=[$16_@2] { - [9] Const mutate $16_@2 = JSX - } - return read $16_@2 -} - -``` - ## Code ```javascript @@ -125,56 +77,6 @@ function Component(props) { } ``` -## HIR - -``` -bb0: - [1] Const mutate a$9_@0[1:10] = Array [] - [2] Const mutate b$10_@0[1:10] = Array [] - [3] Const mutate $11_@0[1:10] = Call mutate mayMutate$4:TFunction(mutate b$10_@0) - [4] If (read $11_@0) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [5] Call mutate a$9_@0.push(read props$8.p0) - [6] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [7] If (read props$8.p1) then:bb4 else:bb3 fallthrough=bb3 -bb4: - predecessor blocks: bb1 - [8] Call mutate b$10_@0.push(read props$8.p2) - [9] Goto bb3 -bb3: - predecessor blocks: bb4 bb1 - [10] Const mutate t6$19_@2 = JSX - [11] Return read t6$19_@2 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - scope @0 [1:10] deps=[read props$8.p0, read props$8.p1, read props$8.p2] out=[a$9_@0] { - [1] Const mutate a$9_@0[1:10] = Array [] - [2] Const mutate b$10_@0[1:10] = Array [] - [3] Const mutate $11_@0[1:10] = Call mutate mayMutate$4:TFunction(mutate b$10_@0) - if (read $11_@0) { - [5] Call mutate a$9_@0.push(read props$8.p0) - } - if (read props$8.p1) { - [8] Call mutate b$10_@0.push(read props$8.p2) - } - } - scope @2 [10:11] deps=[freeze a$9_@0, freeze b$10_@0] out=[$19_@2] { - [10] Const mutate $19_@2 = JSX - } - return read $19_@2 -} - -``` - ## Code ```javascript @@ -221,46 +123,12 @@ function Component(props) { } ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function Foo( -) { - return -} - -``` - ## Code ```javascript function Foo() {} ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function mayMutate( -) { - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md b/compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md index e15a4a369a..88aee2fd22 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md @@ -15,67 +15,12 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function Foo( -) { - return -} - -``` - ## Code ```javascript function Foo() {} ``` -## HIR - -``` -bb0: - [1] Const mutate a$10_@0[1:7] = Array [] - [2] Const mutate b$11_@0:TObject[1:7] = Object { } - [3] New mutate Foo$4(mutate a$10_@0, mutate b$11_@0:TObject) - [4] Const mutate $12:TPrimitive = "div" - [5] Const mutate _$13_@1 = JSX - [6] New mutate Foo$4(mutate b$11_@0:TObject) - [7] Const mutate $14:TPrimitive = "div" - [8] Const mutate t4$15_@2 = JSX - [9] Return read t4$15_@2 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - scope @0 [1:7] deps=[] out=[a$10_@0, b$11_@0] { - [1] Const mutate a$10_@0[1:7] = Array [] - [2] Const mutate b$11_@0:TObject[1:7] = Object { } - [3] New mutate Foo$4(mutate a$10_@0, mutate b$11_@0:TObject) - [4] Const mutate $12:TPrimitive = "div" - [5] Const mutate _$13_@1 = JSX - [6] New mutate Foo$4(mutate b$11_@0:TObject) - } - [7] Const mutate $14:TPrimitive = "div" - scope @2 [8:9] deps=[read a$10_@0, freeze b$11_@0:TObject] out=[$15_@2] { - [8] Const mutate $15_@2 = JSX - } - return read $15_@2 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/dependencies-outputs.expect.md b/compiler/forget/src/__tests__/fixtures/hir/dependencies-outputs.expect.md index 39dc5b9e48..437c6b09d7 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/dependencies-outputs.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/dependencies-outputs.expect.md @@ -18,57 +18,6 @@ function foo(a, b) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$8_@0[1:3] = Array [] - [2] Call mutate x$8_@0.push(read a$6) - [3] Const mutate $9:TPrimitive = "div" - [4] JSX {freeze x$8_@0} - [5] Const mutate y$10_@1[5:12] = Array [] - [6] If (read x$8_@0.length) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [7] Call mutate y$10_@1.push(read x$8_@0) - [8] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [9] If (read b$7) then:bb4 else:bb3 fallthrough=bb3 -bb4: - predecessor blocks: bb1 - [10] Call mutate y$10_@1.push(read b$7) - [11] Goto bb3 -bb3: - predecessor blocks: bb4 bb1 - [12] Return -``` - -## Reactive Scopes - -``` -function foo( - a, - b, -) { - scope @0 [1:3] deps=[read a$6] out=[x$8_@0] { - [1] Const mutate x$8_@0[1:3] = Array [] - [2] Call mutate x$8_@0.push(read a$6) - } - [3] Const mutate $9:TPrimitive = "div" - [4] JSX {freeze x$8_@0} - [5] Const mutate y$10_@1[5:12] = Array [] - if (read x$8_@0.length) { - [7] Call mutate y$10_@1.push(read x$8_@0) - } - if (read b$7) { - [10] Call mutate y$10_@1.push(read b$7) - } - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/dependencies.expect.md b/compiler/forget/src/__tests__/fixtures/hir/dependencies.expect.md index 72c5198e5c..80cc7fb571 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/dependencies.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/dependencies.expect.md @@ -20,54 +20,6 @@ function foo(x, y, z) { ``` -## HIR - -``` -bb0: - [1] Const mutate items$9_@0[1:10] = Array [read z$8] - [2] Call mutate items$9_@0.push(read x$6) - [3] Const mutate items2$10_@1[3:7] = Array [] - [4] If (read x$6) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [5] Call mutate items2$10_@1.push(read y$7) - [6] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [7] If (read y$7) then:bb4 else:bb3 fallthrough=bb3 -bb4: - predecessor blocks: bb1 - [8] Call mutate items$9_@0.push(read x$6) - [9] Goto bb3 -bb3: - predecessor blocks: bb4 bb1 - [10] Return freeze items2$10_@1 -``` - -## Reactive Scopes - -``` -function foo( - x, - y, - z, -) { - [1] Const mutate items$9_@0[1:10] = Array [read z$8] - [2] Call mutate items$9_@0.push(read x$6) - scope @1 [3:7] deps=[read x$6, read y$7] out=[items2$10_@1] { - [3] Const mutate items2$10_@1[3:7] = Array [] - if (read x$6) { - [5] Call mutate items2$10_@1.push(read y$7) - } - } - if (read y$7) { - [8] Call mutate items$9_@0.push(read x$6) - } - return freeze items2$10_@1 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/extend-scopes-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/extend-scopes-if.expect.md index c38ef51abe..78e8d64821 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/extend-scopes-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/extend-scopes-if.expect.md @@ -19,61 +19,6 @@ function foo(a, b, c) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$10_@0[1:8] = Array [] - [2] If (read a$7) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [3] If (read b$8) then:bb4 else:bb1 fallthrough=bb1 -bb4: - predecessor blocks: bb2 - [4] If (read c$9) then:bb6 else:bb1 fallthrough=bb1 -bb6: - predecessor blocks: bb4 - [5] Const mutate $11:TPrimitive = 0 - [6] Call mutate x$10_@0.push(read $11:TPrimitive) - [7] Goto bb1 -bb1: - predecessor blocks: bb6 bb4 bb2 bb0 - [8] If (read a$7.length) then:bb8 else:bb7 fallthrough=bb7 -bb8: - predecessor blocks: bb1 - [9] Return read a$7 -bb7: - predecessor blocks: bb1 - [10] Const mutate $13:TPrimitive = null - [11] Return read $13:TPrimitive -``` - -## Reactive Scopes - -``` -function foo( - a, - b, - c, -) { - [1] Const mutate x$10_@0[1:8] = Array [] - if (read a$7) { - if (read b$8) { - if (read c$9) { - [5] Const mutate $11:TPrimitive = 0 - [6] Call mutate x$10_@0.push(read $11:TPrimitive) - } - } - } - if (read a$7.length) { - return read a$7 - } - [10] Const mutate $13:TPrimitive = null - return read $13:TPrimitive -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md b/compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md index 55e112ab7f..e147a25e98 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md @@ -14,33 +14,6 @@ function foo(x) {} ``` -## HIR - -``` -bb0: - [1] Const mutate a$5_@0 = Array [] - [2] Const mutate b$6 = read a$5_@0 - [3] Call read useFreeze$3:TFunction(freeze a$5_@0) - [4] Call mutate foo$4:TFunction(read b$6) - [5] Return -``` - -## Reactive Scopes - -``` -function Component( -) { - scope @0 [1:2] deps=[] out=[a$5_@0] { - [1] Const mutate a$5_@0 = Array [] - } - [2] Const mutate b$6 = read a$5_@0 - [3] Call read useFreeze$3:TFunction(freeze a$5_@0) - [4] Call mutate foo$4:TFunction(read b$6) - return -} - -``` - ## Code ```javascript @@ -60,47 +33,12 @@ function Component() { } ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function useFreeze( -) { - return -} - -``` - ## Code ```javascript function useFreeze() {} ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function foo( - x, -) { - return -} - -``` - ## Code ```javascript 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 095ccfdf63..9f773630bc 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md @@ -19,90 +19,18 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function useFreeze( -) { - return -} - -``` - ## Code ```javascript function useFreeze() {} ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function foo( -) { - return -} - -``` - ## Code ```javascript function foo() {} ``` -## HIR - -``` -bb0: - [1] Const mutate x$11_@0 = Array [] - [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:TPrimitive = "\n " - [5] Const mutate $14:TPrimitive = "\n " - [6] Const mutate $15:TPrimitive = "\n " - [7] Const mutate t5$16_@2 = JSX {read $13:TPrimitive}{read x$11_@0}{read $14:TPrimitive}{read y$12_@1}{read $15:TPrimitive} - [8] Return read t5$16_@2 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - scope @0 [1:2] deps=[] out=[x$11_@0] { - [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$3:TFunction(freeze x$11_@0) - } - [3] Call mutate foo$5:TFunction(read y$12_@1, read x$11_@0) - [4] Const mutate $13:TPrimitive = "\n " - [5] Const mutate $14:TPrimitive = "\n " - [6] Const mutate $15:TPrimitive = "\n " - scope @2 [7:8] deps=[read x$11_@0, read y$12_@1] out=[$16_@2] { - [7] Const mutate $16_@2 = JSX {read $13:TPrimitive}{read x$11_@0}{read $14:TPrimitive}{read y$12_@1}{read $15:TPrimitive} - } - return read $16_@2 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md b/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md index 6965ec423d..651745652e 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md @@ -15,33 +15,6 @@ function call(x) {} ``` -## HIR - -``` -bb0: - [1] Const mutate a$4_@0 = Array [] - [2] Call read useFreeze$2:TFunction(freeze a$4_@0) - [3] Call read useFreeze$2:TFunction(read a$4_@0) - [4] Call mutate call$3:TFunction(read a$4_@0) - [5] Return read a$4_@0 -``` - -## Reactive Scopes - -``` -function Component( -) { - scope @0 [1:2] deps=[] out=[a$4_@0] { - [1] Const mutate a$4_@0 = Array [] - } - [2] Call read useFreeze$2:TFunction(freeze a$4_@0) - [3] Call read useFreeze$2:TFunction(read a$4_@0) - [4] Call mutate call$3:TFunction(read a$4_@0) - return read a$4_@0 -} - -``` - ## Code ```javascript @@ -62,48 +35,12 @@ function Component() { } ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function useFreeze( - x, -) { - return -} - -``` - ## Code ```javascript function useFreeze(x) {} ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function call( - x, -) { - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md b/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md index 5acaf748ef..650f508f2c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md @@ -22,62 +22,6 @@ function call(x) {} ``` -## HIR - -``` -bb0: - [1] Const mutate cond$8 = read props$7.cond - [2] Const mutate x$9 = read props$7.x - [3] Const mutate a$10:TPrimitive = undefined - [4] Let mutate a$0$14_@0[4:9] = undefined - [4] If (read cond$8) then:bb2 else:bb3 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [5] Const mutate a$1$11 = read x$9 - [6] Reassign mutate a$0$14_@0[4:9] = read a$1$11 - [6] Goto bb1 -bb3: - predecessor blocks: bb0 - [7] Const mutate a$2$12_@1 = Array [] - [8] Reassign mutate a$0$14_@0[4:9] = read a$2$12_@1 - [8] Goto bb1 -bb1: - predecessor blocks: bb2 bb3 - [9] Call read useFreeze$5:TFunction(freeze a$0$14_@0) - [10] Call read useFreeze$5:TFunction(read a$0$14_@0) - [11] Call mutate call$6:TFunction(read a$0$14_@0) - [12] Return read a$0$14_@0 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - [1] Const mutate cond$8 = read props$7.cond - [2] Const mutate x$9 = read props$7.x - [3] Const mutate a$10:TPrimitive = undefined - scope @0 [4:9] deps=[read cond$8, read x$9] out=[a$0$14_@0] { - [4] Let mutate a$0$14_@0[4:9] = undefined - if (read cond$8) { - [5] Const mutate a$1$11 = read x$9 - [6] Reassign mutate a$0$14_@0[4:9] = read a$1$11 - } else { - scope @1 [7:8] deps=[] out=[a$2$12_@1] { - [7] Const mutate a$2$12_@1 = Array [] - } - [8] Reassign mutate a$0$14_@0[4:9] = read a$2$12_@1 - } - } - [9] Call read useFreeze$5:TFunction(freeze a$0$14_@0) - [10] Call read useFreeze$5:TFunction(read a$0$14_@0) - [11] Call mutate call$6:TFunction(read a$0$14_@0) - return read a$0$14_@0 -} - -``` - ## Code ```javascript @@ -122,48 +66,12 @@ function Component(props) { } ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function useFreeze( - x, -) { - return -} - -``` - ## Code ```javascript function useFreeze(x) {} ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function call( - x, -) { - return -} - -``` - ## Code ```javascript 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 5a9f3abe0b..dbff0a93aa 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 @@ -33,138 +33,30 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function compute( -) { - return -} - -``` - ## Code ```javascript function compute() {} ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function mutate( -) { - return -} - -``` - ## Code ```javascript function mutate() {} ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function foo( -) { - return -} - -``` - ## Code ```javascript function foo() {} ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function Foo( -) { - return -} - -``` - ## Code ```javascript function Foo() {} ``` -## HIR - -``` -bb0: - [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 - [4] Call mutate mutate$5:TFunction(mutate a$9_@1) - [5] Call mutate mutate$5:TFunction(mutate b$10_@1) - [6] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [7] Const mutate t6$14_@2 = JSX - [8] Return read t6$14_@2 -``` - -## Reactive Scopes - -``` -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$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) - } - } - scope @2 [7:8] deps=[freeze a$9_@1, freeze b$10_@1] out=[$14_@2] { - [7] Const mutate $14_@2 = JSX - } - return read $14_@2 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md b/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md index 79d2c04984..91341ae450 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md @@ -24,36 +24,6 @@ function Foo() {} ``` -## HIR - -``` -bb0: - [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 -``` - -## Reactive Scopes - -``` -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$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$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 - } - return read $10_@2 -} - -``` - ## Code ```javascript @@ -97,69 +67,18 @@ function Component(props) { } ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function compute( -) { - return -} - -``` - ## Code ```javascript function compute() {} ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function foo( -) { - return -} - -``` - ## Code ```javascript function foo() {} ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function Foo( -) { - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/independently-memoize-object-property.expect.md b/compiler/forget/src/__tests__/fixtures/hir/independently-memoize-object-property.expect.md index 8fbf3c8d5d..dd957db470 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/independently-memoize-object-property.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/independently-memoize-object-property.expect.md @@ -12,36 +12,6 @@ function foo(a, b, c) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$9_@0:TObject[1:4] = Object { a: read a$6 } - [2] Const mutate t6$10_@1 = Array [read b$7, read c$8] - [3] Reassign store x$9_@0.y[1:4] = read t6$10_@1 - [4] Return freeze x$9_@0:TObject -``` - -## Reactive Scopes - -``` -function foo( - a, - b, - c, -) { - scope @0 [1:4] deps=[read a$6, read b$7, read c$8] out=[x$9_@0] { - [1] Const mutate x$9_@0:TObject[1:4] = Object { a: read a$6 } - scope @1 [2:3] deps=[read b$7, read c$8] out=[$10_@1] { - [2] Const mutate $10_@1 = Array [read b$7, read c$8] - } - [3] Reassign store x$9_@0.y[1:4] = read $10_@1 - } - return freeze x$9_@0:TObject -} - -``` - ## Code ```javascript 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 e88775a717..45817e4551 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 @@ -27,113 +27,24 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function compute( -) { - return -} - -``` - ## Code ```javascript function compute() {} ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function foo( -) { - return -} - -``` - ## Code ```javascript function foo() {} ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function Foo( -) { - return -} - -``` - ## Code ```javascript function Foo() {} ``` -## HIR - -``` -bb0: - [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 - [4] Call mutate foo$5:TFunction(mutate a$9_@0, mutate b$10_@0) - [5] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [6] Const mutate t7$14_@1 = JSX - [7] Return read t7$14_@1 -``` - -## Reactive Scopes - -``` -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$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) - } - } - scope @1 [6:7] deps=[freeze a$9_@0, freeze b$10_@0] out=[$14_@1] { - [6] Const mutate $14_@1 = JSX - } - return read $14_@1 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md b/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md index 1fb0c418f9..2791b5dca5 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md @@ -24,36 +24,6 @@ function Foo() {} ``` -## HIR - -``` -bb0: - [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 -``` - -## Reactive Scopes - -``` -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$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] { - [4] Const mutate $11_@1 = JSX - } - return read $11_@1 -} - -``` - ## Code ```javascript @@ -93,69 +63,18 @@ function Component(props) { } ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function compute( -) { - return -} - -``` - ## Code ```javascript function compute() {} ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function foo( -) { - return -} - -``` - ## Code ```javascript function foo() {} ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function Foo( -) { - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md index 028b9b0be3..3c2d2c06fa 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md @@ -14,43 +14,6 @@ function foo(a, b, c) { ``` -## HIR - -``` -bb0: - [1] Const mutate y$8_@0[1:6] = Array [] - [2] If (read a$5) then:bb3 else:bb1 fallthrough=bb1 -bb3: - predecessor blocks: bb0 - [3] If (read b$6) then:bb5 else:bb1 fallthrough=bb1 -bb5: - predecessor blocks: bb3 - [4] Call mutate y$8_@0.push(read c$7) - [5] Goto bb1 -bb1: - predecessor blocks: bb5 bb3 bb0 - [6] Return -``` - -## Reactive Scopes - -``` -function foo( - a, - b, - c, -) { - [1] Const mutate y$8_@0[1:6] = Array [] - if (read a$5) { - if (read b$6) { - [4] Call mutate y$8_@0.push(read c$7) - } - } - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/issue852.expect.md b/compiler/forget/src/__tests__/fixtures/hir/issue852.expect.md index 3fc9d52004..3e78fbddfa 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/issue852.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/issue852.expect.md @@ -11,34 +11,6 @@ function Component(c) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$7_@0:TObject[1:3] = Object { c: read c$6 } - [2] Call mutate mutate$3:TFunction(mutate x$7_@0:TObject) - [3] Const mutate a$8:TObject = read x$7_@0:TObject - [4] Const mutate b$9:TObject = read a$8:TObject - [5] Return -``` - -## Reactive Scopes - -``` -function Component( - c, -) { - scope @0 [1:3] deps=[read c$6] out=[x$7_@0] { - [1] Const mutate x$7_@0:TObject[1:3] = Object { c: read c$6 } - [2] Call mutate mutate$3:TFunction(mutate x$7_@0:TObject) - } - [3] Const mutate a$8:TObject = read x$7_@0:TObject - [4] Const mutate b$9:TObject = read a$8:TObject - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/jsx-fragment.expect.md b/compiler/forget/src/__tests__/fixtures/hir/jsx-fragment.expect.md index 960209fbd4..6b67ad9c65 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/jsx-fragment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/jsx-fragment.expect.md @@ -15,52 +15,6 @@ function Foo(props) { ``` -## HIR - -``` -bb0: - [1] Const mutate $14:TPrimitive = "\n Hello " - [2] Const mutate $15:TPrimitive = " " - [3] Const mutate $16:TPrimitive = "\n " - [4] Const mutate $17:TPrimitive = "div" - [5] Const mutate $18:TPrimitive = "\n " - [6] Const mutate $19:TPrimitive = "Text" - [7] Const mutate t0$20_@0 = JsxFragment [read $19:TPrimitive] - [8] Const mutate $21:TPrimitive = "\n " - [9] Const mutate t2$22_@1 = JSX {read $18:TPrimitive}{read t0$20_@0}{read $21:TPrimitive} - [10] Const mutate $23:TPrimitive = "\n " - [11] Const mutate t5$24_@2 = JsxFragment [read $14:TPrimitive, read props$13.greeting, read $15:TPrimitive, read $16:TPrimitive, read t2$22_@1, read $23:TPrimitive] - [12] Return read t5$24_@2 -``` - -## Reactive Scopes - -``` -function Foo( - props, -) { - [1] Const mutate $14:TPrimitive = "\n Hello " - [2] Const mutate $15:TPrimitive = " " - [3] Const mutate $16:TPrimitive = "\n " - [4] Const mutate $17:TPrimitive = "div" - [5] Const mutate $18:TPrimitive = "\n " - [6] Const mutate $19:TPrimitive = "Text" - scope @0 [7:8] deps=[] out=[$20_@0] { - [7] Const mutate $20_@0 = JsxFragment [read $19:TPrimitive] - } - [8] Const mutate $21:TPrimitive = "\n " - scope @1 [9:10] deps=[read $20_@0] out=[$22_@1] { - [9] Const mutate $22_@1 = JSX {read $18:TPrimitive}{read $20_@0}{read $21:TPrimitive} - } - [10] Const mutate $23:TPrimitive = "\n " - scope @2 [11:12] deps=[read props$13.greeting, read $22_@1] out=[$24_@2] { - [11] Const mutate $24_@2 = JsxFragment [read $14:TPrimitive, read props$13.greeting, read $15:TPrimitive, read $16:TPrimitive, read $22_@1, read $23:TPrimitive] - } - return read $24_@2 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md b/compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md index d8cc5cf75d..5399b2e5c1 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md @@ -19,53 +19,6 @@ function g() {} ``` -## HIR - -``` -bb0: - [1] Const mutate t0$5_@0 = Call mutate f$1:TFunction() - [2] Let mutate t2$8_@1[2:7] = undefined - [2] If (read t0$5_@0) then:bb2 else:bb3 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [3] Const mutate t3$6_@2 = Call mutate g$4:TFunction() - [4] Reassign mutate t2$8_@1[2:7] = read t3$6_@2 - [4] Goto bb1 -bb3: - predecessor blocks: bb0 - [5] Const mutate $7 = read t0$5_@0 - [6] Reassign mutate t2$8_@1[2:7] = read $7 - [6] Goto bb1 -bb1: - predecessor blocks: bb2 bb3 - [7] Return freeze t2$8_@1 -``` - -## Reactive Scopes - -``` -function And( -) { - scope @0 [1:2] deps=[] out=[$5_@0] { - [1] Const mutate $5_@0 = Call mutate f$1:TFunction() - } - scope @1 [2:7] deps=[read $5_@0] out=[$8_@1] { - [2] Let mutate $8_@1[2:7] = undefined - if (read $5_@0) { - scope @2 [3:4] deps=[] out=[$6_@2] { - [3] Const mutate $6_@2 = Call mutate g$4:TFunction() - } - [4] Reassign mutate $8_@1[2:7] = read $6_@2 - } else { - [5] Const mutate $7 = read $5_@0 - [6] Reassign mutate $8_@1[2:7] = read $7 - } - } - return freeze $8_@1 -} - -``` - ## Code ```javascript @@ -110,53 +63,6 @@ function And() { } ``` -## HIR - -``` -bb0: - [1] Const mutate t0$5_@0 = Call mutate f$1:TFunction() - [2] Let mutate t2$8_@1[2:7] = undefined - [2] If (read t0$5_@0) then:bb2 else:bb3 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [3] Const mutate $6 = read t0$5_@0 - [4] Reassign mutate t2$8_@1[2:7] = read $6 - [4] Goto bb1 -bb3: - predecessor blocks: bb0 - [5] Const mutate t3$7_@2 = Call mutate g$4:TFunction() - [6] Reassign mutate t2$8_@1[2:7] = read t3$7_@2 - [6] Goto bb1 -bb1: - predecessor blocks: bb2 bb3 - [7] Return freeze t2$8_@1 -``` - -## Reactive Scopes - -``` -function Or( -) { - scope @0 [1:2] deps=[] out=[$5_@0] { - [1] Const mutate $5_@0 = Call mutate f$1:TFunction() - } - scope @1 [2:7] deps=[read $5_@0] out=[$8_@1] { - [2] Let mutate $8_@1[2:7] = undefined - if (read $5_@0) { - [3] Const mutate $6 = read $5_@0 - [4] Reassign mutate $8_@1[2:7] = read $6 - } else { - scope @2 [5:6] deps=[] out=[$7_@2] { - [5] Const mutate $7_@2 = Call mutate g$4:TFunction() - } - [6] Reassign mutate $8_@1[2:7] = read $7_@2 - } - } - return freeze $8_@1 -} - -``` - ## Code ```javascript @@ -201,58 +107,6 @@ function Or() { } ``` -## HIR - -``` -bb0: - [1] Const mutate t0$9_@0:TPrimitive = Call mutate f$2:TFunction() - [2] Const mutate $10:TPrimitive = null - [3] Const mutate $11:TPrimitive = Binary read t0$9_@0:TPrimitive != read $10:TPrimitive - [4] Let mutate t2$14_@1[4:9] = undefined - [4] If (read $11:TPrimitive) then:bb2 else:bb3 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [5] Const mutate $12:TPrimitive = read t0$9_@0:TPrimitive - [6] Reassign mutate t2$14_@1[4:9] = read $12:TPrimitive - [6] Goto bb1 -bb3: - predecessor blocks: bb0 - [7] Const mutate t3$13_@2 = Call mutate g$7:TFunction() - [8] Reassign mutate t2$14_@1[4:9] = read t3$13_@2 - [8] Goto bb1 -bb1: - predecessor blocks: bb2 bb3 - [9] Return freeze t2$14_@1 -``` - -## Reactive Scopes - -``` -function QuestionQuestion( - props, -) { - scope @0 [1:2] deps=[] out=[$9_@0] { - [1] Const mutate $9_@0:TPrimitive = Call mutate f$2:TFunction() - } - [2] Const mutate $10:TPrimitive = null - [3] Const mutate $11:TPrimitive = Binary read $9_@0:TPrimitive != read $10:TPrimitive - scope @1 [4:9] deps=[read $9_@0:TPrimitive] out=[$14_@1] { - [4] Let mutate $14_@1[4:9] = undefined - if (read $11:TPrimitive) { - [5] Const mutate $12:TPrimitive = read $9_@0:TPrimitive - [6] Reassign mutate $14_@1[4:9] = read $12:TPrimitive - } else { - scope @2 [7:8] deps=[] out=[$13_@2] { - [7] Const mutate $13_@2 = Call mutate g$7:TFunction() - } - [8] Reassign mutate $14_@1[4:9] = read $13_@2 - } - } - return freeze $14_@1 -} - -``` - ## Code ```javascript @@ -297,46 +151,12 @@ function QuestionQuestion(props) { } ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function f( -) { - return -} - -``` - ## Code ```javascript function f() {} ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function g( -) { - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md index 0b815fd0fa..6103ab43b7 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md @@ -39,156 +39,18 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function mutate( - x, - y, -) { - return -} - -``` - ## Code ```javascript function mutate(x, y) {} ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function cond( - x, -) { - return -} - -``` - ## Code ```javascript function cond(x) {} ``` -## HIR - -``` -bb0: - [1] Let mutate a$13_@0:TObject[1:23] = Object { } - [2] Let mutate b$14_@0:TObject[1:23] = Object { } - [3] Let mutate c$15_@0:TObject[1:23] = Object { } - [4] Let mutate d$16_@0:TObject[1:23] = Object { } - [5] Let mutate a$0$30_@0[1:23] = read a$13_@0:TObject - [5] Let mutate b$1$31_@0[1:23] = read b$14_@0:TObject - [5] Let mutate c$2$32_@0[1:23] = read c$15_@0:TObject - [5] Let mutate d$3$33_@0[1:23] = read d$16_@0:TObject - [5] While test=bb1 loop=bb3 fallthrough=bb2 -bb1: - predecessor blocks: bb0 bb4 - [6] Const mutate $17:TPrimitive = true - [7] If (read $17:TPrimitive) then:bb3 else:bb2 fallthrough=bb2 -bb3: - predecessor blocks: bb1 - [8] Const mutate z$19_@0[1:23] = read a$13_@0:TObject - [9] Reassign mutate a$13_@0:TObject[1:23] = read b$14_@0:TObject - [10] Reassign mutate b$14_@0:TObject[1:23] = read c$15_@0:TObject - [11] Reassign mutate c$15_@0:TObject[1:23] = read d$16_@0:TObject - [12] Reassign mutate d$16_@0:TObject[1:23] = read z$19_@0 - [13] Call mutate mutate$7:TFunction(mutate a$13_@0:TObject, mutate b$14_@0:TObject) - [14] Const mutate $29_@0[1:23] = Call mutate cond$8:TFunction(mutate a$13_@0:TObject) - [15] Reassign mutate a$0$30_@0[1:23] = read a$13_@0:TObject - [15] Reassign mutate b$1$31_@0[1:23] = read b$14_@0:TObject - [15] Reassign mutate c$2$32_@0[1:23] = read c$15_@0:TObject - [15] Reassign mutate d$3$33_@0[1:23] = read d$16_@0:TObject - [15] If (read $29_@0) then:bb2 else:bb4 fallthrough=bb4 -bb4: - predecessor blocks: bb3 - [16] Goto(Continue) bb1 -bb2: - predecessor blocks: bb3 bb1 - [17] If (read a$0$30_@0) then:bb7 else:bb7 fallthrough=bb7 -bb7: - predecessor blocks: bb2 - [18] If (read b$1$31_@0) then:bb9 else:bb9 fallthrough=bb9 -bb9: - predecessor blocks: bb7 - [19] If (read c$2$32_@0) then:bb11 else:bb11 fallthrough=bb11 -bb11: - predecessor blocks: bb9 - [20] If (read d$3$33_@0) then:bb13 else:bb13 fallthrough=bb13 -bb13: - predecessor blocks: bb11 - [21] Const mutate $34:TPrimitive = null - [22] Call mutate mutate$7:TFunction(mutate d$3$33_@0, read $34:TPrimitive) - [23] Return -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - [1] Let mutate a$13_@0:TObject[1:23] = Object { } - [2] Let mutate b$14_@0:TObject[1:23] = Object { } - [3] Let mutate c$15_@0:TObject[1:23] = Object { } - [4] Let mutate d$16_@0:TObject[1:23] = Object { } - [5] Let mutate a$0$30_@0[1:23] = read a$13_@0:TObject - [5] Let mutate b$1$31_@0[1:23] = read b$14_@0:TObject - [5] Let mutate c$2$32_@0[1:23] = read c$15_@0:TObject - [5] Let mutate d$3$33_@0[1:23] = read d$16_@0:TObject - while ( - [6] Const mutate $17:TPrimitive = true - read $17:TPrimitive - ) { - [8] Const mutate z$19_@0[1:23] = read a$13_@0:TObject - [9] Reassign mutate a$13_@0:TObject[1:23] = read b$14_@0:TObject - [10] Reassign mutate b$14_@0:TObject[1:23] = read c$15_@0:TObject - [11] Reassign mutate c$15_@0:TObject[1:23] = read d$16_@0:TObject - [12] Reassign mutate d$16_@0:TObject[1:23] = read z$19_@0 - [13] Call mutate mutate$7:TFunction(mutate a$13_@0:TObject, mutate b$14_@0:TObject) - [14] Const mutate $29_@0[1:23] = Call mutate cond$8:TFunction(mutate a$13_@0:TObject) - [15] Reassign mutate a$0$30_@0[1:23] = read a$13_@0:TObject - [15] Reassign mutate b$1$31_@0[1:23] = read b$14_@0:TObject - [15] Reassign mutate c$2$32_@0[1:23] = read c$15_@0:TObject - [15] Reassign mutate d$3$33_@0[1:23] = read d$16_@0:TObject - if (read $29_@0) { - break - } - } - if (read a$0$30_@0) { - } - if (read b$1$31_@0) { - } - if (read c$2$32_@0) { - } - if (read d$3$33_@0) { - } - [21] Const mutate $34:TPrimitive = null - [22] Call mutate mutate$7:TFunction(mutate d$3$33_@0, read $34:TPrimitive) - return -} - -``` - ## Code ```javascript 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 965d1fe686..0c4269ebbf 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 @@ -35,96 +35,12 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function mutate( - x, - y, -) { - return -} - -``` - ## Code ```javascript function mutate(x, y) {} ``` -## HIR - -``` -bb0: - [1] Const mutate a$11_@0:TObject = Object { } - [2] Const mutate b$12_@1[2:15] = Array [read a$11_@0:TObject] - [3] Const mutate c$13_@2:TObject = Object { } - [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$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 - [9] If (read b$12_@1) then:bb3 else:bb3 fallthrough=bb3 -bb3: - predecessor blocks: bb1 - [10] If (read c$13_@2:TObject) then:bb5 else:bb5 fallthrough=bb5 -bb5: - predecessor blocks: bb3 - [11] If (read d$14_@1:TObject) then:bb7 else:bb7 fallthrough=bb7 -bb7: - predecessor blocks: bb5 - [12] If (read y$16_@1) then:bb9 else:bb9 fallthrough=bb9 -bb9: - predecessor blocks: bb7 - [13] Const mutate $17:TPrimitive = null - [14] Call mutate mutate$7:TFunction(mutate x$15_@1:TObject, read $17:TPrimitive) - [15] Return -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - scope @0 [1:2] deps=[] out=[a$11_@0] { - [1] Const mutate a$11_@0:TObject = Object { } - } - [2] Const mutate b$12_@1[2:15] = Array [read a$11_@0:TObject] - scope @2 [3:4] deps=[] out=[c$13_@2] { - [3] Const mutate c$13_@2:TObject = Object { } - } - [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$7:TFunction(mutate x$15_@1:TObject, mutate d$14_@1:TObject) - if (read a$11_@0:TObject) { - } - if (read b$12_@1) { - } - if (read c$13_@2:TObject) { - } - if (read d$14_@1:TObject) { - } - if (read y$16_@1) { - } - [13] Const mutate $17:TPrimitive = null - [14] Call mutate mutate$7:TFunction(mutate x$15_@1:TObject, read $17:TPrimitive) - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md b/compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md index b95ca4cd22..76e3d9e06a 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md @@ -34,129 +34,18 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function mutate( -) { - return -} - -``` - ## Code ```javascript function mutate() {} ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function cond( -) { - return -} - -``` - ## Code ```javascript function cond() {} ``` -## HIR - -``` -bb0: - [1] Const mutate a$12_@0:TObject[1:18] = Object { } - [2] Const mutate b$13_@0:TObject[1:18] = Object { } - [3] Const mutate c$14_@1:TObject = Object { } - [4] Const mutate d$15_@0:TObject[1:18] = Object { } - [5] While test=bb1 loop=bb3 fallthrough=bb2 -bb1: - predecessor blocks: bb0 bb4 - [6] Const mutate $16:TPrimitive = true - [7] If (read $16:TPrimitive) then:bb3 else:bb2 fallthrough=bb2 -bb3: - predecessor blocks: bb1 - [8] Call mutate mutate$6:TFunction(mutate a$12_@0:TObject, mutate b$13_@0:TObject) - [9] Const mutate $21_@0[1:18] = Call mutate cond$7:TFunction(mutate a$12_@0:TObject) - [10] If (read $21_@0) then:bb2 else:bb4 fallthrough=bb4 -bb4: - predecessor blocks: bb3 - [11] Goto(Continue) bb1 -bb2: - predecessor blocks: bb3 bb1 - [12] If (read a$12_@0:TObject) then:bb7 else:bb7 fallthrough=bb7 -bb7: - predecessor blocks: bb2 - [13] If (read b$13_@0:TObject) then:bb9 else:bb9 fallthrough=bb9 -bb9: - predecessor blocks: bb7 - [14] If (read c$14_@1:TObject) then:bb11 else:bb11 fallthrough=bb11 -bb11: - predecessor blocks: bb9 - [15] If (read d$15_@0:TObject) then:bb13 else:bb13 fallthrough=bb13 -bb13: - predecessor blocks: bb11 - [16] Const mutate $28:TPrimitive = null - [17] Call mutate mutate$6:TFunction(mutate d$15_@0:TObject, read $28:TPrimitive) - [18] Return -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - [1] Const mutate a$12_@0:TObject[1:18] = Object { } - [2] Const mutate b$13_@0:TObject[1:18] = Object { } - scope @1 [3:4] deps=[] out=[c$14_@1] { - [3] Const mutate c$14_@1:TObject = Object { } - } - [4] Const mutate d$15_@0:TObject[1:18] = Object { } - while ( - [6] Const mutate $16:TPrimitive = true - read $16:TPrimitive - ) { - [8] Call mutate mutate$6:TFunction(mutate a$12_@0:TObject, mutate b$13_@0:TObject) - [9] Const mutate $21_@0[1:18] = Call mutate cond$7:TFunction(mutate a$12_@0:TObject) - if (read $21_@0) { - break - } - } - if (read a$12_@0:TObject) { - } - if (read b$13_@0:TObject) { - } - if (read c$14_@1:TObject) { - } - if (read d$15_@0:TObject) { - } - [16] Const mutate $28:TPrimitive = null - [17] Call mutate mutate$6:TFunction(mutate d$15_@0:TObject, read $28:TPrimitive) - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/object-properties.expect.md b/compiler/forget/src/__tests__/fixtures/hir/object-properties.expect.md new file mode 100644 index 0000000000..a4ef23ff50 --- /dev/null +++ b/compiler/forget/src/__tests__/fixtures/hir/object-properties.expect.md @@ -0,0 +1,27 @@ + +## Input + +```javascript +function foo(a, b, c) { + const x = a.x; + const y = b.c.d; + y.z = c.d.e; + foo(a.b.c); + [a.b.c]; +} + +``` + +## Code + +```javascript +function foo(a, b, c) { + const x = a.x; + const y = b.c.d; + y.z = c.d.e; + foo(a.b.c); + [a.b.c]; +} + +``` + \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/object-properties.js b/compiler/forget/src/__tests__/fixtures/hir/object-properties.js new file mode 100644 index 0000000000..bca614b3d1 --- /dev/null +++ b/compiler/forget/src/__tests__/fixtures/hir/object-properties.js @@ -0,0 +1,7 @@ +function foo(a, b, c) { + const x = a.x; + const y = b.c.d; + y.z = c.d.e; + foo(a.b.c); + [a.b.c]; +} diff --git a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved-by-terminal.expect.md b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved-by-terminal.expect.md index 793c59f9f9..ee03be5071 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved-by-terminal.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved-by-terminal.expect.md @@ -15,39 +15,6 @@ function foo(a, b, c) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$9_@0[1:6] = Array [] - [2] Const mutate y$10_@0[1:6] = Array [] - [3] If (read x$9_@0) then:bb1 else:bb1 fallthrough=bb1 -bb1: - predecessor blocks: bb0 - [4] Call mutate y$10_@0.push(read a$6) - [5] Call mutate x$9_@0.push(read b$7) - [6] Return -``` - -## Reactive Scopes - -``` -function foo( - a, - b, - c, -) { - [1] Const mutate x$9_@0[1:6] = Array [] - [2] Const mutate y$10_@0[1:6] = Array [] - if (read x$9_@0) { - } - [4] Call mutate y$10_@0.push(read a$6) - [5] Call mutate x$9_@0.push(read b$7) - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved.expect.md b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved.expect.md index ebf6f52890..dd0dc7aa43 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved.expect.md @@ -11,33 +11,6 @@ function foo(a, b) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$7_@0[1:5] = Array [] - [2] Const mutate y$8_@0[1:5] = Array [] - [3] Call mutate x$7_@0.push(read a$5) - [4] Call mutate y$8_@0.push(read b$6) - [5] Return -``` - -## Reactive Scopes - -``` -function foo( - a, - b, -) { - [1] Const mutate x$7_@0[1:5] = Array [] - [2] Const mutate y$8_@0[1:5] = Array [] - [3] Call mutate x$7_@0.push(read a$5) - [4] Call mutate y$8_@0.push(read b$6) - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowed.expect.md b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowed.expect.md index 8202126f02..55e86925bf 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowed.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowed.expect.md @@ -11,33 +11,6 @@ function foo(a, b) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$7_@0[1:5] = Array [] - [2] Const mutate y$8_@1[2:4] = Array [] - [3] Call mutate y$8_@1.push(read b$6) - [4] Call mutate x$7_@0.push(read a$5) - [5] Return -``` - -## Reactive Scopes - -``` -function foo( - a, - b, -) { - [1] Const mutate x$7_@0[1:5] = Array [] - [2] Const mutate y$8_@1[2:4] = Array [] - [3] Call mutate y$8_@1.push(read b$6) - [4] Call mutate x$7_@0.push(read a$5) - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowing-within-block.expect.md b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowing-within-block.expect.md index ec18e3e0f8..3036392f48 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowing-within-block.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowing-within-block.expect.md @@ -17,60 +17,6 @@ function foo(a, b, c) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$11_@0[1:11] = Array [] - [2] If (read a$8) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [3] Const mutate y$12_@1[3:7] = Array [] - [4] If (read b$9) then:bb4 else:bb3 fallthrough=bb3 -bb4: - predecessor blocks: bb2 - [5] Call mutate y$12_@1.push(read c$10) - [6] Goto bb3 -bb3: - predecessor blocks: bb4 bb2 - [7] Const mutate $13:TPrimitive = "div" - [8] Const mutate t8$15_@2 = JSX {freeze y$12_@1} - [9] Call mutate x$11_@0.push(read t8$15_@2) - [10] Goto bb1 -bb1: - predecessor blocks: bb3 bb0 - [11] Return freeze x$11_@0 -``` - -## Reactive Scopes - -``` -function foo( - a, - b, - c, -) { - scope @0 [1:11] deps=[read a$8, read b$9, read c$10] out=[x$11_@0] { - [1] Const mutate x$11_@0[1:11] = Array [] - if (read a$8) { - scope @1 [3:7] deps=[read b$9, read c$10] out=[y$12_@1] { - [3] Const mutate y$12_@1[3:7] = Array [] - if (read b$9) { - [5] Call mutate y$12_@1.push(read c$10) - } - } - [7] Const mutate $13:TPrimitive = "div" - scope @2 [8:9] deps=[freeze y$12_@1] out=[$15_@2] { - [8] Const mutate $15_@2 = JSX {freeze y$12_@1} - } - [9] Call mutate x$11_@0.push(read $15_@2) - } - } - return freeze x$11_@0 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-while.expect.md b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-while.expect.md index 858af61ab3..2f7144a106 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-while.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-while.expect.md @@ -13,47 +13,6 @@ function foo(a, b, c) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$9_@0[1:8] = Array [] - [2] Const mutate y$10_@0[1:8] = Array [] - [3] While test=bb1 loop=bb3 fallthrough=bb2 -bb1: - predecessor blocks: bb0 bb3 - [4] If (read c$8) then:bb3 else:bb2 fallthrough=bb2 -bb3: - predecessor blocks: bb1 - [5] Call mutate y$10_@0.push(read b$7) - [6] Call mutate x$9_@0.push(read a$6) - [7] Goto(Continue) bb1 -bb2: - predecessor blocks: bb1 - [8] Return -``` - -## Reactive Scopes - -``` -function foo( - a, - b, - c, -) { - [1] Const mutate x$9_@0[1:8] = Array [] - [2] Const mutate y$10_@0[1:8] = Array [] - while ( - read c$8 - ) { - [5] Call mutate y$10_@0.push(read b$7) - [6] Call mutate x$9_@0.push(read a$6) - } - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-within-block.expect.md b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-within-block.expect.md index ef76736c90..2f72eea03e 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-within-block.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-within-block.expect.md @@ -17,52 +17,6 @@ function foo(a, b, c) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$9_@0[1:9] = Array [] - [2] If (read a$6) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [3] Const mutate y$10_@0[1:9] = Array [] - [4] If (read b$7) then:bb4 else:bb3 fallthrough=bb3 -bb4: - predecessor blocks: bb2 - [5] Call mutate y$10_@0.push(read c$8) - [6] Goto bb3 -bb3: - predecessor blocks: bb4 bb2 - [7] Call mutate x$9_@0.push(mutate y$10_@0) - [8] Goto bb1 -bb1: - predecessor blocks: bb3 bb0 - [9] Return freeze x$9_@0 -``` - -## Reactive Scopes - -``` -function foo( - a, - b, - c, -) { - scope @0 [1:9] deps=[read a$6, read b$7, read c$8] out=[x$9_@0] { - [1] Const mutate x$9_@0[1:9] = Array [] - if (read a$6) { - [3] Const mutate y$10_@0[1:9] = Array [] - if (read b$7) { - [5] Call mutate y$10_@0.push(read c$8) - } - [7] Call mutate x$9_@0.push(mutate y$10_@0) - } - } - return freeze x$9_@0 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md b/compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md index 60e9fd1b74..872f78c2d3 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md @@ -13,40 +13,6 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$7_@0:TObject[1:6] = Object { } - [2] Const mutate y$8_@0[1:6] = Array [] - [3] Reassign store x$7_@0.y[1:6] = read y$8_@0 - [4] Const mutate child$9_@0[1:6] = JSX - [5] Call mutate x$7_@0.y.push(read props$6.p0) - [6] Const mutate t5$10_@1 = JSX {read child$9_@0} - [7] Return read t5$10_@1 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - scope @0 [1:6] deps=[read props$6.p0] out=[x$7_@0, child$9_@0] { - [1] Const mutate x$7_@0:TObject[1:6] = Object { } - [2] Const mutate y$8_@0[1:6] = Array [] - [3] Reassign store x$7_@0.y[1:6] = read y$8_@0 - [4] Const mutate child$9_@0[1:6] = JSX - [5] Call mutate x$7_@0.y.push(read props$6.p0) - } - scope @1 [6:7] deps=[freeze x$7_@0:TObject, read child$9_@0] out=[$10_@1] { - [6] Const mutate $10_@1 = JSX {read child$9_@0} - } - return read $10_@1 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md index 11359cfefa..c0dc033d54 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md @@ -14,37 +14,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$4_@0:TObject[1:6] = Object { } - [2] Const mutate y$5_@1[2:5] = Array [] - [3] Const mutate z$6_@1:TObject[2:5] = Object { } - [4] Call mutate y$5_@1.push(mutate z$6_@1:TObject) - [5] Reassign store x$4_@0.y[1:6] = read y$5_@1 - [6] Return freeze x$4_@0:TObject -``` - -## Reactive Scopes - -``` -function foo( -) { - scope @0 [1:6] deps=[] out=[x$4_@0] { - [1] Const mutate x$4_@0:TObject[1:6] = Object { } - scope @1 [2:5] deps=[] out=[y$5_@1] { - [2] Const mutate y$5_@1[2:5] = Array [] - [3] Const mutate z$6_@1:TObject[2:5] = Object { } - [4] Call mutate y$5_@1.push(mutate z$6_@1:TObject) - } - [5] Reassign store x$4_@0.y[1:6] = read y$5_@1 - } - return freeze x$4_@0:TObject -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes-if.expect.md index 21e3179cbb..3964d0967c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes-if.expect.md @@ -16,58 +16,6 @@ function foo(a, b, c) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$11_@0[1:11] = Array [] - [2] If (read a$8) then:bb2 else:bb3 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [3] Const mutate y$12_@1[3:5] = Array [] - [4] Call mutate y$12_@1.push(read b$9) - [5] Const mutate $13:TPrimitive = "div" - [6] Const mutate t7$14_@2 = JSX {freeze y$12_@1} - [7] Call mutate x$11_@0.push(read t7$14_@2) - [8] Goto bb1 -bb3: - predecessor blocks: bb0 - [9] Call mutate x$11_@0.push(read c$10) - [10] Goto bb1 -bb1: - predecessor blocks: bb2 bb3 - [11] Return freeze x$11_@0 -``` - -## Reactive Scopes - -``` -function foo( - a, - b, - c, -) { - scope @0 [1:11] deps=[read a$8, read b$9, read c$10] out=[x$11_@0] { - [1] Const mutate x$11_@0[1:11] = Array [] - if (read a$8) { - scope @1 [3:5] deps=[read b$9] out=[y$12_@1] { - [3] Const mutate y$12_@1[3:5] = Array [] - [4] Call mutate y$12_@1.push(read b$9) - } - [5] Const mutate $13:TPrimitive = "div" - scope @2 [6:7] deps=[freeze y$12_@1] out=[$14_@2] { - [6] Const mutate $14_@2 = JSX {freeze y$12_@1} - } - [7] Call mutate x$11_@0.push(read $14_@2) - } else { - [9] Call mutate x$11_@0.push(read c$10) - } - } - return freeze x$11_@0 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes.expect.md index aacd0263ba..548d0b3588 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes.expect.md @@ -15,54 +15,6 @@ function f(a, b) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$10_@0[1:8] = Array [] - [2] Const mutate $11:TPrimitive = 1 - [3] Const mutate $12:TPrimitive = Binary read a$8.length === read $11:TPrimitive - [4] If (read $12:TPrimitive) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [5] If (read b$9) then:bb4 else:bb1 fallthrough=bb1 -bb4: - predecessor blocks: bb2 - [6] Call mutate x$10_@0.push(read b$9) - [7] Goto bb1 -bb1: - predecessor blocks: bb4 bb2 bb0 - [8] Const mutate $13:TPrimitive = "div" - [9] Const mutate t4$15_@1 = JSX {freeze x$10_@0} - [10] Return read t4$15_@1 -``` - -## Reactive Scopes - -``` -function f( - a, - b, -) { - scope @0 [1:8] deps=[read a$8.length, read b$9] out=[x$10_@0] { - [1] Const mutate x$10_@0[1:8] = Array [] - [2] Const mutate $11:TPrimitive = 1 - [3] Const mutate $12:TPrimitive = Binary read a$8.length === read $11:TPrimitive - if (read $12:TPrimitive) { - if (read b$9) { - [6] Call mutate x$10_@0.push(read b$9) - } - } - } - [8] Const mutate $13:TPrimitive = "div" - scope @1 [9:10] deps=[freeze x$10_@0] out=[$15_@1] { - [9] Const mutate $15_@1 = JSX {freeze x$10_@0} - } - return read $15_@1 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md index 079007660e..192366c7f1 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md @@ -19,58 +19,6 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$7_@0[1:3] = Array [] - [2] Call mutate x$7_@0.push(read props$6.p0) - [3] Const mutate y$8 = read x$7_@0 - [4] Let mutate x$0$11_@1[1:7] = read x$7_@0 - [4] If (read props$6.p1) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [5] Const mutate x$1$9_@2 = Array [] - [6] Reassign mutate x$0$11_@1[1:7] = read x$1$9_@2 - [6] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [7] Const mutate _$12_@3 = JSX - [8] Call read y$8.push(read props$6.p2) - [9] Const mutate t7$15_@4 = JSX - [10] Return read t7$15_@4 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - scope @0 [1:3] deps=[read props$6.p0] out=[x$7_@0] { - [1] Const mutate x$7_@0[1:3] = Array [] - [2] Call mutate x$7_@0.push(read props$6.p0) - } - [3] Const mutate y$8 = read x$7_@0 - scope @1 [1:7] deps=[read props$6.p1] out=[x$0$11_@1] { - [4] Let mutate x$0$11_@1[1:7] = read x$7_@0 - if (read props$6.p1) { - scope @2 [5:6] deps=[] out=[x$1$9_@2] { - [5] Const mutate x$1$9_@2 = Array [] - } - [6] Reassign mutate x$0$11_@1[1:7] = read x$1$9_@2 - } - } - [7] Const mutate _$12_@3 = JSX - [8] Call read y$8.push(read props$6.p2) - scope @4 [9:10] deps=[read x$0$11_@1, read y$8] out=[$15_@4] { - [9] Const mutate $15_@4 = JSX - } - return read $15_@4 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/reassignment-separate-scopes.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reassignment-separate-scopes.expect.md index 596040b3bb..b698615d46 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reassignment-separate-scopes.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reassignment-separate-scopes.expect.md @@ -30,99 +30,6 @@ function foo(a, b, c) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$16_@0[1:5] = Array [] - [2] If (read a$13) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [3] Call mutate x$16_@0.push(read a$13) - [4] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [5] Const mutate $17:TPrimitive = "div" - [6] Const mutate y$19_@1 = JSX {freeze x$16_@0} - [7] Const mutate $20:TPrimitive = 0 - [8] Let mutate x$0$30_@2[8:15] = undefined - [8] Switch (read b$14) - Case read $20:TPrimitive: bb5 - Default: bb4 - Fallthrough: bb3 -bb5: - predecessor blocks: bb1 - [9] Const mutate x$1$22_@3[9:11] = Array [] - [10] Call mutate x$1$22_@3.push(read b$14) - [11] Reassign mutate x$0$30_@2[8:15] = read x$1$22_@3 - [11] Goto bb3 -bb4: - predecessor blocks: bb1 - [12] Const mutate x$2$23_@4[12:14] = Array [] - [13] Call mutate x$2$23_@4.push(read c$15) - [14] Reassign mutate x$0$30_@2[8:15] = read x$2$23_@4 - [14] Goto bb3 -bb3: - predecessor blocks: bb5 bb4 - [15] Const mutate $25:TPrimitive = "div" - [16] Const mutate $26:TPrimitive = "\n " - [17] Const mutate $27:TPrimitive = "\n " - [18] Const mutate $28:TPrimitive = "\n " - [19] Const mutate t13$31_@5 = JSX {read $26:TPrimitive}{read y$19_@1}{read $27:TPrimitive}{freeze x$0$30_@2}{read $28:TPrimitive} - [20] Return read t13$31_@5 -``` - -## Reactive Scopes - -``` -function foo( - a, - b, - c, -) { - scope @0 [1:5] deps=[read a$13] out=[x$16_@0] { - [1] Const mutate x$16_@0[1:5] = Array [] - if (read a$13) { - [3] Call mutate x$16_@0.push(read a$13) - } - } - [5] Const mutate $17:TPrimitive = "div" - scope @1 [6:7] deps=[freeze x$16_@0] out=[y$19_@1] { - [6] Const mutate y$19_@1 = JSX {freeze x$16_@0} - } - [7] Const mutate $20:TPrimitive = 0 - scope @2 [8:15] deps=[read b$14, read c$15] out=[x$0$30_@2] { - [8] Let mutate x$0$30_@2[8:15] = undefined - switch (read b$14) { - case read $20:TPrimitive: { - scope @3 [9:11] deps=[read b$14] out=[x$1$22_@3] { - [9] Const mutate x$1$22_@3[9:11] = Array [] - [10] Call mutate x$1$22_@3.push(read b$14) - } - [11] Reassign mutate x$0$30_@2[8:15] = read x$1$22_@3 - break bb3 - } - default: { - scope @4 [12:14] deps=[read c$15] out=[x$2$23_@4] { - [12] Const mutate x$2$23_@4[12:14] = Array [] - [13] Call mutate x$2$23_@4.push(read c$15) - } - [14] Reassign mutate x$0$30_@2[8:15] = read x$2$23_@4 - } - } - } - [15] Const mutate $25:TPrimitive = "div" - [16] Const mutate $26:TPrimitive = "\n " - [17] Const mutate $27:TPrimitive = "\n " - [18] Const mutate $28:TPrimitive = "\n " - scope @5 [19:20] deps=[read y$19_@1, freeze x$0$30_@2] out=[$31_@5] { - [19] Const mutate $31_@5 = JSX {read $26:TPrimitive}{read y$19_@1}{read $27:TPrimitive}{freeze x$0$30_@2}{read $28:TPrimitive} - } - return read $31_@5 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md index 4c23f0d107..9616cbc707 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md @@ -17,44 +17,6 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$7_@0[1:7] = Array [] - [2] Call mutate x$7_@0.push(read props$6.p0) - [3] Const mutate y$8_@0[1:7] = read x$7_@0 - [4] Const mutate x$0$9_@1 = Array [] - [5] Const mutate _$10_@2 = JSX - [6] Call mutate y$8_@0.push(read props$6.p1) - [7] Const mutate t6$11_@3 = JSX - [8] Return read t6$11_@3 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - scope @0 [1:7] deps=[read props$6.p0, read props$6.p1] out=[y$8_@0] { - [1] Const mutate x$7_@0[1:7] = Array [] - [2] Call mutate x$7_@0.push(read props$6.p0) - [3] Const mutate y$8_@0[1:7] = read x$7_@0 - scope @1 [4:5] deps=[] out=[x$0$9_@1] { - [4] Const mutate x$0$9_@1 = Array [] - } - [5] Const mutate _$10_@2 = JSX - [6] Call mutate y$8_@0.push(read props$6.p1) - } - scope @3 [7:8] deps=[read x$0$9_@1, freeze y$8_@0] out=[$11_@3] { - [7] Const mutate $11_@3 = JSX - } - return read $11_@3 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md index 0110dc6044..412c9c06e1 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md @@ -32,105 +32,6 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$7:TPrimitive = undefined - [2] Let mutate x$0$16_@0[2:18] = undefined - [2] If (read props$6.cond) then:bb2 else:bb10 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [3] Const mutate $8:TPrimitive = 2 - [4] Const mutate $9:TPrimitive = 1 - [5] Const mutate $10:TPrimitive = 0 - [6] Switch (read props$6.test) - Case read $10:TPrimitive: bb8 - Case read $9:TPrimitive: bb6 - Case read $8:TPrimitive: bb4 - Default: bb4 - Fallthrough: bb1 -bb8: - predecessor blocks: bb2 - [7] Const mutate x$1$11 = read props$6.v0 - [8] Reassign mutate x$0$16_@0[2:18] = read x$1$11 - [8] Goto bb1 -bb6: - predecessor blocks: bb2 - [9] Const mutate x$2$12 = read props$6.v1 - [10] Reassign mutate x$0$16_@0[2:18] = read x$2$12 - [10] Goto bb1 -bb4: - predecessor blocks: bb2 - [11] Const mutate x$3$13 = read props$6.v2 - [12] Reassign mutate x$0$16_@0[2:18] = read x$3$13 - [12] Goto bb1 -bb10: - predecessor blocks: bb0 - [13] If (read props$6.cond2) then:bb12 else:bb13 fallthrough=bb1 -bb12: - predecessor blocks: bb10 - [14] Const mutate x$4$14 = read props$6.b - [15] Reassign mutate x$0$16_@0[2:18] = read x$4$14 - [15] Goto bb1 -bb13: - predecessor blocks: bb10 - [16] Const mutate x$5$15 = read props$6.c - [17] Reassign mutate x$0$16_@0[2:18] = read x$5$15 - [17] Goto bb1 -bb1: - predecessor blocks: bb8 bb6 bb4 bb12 bb13 - [18] read x$0$16_@0 - [19] Return -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - [1] Const mutate x$7:TPrimitive = undefined - scope @0 [2:18] deps=[read props$6.cond, read props$6.test, read props$6.v0, read props$6.v1, read props$6.v2, read props$6.cond2, read props$6.b, read props$6.c] out=[x$0$16_@0] { - [2] Let mutate x$0$16_@0[2:18] = undefined - if (read props$6.cond) { - [3] Const mutate $8:TPrimitive = 2 - [4] Const mutate $9:TPrimitive = 1 - [5] Const mutate $10:TPrimitive = 0 - switch (read props$6.test) { - case read $10:TPrimitive: { - [7] Const mutate x$1$11 = read props$6.v0 - [8] Reassign mutate x$0$16_@0[2:18] = read x$1$11 - break bb1 - } - case read $9:TPrimitive: { - [9] Const mutate x$2$12 = read props$6.v1 - [10] Reassign mutate x$0$16_@0[2:18] = read x$2$12 - break bb1 - } - case read $8:TPrimitive: { - } - default: { - [11] Const mutate x$3$13 = read props$6.v2 - [12] Reassign mutate x$0$16_@0[2:18] = read x$3$13 - } - } - } else { - if (read props$6.cond2) { - [14] Const mutate x$4$14 = read props$6.b - [15] Reassign mutate x$0$16_@0[2:18] = read x$4$14 - } else { - [16] Const mutate x$5$15 = read props$6.c - [17] Reassign mutate x$0$16_@0[2:18] = read x$5$15 - } - } - } - [18] read x$0$16_@0 - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/simple-alias.expect.md b/compiler/forget/src/__tests__/fixtures/hir/simple-alias.expect.md index 004d2dafa9..14db17ae82 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/simple-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/simple-alias.expect.md @@ -16,62 +16,12 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function mutate( -) { - return -} - -``` - ## Code ```javascript function mutate() {} ``` -## HIR - -``` -bb0: - [1] Const mutate a$5_@0:TObject = Object { } - [2] Const mutate b$6_@1:TObject[2:8] = Object { } - [3] Const mutate c$7_@1:TObject[2:8] = Object { } - [4] Const mutate a$0$8_@1:TObject[2:8] = read b$6_@1:TObject - [5] Const mutate b$1$9_@1:TObject[2:8] = read c$7_@1:TObject - [6] Const mutate c$2$10_@1:TObject[2:8] = read a$0$8_@1:TObject - [7] Call mutate mutate$4:TFunction(mutate a$0$8_@1:TObject, mutate b$1$9_@1:TObject) - [8] Return freeze c$2$10_@1:TObject -``` - -## Reactive Scopes - -``` -function foo( -) { - [1] Const mutate a$5_@0:TObject = Object { } - scope @1 [2:8] deps=[] out=[c$2$10_@1] { - [2] Const mutate b$6_@1:TObject[2:8] = Object { } - [3] Const mutate c$7_@1:TObject[2:8] = Object { } - [4] Const mutate a$0$8_@1:TObject[2:8] = read b$6_@1:TObject - [5] Const mutate b$1$9_@1:TObject[2:8] = read c$7_@1:TObject - [6] Const mutate c$2$10_@1:TObject[2:8] = read a$0$8_@1:TObject - [7] Call mutate mutate$4:TFunction(mutate a$0$8_@1:TObject, mutate b$1$9_@1:TObject) - } - return freeze c$2$10_@1:TObject -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/simple.expect.md b/compiler/forget/src/__tests__/fixtures/hir/simple.expect.md index d502de0c4d..1ab184d43e 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/simple.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/simple.expect.md @@ -11,48 +11,6 @@ function foo(x, y) { ``` -## HIR - -``` -bb0: - [1] If (read x$8) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [2] Const mutate $10:TPrimitive = false - [3] Const mutate t1$11_@0 = Call read foo$0:TFunction(read $10:TPrimitive, read y$9:TPrimitive) - [4] Return freeze t1$11_@0 -bb1: - predecessor blocks: bb0 - [5] Const mutate $12:TPrimitive = 10 - [6] Const mutate $13:TPrimitive = Binary read y$9:TPrimitive * read $12:TPrimitive - [7] Const mutate t2$14_@1 = Array [read $13:TPrimitive] - [8] Return freeze t2$14_@1 -``` - -## Reactive Scopes - -``` -function foo( - x, - y, -) { - if (read x$8) { - [2] Const mutate $10:TPrimitive = false - scope @0 [3:4] deps=[read y$9:TPrimitive] out=[$11_@0] { - [3] Const mutate $11_@0 = Call read foo$0:TFunction(read $10:TPrimitive, read y$9:TPrimitive) - } - return freeze $11_@0 - } - [5] Const mutate $12:TPrimitive = 10 - [6] Const mutate $13:TPrimitive = Binary read y$9:TPrimitive * read $12:TPrimitive - scope @1 [7:8] deps=[] out=[$14_@1] { - [7] Const mutate $14_@1 = Array [read $13:TPrimitive] - } - return freeze $14_@1 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-arrayexpression.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-arrayexpression.expect.md index 90bdf9d70d..d83c1ecaaf 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-arrayexpression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-arrayexpression.expect.md @@ -11,32 +11,6 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Const mutate a$6:TPrimitive = 1 - [2] Const mutate b$7:TPrimitive = 2 - [3] Const mutate x$8_@0 = Array [read a$6:TPrimitive, read b$7:TPrimitive] - [4] Return freeze x$8_@0 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - [1] Const mutate a$6:TPrimitive = 1 - [2] Const mutate b$7:TPrimitive = 2 - scope @0 [3:4] deps=[] out=[x$8_@0] { - [3] Const mutate x$8_@0 = Array [read a$6:TPrimitive, read b$7:TPrimitive] - } - return freeze x$8_@0 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md index dbebc5ff8b..36bb3a0b05 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md @@ -18,79 +18,12 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function foo( -) { - return -} - -``` - ## Code ```javascript function foo() {} ``` -## HIR - -``` -bb0: - [1] Const mutate a$11_@0[1:10] = Array [] - [2] Const mutate b$12_@0:TObject[1:10] = Object { } - [3] Call mutate foo$4:TFunction(mutate a$11_@0, mutate b$12_@0:TObject) - [4] Const mutate t2$13_@1 = Call mutate foo$4:TFunction() - [5] If (read t2$13_@1) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [6] Const mutate $14:TPrimitive = "div" - [7] Const mutate _$15_@2 = JSX - [8] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [9] Call mutate foo$4:TFunction(read a$11_@0, mutate b$12_@0:TObject) - [10] Const mutate $19:TPrimitive = "div" - [11] Const mutate t5$20_@3 = JSX - [12] Return read t5$20_@3 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - scope @0 [1:10] deps=[] out=[a$11_@0, b$12_@0] { - [1] Const mutate a$11_@0[1:10] = Array [] - [2] Const mutate b$12_@0:TObject[1:10] = Object { } - [3] Call mutate foo$4:TFunction(mutate a$11_@0, mutate b$12_@0:TObject) - scope @1 [4:5] deps=[] out=[$13_@1] { - [4] Const mutate $13_@1 = Call mutate foo$4:TFunction() - } - if (read $13_@1) { - [6] Const mutate $14:TPrimitive = "div" - [7] Const mutate _$15_@2 = JSX - } - [9] Call mutate foo$4:TFunction(read a$11_@0, mutate b$12_@0:TObject) - } - [10] Const mutate $19:TPrimitive = "div" - scope @3 [11:12] deps=[freeze a$11_@0, freeze b$12_@0:TObject] out=[$20_@3] { - [11] Const mutate $20_@3 = JSX - } - return read $20_@3 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md index 7a4cbdd8b1..c86c062d4c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md @@ -15,67 +15,12 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function foo( -) { - return -} - -``` - ## Code ```javascript function foo() {} ``` -## HIR - -``` -bb0: - [1] Const mutate a$10_@0[1:7] = Array [] - [2] Const mutate b$11_@0:TObject[1:7] = Object { } - [3] Call mutate foo$4:TFunction(mutate a$10_@0, mutate b$11_@0:TObject) - [4] Const mutate $12:TPrimitive = "div" - [5] Const mutate _$13_@1 = JSX - [6] Call mutate foo$4:TFunction(read a$10_@0, mutate b$11_@0:TObject) - [7] Const mutate $14:TPrimitive = "div" - [8] Const mutate t4$15_@2 = JSX - [9] Return read t4$15_@2 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - scope @0 [1:7] deps=[] out=[a$10_@0, b$11_@0] { - [1] Const mutate a$10_@0[1:7] = Array [] - [2] Const mutate b$11_@0:TObject[1:7] = Object { } - [3] Call mutate foo$4:TFunction(mutate a$10_@0, mutate b$11_@0:TObject) - [4] Const mutate $12:TPrimitive = "div" - [5] Const mutate _$13_@1 = JSX - [6] Call mutate foo$4:TFunction(read a$10_@0, mutate b$11_@0:TObject) - } - [7] Const mutate $14:TPrimitive = "div" - scope @2 [8:9] deps=[read a$10_@0, freeze b$11_@0:TObject] out=[$15_@2] { - [8] Const mutate $15_@2 = JSX - } - return read $15_@2 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md index 2aa86039c7..3a120e70ea 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md @@ -17,69 +17,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$7:TPrimitive = 1 - [2] Const mutate y$8:TPrimitive = 2 - [3] Const mutate $9:TPrimitive = 2 - [4] Const mutate $10:TPrimitive = Binary read y$8:TPrimitive === read $9:TPrimitive - [5] Let mutate x$0$17_@0[1:8] = read x$7:TPrimitive - [5] If (read $10:TPrimitive) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [6] Const mutate x$1$11:TPrimitive = 3 - [7] Reassign mutate x$0$17_@0[1:8] = read x$1$11:TPrimitive - [7] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [8] Const mutate $12:TPrimitive = 3 - [9] Const mutate $14:TPrimitive = Binary read y$8:TPrimitive === read $12:TPrimitive - [10] Let mutate x$2$16_@1[1:13] = read x$0$17_@0 - [10] If (read $14:TPrimitive) then:bb4 else:bb3 fallthrough=bb3 -bb4: - predecessor blocks: bb1 - [11] Const mutate x$3$15:TPrimitive = 5 - [12] Reassign mutate x$2$16_@1[1:13] = read x$3$15:TPrimitive - [12] Goto bb3 -bb3: - predecessor blocks: bb4 bb1 - [13] Const mutate y$4$18 = read x$2$16_@1 - [14] Return -``` - -## Reactive Scopes - -``` -function foo( -) { - [1] Const mutate x$7:TPrimitive = 1 - [2] Const mutate y$8:TPrimitive = 2 - [3] Const mutate $9:TPrimitive = 2 - [4] Const mutate $10:TPrimitive = Binary read y$8:TPrimitive === read $9:TPrimitive - scope @0 [1:8] deps=[] out=[x$0$17_@0] { - [5] Let mutate x$0$17_@0[1:8] = read x$7:TPrimitive - if (read $10:TPrimitive) { - [6] Const mutate x$1$11:TPrimitive = 3 - [7] Reassign mutate x$0$17_@0[1:8] = read x$1$11:TPrimitive - } - } - [8] Const mutate $12:TPrimitive = 3 - [9] Const mutate $14:TPrimitive = Binary read y$8:TPrimitive === read $12:TPrimitive - scope @1 [1:13] deps=[] out=[x$2$16_@1] { - [10] Let mutate x$2$16_@1[1:13] = read x$0$17_@0 - if (read $14:TPrimitive) { - [11] Const mutate x$3$15:TPrimitive = 5 - [12] Reassign mutate x$2$16_@1[1:13] = read x$3$15:TPrimitive - } - } - [13] Const mutate y$4$18 = read x$2$16_@1 - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md index 7f0e1fd414..0e0c968388 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md @@ -14,49 +14,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$5:TPrimitive = 1 - [2] Const mutate y$6:TPrimitive = 2 - [3] Const mutate $7:TPrimitive = 2 - [4] Const mutate $8:TPrimitive = Binary read y$6:TPrimitive === read $7:TPrimitive - [5] Let mutate x$0$10_@0[1:8] = read x$5:TPrimitive - [5] If (read $8:TPrimitive) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [6] Const mutate x$1$9:TPrimitive = 3 - [7] Reassign mutate x$0$10_@0[1:8] = read x$1$9:TPrimitive - [7] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [8] Const mutate y$2$11 = read x$0$10_@0 - [9] Return -``` - -## Reactive Scopes - -``` -function foo( -) { - [1] Const mutate x$5:TPrimitive = 1 - [2] Const mutate y$6:TPrimitive = 2 - [3] Const mutate $7:TPrimitive = 2 - [4] Const mutate $8:TPrimitive = Binary read y$6:TPrimitive === read $7:TPrimitive - scope @0 [1:8] deps=[] out=[x$0$10_@0] { - [5] Let mutate x$0$10_@0[1:8] = read x$5:TPrimitive - if (read $8:TPrimitive) { - [6] Const mutate x$1$9:TPrimitive = 3 - [7] Reassign mutate x$0$10_@0[1:8] = read x$1$9:TPrimitive - } - } - [8] Const mutate y$2$11 = read x$0$10_@0 - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-for-of.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-for-of.expect.md index 845b3c6af5..7e060dd4c9 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-for-of.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-for-of.expect.md @@ -15,42 +15,6 @@ function foo(cond) { ``` -## HIR - -``` -bb0: - [1] Const mutate items$5_@0 = Array [] - [2] Goto bb1 -bb1: - predecessor blocks: bb0 bb4 - [3] If (read items$5_@0) then:bb3 else:bb2 fallthrough=bb2 -bb3: - predecessor blocks: bb1 - [4] Const mutate y$7:TPrimitive = 0 - [5] If (read cond$4) then:bb5 else:bb4 fallthrough=bb4 -bb5: - predecessor blocks: bb3 - [6] Const mutate y$9:TPrimitive = 1 - [7] Goto bb4 -bb4: - predecessor blocks: bb5 bb3 - [8] Goto(Continue) bb1 -bb2: - predecessor blocks: bb1 - [9] Return freeze items$5_@0 -``` - -## Reactive Scopes - -``` -function foo( - cond, -) { - [1] Const mutate items$5_@0 = Array [] -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-for-trivial-update.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-for-trivial-update.expect.md index afc446bc04..214e290eac 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-for-trivial-update.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-for-trivial-update.expect.md @@ -12,60 +12,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Let mutate x$6_@0:TPrimitive[1:13] = 1 - [2] For init=bb3 test=bb1 loop=bb5 update=bb4 fallthrough=bb2 -bb3: - predecessor blocks: bb0 - [3] Const mutate i$7:TPrimitive = 0 - [4] Goto bb1 -bb1: - predecessor blocks: bb3 bb4 - [5] Const mutate $8:TPrimitive = 10 - [6] Const mutate $10:TPrimitive = Binary read i$7:TPrimitive < read $8:TPrimitive - [7] If (read $10:TPrimitive) then:bb5 else:bb2 fallthrough=bb2 -bb5: - predecessor blocks: bb1 - [8] Const mutate $11:TPrimitive = 1 - [9] Reassign mutate x$6_@0:TPrimitive[1:13] = Binary read x$6_@0:TPrimitive + read $11:TPrimitive - [10] Goto(Continue) bb4 -bb4: - predecessor blocks: bb5 - [11] read i$7:TPrimitive - [12] Goto bb1 -bb2: - predecessor blocks: bb1 - [13] Return read x$6_@0:TPrimitive -``` - -## Reactive Scopes - -``` -function foo( -) { - scope @0 [1:13] deps=[] out=[x$6_@0] { - [1] Let mutate x$6_@0:TPrimitive[1:13] = 1 - for ( - [3] Const mutate i$7:TPrimitive = 0 - ; - [5] Const mutate $8:TPrimitive = 10 - [6] Const mutate $10:TPrimitive = Binary read i$7:TPrimitive < read $8:TPrimitive - read $10:TPrimitive - ; - read i$7:TPrimitive - ) { - [8] Const mutate $11:TPrimitive = 1 - [9] Reassign mutate x$6_@0:TPrimitive[1:13] = Binary read x$6_@0:TPrimitive + read $11:TPrimitive - } - } - return read x$6_@0:TPrimitive -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-for.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-for.expect.md index 9e89ca3e98..97ad5c7fa4 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-for.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-for.expect.md @@ -12,64 +12,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Let mutate x$7_@1:TPrimitive[1:15] = 1 - [2] For init=bb3 test=bb1 loop=bb5 update=bb4 fallthrough=bb2 -bb3: - predecessor blocks: bb0 - [3] Let mutate i$8_@1:TPrimitive[1:15] = 0 - [4] Goto bb1 -bb1: - predecessor blocks: bb3 bb4 - [5] Const mutate $9:TPrimitive = 10 - [6] Const mutate $11:TPrimitive = Binary read i$8_@1:TPrimitive < read $9:TPrimitive - [7] If (read $11:TPrimitive) then:bb5 else:bb2 fallthrough=bb2 -bb5: - predecessor blocks: bb1 - [8] Const mutate $12:TPrimitive = 1 - [9] Reassign mutate x$7_@1:TPrimitive[1:15] = Binary read x$7_@1:TPrimitive + read $12:TPrimitive - [10] Goto(Continue) bb4 -bb4: - predecessor blocks: bb5 - [11] Const mutate $15:TPrimitive = 1 - [12] Reassign mutate i$8_@1:TPrimitive[1:15] = Binary read i$8_@1:TPrimitive + read $15:TPrimitive - [13] read i$8_@1:TPrimitive - [14] Goto bb1 -bb2: - predecessor blocks: bb1 - [15] Return read x$7_@1:TPrimitive -``` - -## Reactive Scopes - -``` -function foo( -) { - scope @1 [1:15] deps=[] out=[x$7_@1] { - [1] Let mutate x$7_@1:TPrimitive[1:15] = 1 - for ( - [3] Let mutate i$8_@1:TPrimitive[1:15] = 0 - ; - [5] Const mutate $9:TPrimitive = 10 - [6] Const mutate $11:TPrimitive = Binary read i$8_@1:TPrimitive < read $9:TPrimitive - read $11:TPrimitive - ; - [11] Const mutate $15:TPrimitive = 1 - [12] Reassign mutate i$8_@1:TPrimitive[1:15] = Binary read i$8_@1:TPrimitive + read $15:TPrimitive - read i$8_@1:TPrimitive - ) { - [8] Const mutate $12:TPrimitive = 1 - [9] Reassign mutate x$7_@1:TPrimitive[1:15] = Binary read x$7_@1:TPrimitive + read $12:TPrimitive - } - } - return read x$7_@1:TPrimitive -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-if-else.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-if-else.expect.md index 7398d125a5..add2ed5e56 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-if-else.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-if-else.expect.md @@ -15,43 +15,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$5:TPrimitive = 1 - [2] Const mutate y$6:TPrimitive = 2 - [3] If (read y$6:TPrimitive) then:bb2 else:bb3 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [4] Const mutate z$7:TPrimitive = Binary read x$5:TPrimitive + read y$6:TPrimitive - [5] Goto bb1 -bb3: - predecessor blocks: bb0 - [6] Const mutate z$8:TPrimitive = read x$5:TPrimitive - [7] Goto bb1 -bb1: - predecessor blocks: bb2 bb3 - [8] Return -``` - -## Reactive Scopes - -``` -function foo( -) { - [1] Const mutate x$5:TPrimitive = 1 - [2] Const mutate y$6:TPrimitive = 2 - if (read y$6:TPrimitive) { - [4] Const mutate z$7:TPrimitive = Binary read x$5:TPrimitive + read y$6:TPrimitive - } else { - [6] Const mutate z$8:TPrimitive = read x$5:TPrimitive - } - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-multiple-phis.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-multiple-phis.expect.md index a21674776e..4467ad89ae 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-multiple-phis.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-multiple-phis.expect.md @@ -24,99 +24,6 @@ function foo(a, b, c, d) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$13:TPrimitive = 0 - [2] Const mutate $14:TPrimitive = true - [3] Let mutate x$0$23_@0[3:20] = undefined - [3] If (read $14:TPrimitive) then:bb2 else:bb6 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [4] Const mutate $15:TPrimitive = true - [5] If (read $15:TPrimitive) then:bb4 else:bb5 fallthrough=bb3 -bb4: - predecessor blocks: bb2 - [6] Const mutate x$1$16 = read a$9 - [7] Reassign mutate x$0$23_@0[3:20] = read x$1$16 - [7] Goto bb3 -bb5: - predecessor blocks: bb2 - [8] Const mutate x$2$17 = read b$10 - [9] Reassign mutate x$0$23_@0[3:20] = read x$2$17 - [9] Goto bb3 -bb3: - predecessor blocks: bb4 bb5 - [10] read x$3$18 - [11] Reassign mutate x$0$23_@0[3:20] = read x$3$18 - [11] Goto bb1 -bb6: - predecessor blocks: bb0 - [12] Const mutate $19:TPrimitive = true - [13] If (read $19:TPrimitive) then:bb8 else:bb9 fallthrough=bb7 -bb8: - predecessor blocks: bb6 - [14] Const mutate x$4$20 = read c$11 - [15] Reassign mutate x$0$23_@0[3:20] = read x$4$20 - [15] Goto bb7 -bb9: - predecessor blocks: bb6 - [16] Const mutate x$5$21 = read d$12 - [17] Reassign mutate x$0$23_@0[3:20] = read x$5$21 - [17] Goto bb7 -bb7: - predecessor blocks: bb8 bb9 - [18] read x$6$22 - [19] Reassign mutate x$0$23_@0[3:20] = read x$6$22 - [19] Goto bb1 -bb1: - predecessor blocks: bb3 bb7 - [20] Return read x$0$23_@0 -``` - -## Reactive Scopes - -``` -function foo( - a, - b, - c, - d, -) { - [1] Const mutate x$13:TPrimitive = 0 - [2] Const mutate $14:TPrimitive = true - scope @0 [3:20] deps=[read a$9, read b$10, read c$11, read d$12] out=[x$0$23_@0] { - [3] Let mutate x$0$23_@0[3:20] = undefined - if (read $14:TPrimitive) { - [4] Const mutate $15:TPrimitive = true - if (read $15:TPrimitive) { - [6] Const mutate x$1$16 = read a$9 - [7] Reassign mutate x$0$23_@0[3:20] = read x$1$16 - } else { - [8] Const mutate x$2$17 = read b$10 - [9] Reassign mutate x$0$23_@0[3:20] = read x$2$17 - } - [10] read x$3$18 - [11] Reassign mutate x$0$23_@0[3:20] = read x$3$18 - } else { - [12] Const mutate $19:TPrimitive = true - if (read $19:TPrimitive) { - [14] Const mutate x$4$20 = read c$11 - [15] Reassign mutate x$0$23_@0[3:20] = read x$4$20 - } else { - [16] Const mutate x$5$21 = read d$12 - [17] Reassign mutate x$0$23_@0[3:20] = read x$5$21 - } - [18] read x$6$22 - [19] Reassign mutate x$0$23_@0[3:20] = read x$6$22 - } - } - return read x$0$23_@0 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-loops-no-reassign.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-loops-no-reassign.expect.md index 91d708ccf0..f3eef5945e 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-loops-no-reassign.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-loops-no-reassign.expect.md @@ -17,71 +17,6 @@ function foo(a, b, c) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$9:TPrimitive = 0 - [2] While test=bb1 loop=bb3 fallthrough=bb2 -bb1: - predecessor blocks: bb0 bb5 - [3] If (read a$6) then:bb3 else:bb2 fallthrough=bb2 -bb3: - predecessor blocks: bb1 - [4] While test=bb4 loop=bb6 fallthrough=bb5 -bb4: - predecessor blocks: bb3 bb8 - [5] If (read b$7) then:bb6 else:bb5 fallthrough=bb5 -bb6: - predecessor blocks: bb4 - [6] While test=bb7 loop=bb9 fallthrough=bb8 -bb7: - predecessor blocks: bb6 bb9 - [7] If (read c$8) then:bb9 else:bb8 fallthrough=bb8 -bb9: - predecessor blocks: bb7 - [8] Const mutate $13:TPrimitive = 1 - [9] Binary read x$9:TPrimitive + read $13:TPrimitive - [10] Goto(Continue) bb7 -bb8: - predecessor blocks: bb7 - [11] Goto(Continue) bb4 -bb5: - predecessor blocks: bb4 - [12] Goto(Continue) bb1 -bb2: - predecessor blocks: bb1 - [13] Return read x$9:TPrimitive -``` - -## Reactive Scopes - -``` -function foo( - a, - b, - c, -) { - [1] Const mutate x$9:TPrimitive = 0 - while ( - read a$6 - ) { - while ( - read b$7 - ) { - while ( - read c$8 - ) { - [8] Const mutate $13:TPrimitive = 1 - [9] Binary read x$9:TPrimitive + read $13:TPrimitive - } - } - } - return read x$9:TPrimitive -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-phi.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-phi.expect.md index e6f5c05c10..58dfcb4265 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-phi.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-phi.expect.md @@ -14,54 +14,6 @@ function foo(a, b, c) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$8 = read a$5 - [2] If (read b$6) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [3] Let mutate x$0$10_@0[1:6] = read x$8 - [3] If (read c$7) then:bb4 else:bb3 fallthrough=bb3 -bb4: - predecessor blocks: bb2 - [4] Const mutate x$1$9 = read c$7 - [5] Reassign mutate x$0$10_@0[1:6] = read x$1$9 - [5] Goto bb3 -bb3: - predecessor blocks: bb4 bb2 - [6] read x$0$10_@0 - [7] Goto bb1 -bb1: - predecessor blocks: bb3 bb0 - [8] Return -``` - -## Reactive Scopes - -``` -function foo( - a, - b, - c, -) { - [1] Const mutate x$8 = read a$5 - if (read b$6) { - scope @0 [1:6] deps=[read c$7] out=[x$0$10_@0] { - [3] Let mutate x$0$10_@0[1:6] = read x$8 - if (read c$7) { - [4] Const mutate x$1$9 = read c$7 - [5] Reassign mutate x$0$10_@0[1:6] = read x$1$9 - } - } - [6] read x$0$10_@0 - } - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-reassignment.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-reassignment.expect.md index 17b0c3e306..6608a9cb35 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-reassignment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-reassignment.expect.md @@ -16,59 +16,6 @@ function foo(a, b, c, d, e) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$12:TPrimitive = null - [2] Let mutate x$0$15_@0[1:8] = read x$12:TPrimitive - [2] If (read a$7) then:bb2 else:bb3 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [3] Const mutate x$1$13 = read b$8 - [4] Reassign mutate x$0$15_@0[1:8] = read x$1$13 - [4] Goto bb1 -bb3: - predecessor blocks: bb0 - [5] If (read c$9) then:bb5 else:bb1 fallthrough=bb1 -bb5: - predecessor blocks: bb3 - [6] Const mutate x$2$14 = read d$10 - [7] Reassign mutate x$0$15_@0[1:8] = read x$2$14 - [7] Goto bb1 -bb1: - predecessor blocks: bb2 bb5 bb3 - [8] Return read x$0$15_@0 -``` - -## Reactive Scopes - -``` -function foo( - a, - b, - c, - d, - e, -) { - [1] Const mutate x$12:TPrimitive = null - scope @0 [1:8] deps=[read a$7, read b$8, read c$9, read d$10] out=[x$0$15_@0] { - [2] Let mutate x$0$15_@0[1:8] = read x$12:TPrimitive - if (read a$7) { - [3] Const mutate x$1$13 = read b$8 - [4] Reassign mutate x$0$15_@0[1:8] = read x$1$13 - } else { - if (read c$9) { - [6] Const mutate x$2$14 = read d$10 - [7] Reassign mutate x$0$15_@0[1:8] = read x$2$14 - } - } - } - return read x$0$15_@0 -} - -``` - ## Code ```javascript 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 d84a9bb8d5..b2859997a7 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md @@ -13,55 +13,12 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function Foo( -) { - return -} - -``` - ## Code ```javascript function Foo() {} ``` -## HIR - -``` -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$4(mutate a$7_@0, mutate b$8_@0:TObject) - [4] Return freeze c$9_@0 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - 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$4(mutate a$7_@0, mutate b$8_@0:TObject) - } - return freeze c$9_@0 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md index 023081d3ff..6fda2ffc83 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md @@ -18,61 +18,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$6:TPrimitive = 1 - [2] Const mutate y$7:TPrimitive = 2 - [3] Const mutate $8:TPrimitive = 1 - [4] Const mutate $9:TPrimitive = Binary read x$6:TPrimitive > read $8:TPrimitive - [5] Let mutate x$0$12_@0[1:10] = read x$6:TPrimitive - [5] Let mutate y$1$13_@0[1:10] = read y$7:TPrimitive - [5] If (read $9:TPrimitive) then:bb2 else:bb3 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [6] Const mutate x$2$10:TPrimitive = 2 - [7] Reassign mutate x$0$12_@0[1:10] = read x$2$10:TPrimitive - [7] Goto bb1 -bb3: - predecessor blocks: bb0 - [8] Const mutate y$3$11:TPrimitive = 3 - [9] Reassign mutate y$1$13_@0[1:10] = read y$3$11:TPrimitive - [9] Goto bb1 -bb1: - predecessor blocks: bb2 bb3 - [10] Const mutate t$14_@2:TObject = Object { x: read x$0$12_@0, y: read y$1$13_@0 } - [11] Return freeze t$14_@2:TObject -``` - -## Reactive Scopes - -``` -function foo( -) { - [1] Const mutate x$6:TPrimitive = 1 - [2] Const mutate y$7:TPrimitive = 2 - [3] Const mutate $8:TPrimitive = 1 - [4] Const mutate $9:TPrimitive = Binary read x$6:TPrimitive > read $8:TPrimitive - scope @0 [1:10] deps=[] out=[x$0$12_@0] { - [5] Let mutate x$0$12_@0[1:10] = read x$6:TPrimitive - [5] Let mutate y$1$13_@0[1:10] = read y$7:TPrimitive - if (read $9:TPrimitive) { - [6] Const mutate x$2$10:TPrimitive = 2 - [7] Reassign mutate x$0$12_@0[1:10] = read x$2$10:TPrimitive - } else { - [8] Const mutate y$3$11:TPrimitive = 3 - [9] Reassign mutate y$1$13_@0[1:10] = read y$3$11:TPrimitive - } - } - scope @2 [10:11] deps=[read x$0$12_@0, read y$1$13_@0] out=[t$14_@2] { - [10] Const mutate t$14_@2:TObject = Object { x: read x$0$12_@0, y: read y$1$13_@0 } - } - return freeze t$14_@2:TObject -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression.expect.md index 947ef1730b..9fb9f2cf6c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression.expect.md @@ -11,32 +11,6 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Const mutate a$6:TPrimitive = 1 - [2] Const mutate b$7:TPrimitive = 2 - [3] Const mutate x$8_@0:TObject = Object { a: read a$6:TPrimitive, b: read b$7:TPrimitive } - [4] Return freeze x$8_@0:TObject -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - [1] Const mutate a$6:TPrimitive = 1 - [2] Const mutate b$7:TPrimitive = 2 - scope @0 [3:4] deps=[] out=[x$8_@0] { - [3] Const mutate x$8_@0:TObject = Object { a: read a$6:TPrimitive, b: read b$7:TPrimitive } - } - return freeze x$8_@0:TObject -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-alias-mutate-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-alias-mutate-if.expect.md index c8e879b09c..5c2d6d1e1b 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-alias-mutate-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-alias-mutate-if.expect.md @@ -18,52 +18,6 @@ function foo(a) { ``` -## HIR - -``` -bb0: - [1] Const mutate b$8_@0:TObject[1:11] = Object { } - [2] Const mutate x$9_@0:TObject[1:11] = read b$8_@0:TObject - [3] If (read a$7) then:bb2 else:bb3 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [4] Const mutate y$10_@0:TObject[1:11] = Object { } - [5] Reassign store x$9_@0.y[1:11] = read y$10_@0:TObject - [6] Goto bb1 -bb3: - predecessor blocks: bb0 - [7] Const mutate z$11_@0:TObject[1:11] = Object { } - [8] Reassign store x$9_@0.z[1:11] = read z$11_@0:TObject - [9] Goto bb1 -bb1: - predecessor blocks: bb2 bb3 - [10] Call mutate mutate$6:TFunction(mutate b$8_@0:TObject) - [11] Return freeze x$9_@0:TObject -``` - -## Reactive Scopes - -``` -function foo( - a, -) { - scope @0 [1:11] deps=[read a$7] out=[x$9_@0] { - [1] Const mutate b$8_@0:TObject[1:11] = Object { } - [2] Const mutate x$9_@0:TObject[1:11] = read b$8_@0:TObject - if (read a$7) { - [4] Const mutate y$10_@0:TObject[1:11] = Object { } - [5] Reassign store x$9_@0.y[1:11] = read y$10_@0:TObject - } else { - [7] Const mutate z$11_@0:TObject[1:11] = Object { } - [8] Reassign store x$9_@0.z[1:11] = read z$11_@0:TObject - } - [10] Call mutate mutate$6:TFunction(mutate b$8_@0:TObject) - } - return freeze x$9_@0:TObject -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-if.expect.md index 6fa6e7114a..37012a61be 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-if.expect.md @@ -16,52 +16,6 @@ function foo(a) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$6_@0:TObject[1:9] = Object { } - [2] If (read a$5) then:bb2 else:bb3 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [3] Const mutate y$7_@1:TObject = Object { } - [4] Reassign store x$6_@0.y[1:9] = read y$7_@1:TObject - [5] Goto bb1 -bb3: - predecessor blocks: bb0 - [6] Const mutate z$8_@2:TObject = Object { } - [7] Reassign store x$6_@0.z[1:9] = read z$8_@2:TObject - [8] Goto bb1 -bb1: - predecessor blocks: bb2 bb3 - [9] Return freeze x$6_@0:TObject -``` - -## Reactive Scopes - -``` -function foo( - a, -) { - scope @0 [1:9] deps=[read a$5] out=[x$6_@0] { - [1] Const mutate x$6_@0:TObject[1:9] = Object { } - if (read a$5) { - scope @1 [3:4] deps=[] out=[y$7_@1] { - [3] Const mutate y$7_@1:TObject = Object { } - } - [4] Reassign store x$6_@0.y[1:9] = read y$7_@1:TObject - } else { - scope @2 [6:7] deps=[] out=[z$8_@2] { - [6] Const mutate z$8_@2:TObject = Object { } - } - [7] Reassign store x$6_@0.z[1:9] = read z$8_@2:TObject - } - } - return freeze x$6_@0:TObject -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-if.expect.md index 92bda0eaa2..334996f51d 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-if.expect.md @@ -17,50 +17,6 @@ function foo(a) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$7_@0:TObject[1:10] = Object { } - [2] If (read a$6) then:bb2 else:bb3 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [3] Const mutate y$8_@0:TObject[1:10] = Object { } - [4] Reassign store x$7_@0.y[1:10] = read y$8_@0:TObject - [5] Goto bb1 -bb3: - predecessor blocks: bb0 - [6] Const mutate z$9_@0:TObject[1:10] = Object { } - [7] Reassign store x$7_@0.z[1:10] = read z$9_@0:TObject - [8] Goto bb1 -bb1: - predecessor blocks: bb2 bb3 - [9] Call mutate mutate$5:TFunction(mutate x$7_@0:TObject) - [10] Return freeze x$7_@0:TObject -``` - -## Reactive Scopes - -``` -function foo( - a, -) { - scope @0 [1:10] deps=[read a$6] out=[x$7_@0] { - [1] Const mutate x$7_@0:TObject[1:10] = Object { } - if (read a$6) { - [3] Const mutate y$8_@0:TObject[1:10] = Object { } - [4] Reassign store x$7_@0.y[1:10] = read y$8_@0:TObject - } else { - [6] Const mutate z$9_@0:TObject[1:10] = Object { } - [7] Reassign store x$7_@0.z[1:10] = read z$9_@0:TObject - } - [9] Call mutate mutate$5:TFunction(mutate x$7_@0:TObject) - } - return freeze x$7_@0:TObject -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-inside-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-inside-if.expect.md index 732057cb21..6838f886ae 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-inside-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-inside-if.expect.md @@ -17,52 +17,6 @@ function foo(a) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$7_@0:TObject[1:10] = Object { } - [2] If (read a$6) then:bb2 else:bb3 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [3] Const mutate y$8_@0:TObject[1:10] = Object { } - [4] Reassign store x$7_@0.y[1:10] = read y$8_@0:TObject - [5] Call mutate mutate$4:TFunction(mutate y$8_@0:TObject) - [6] Goto bb1 -bb3: - predecessor blocks: bb0 - [7] Const mutate z$9_@1:TObject = Object { } - [8] Reassign store x$7_@0.z[1:10] = read z$9_@1:TObject - [9] Goto bb1 -bb1: - predecessor blocks: bb2 bb3 - [10] Return freeze x$7_@0:TObject -``` - -## Reactive Scopes - -``` -function foo( - a, -) { - scope @0 [1:10] deps=[read a$6] out=[x$7_@0] { - [1] Const mutate x$7_@0:TObject[1:10] = Object { } - if (read a$6) { - [3] Const mutate y$8_@0:TObject[1:10] = Object { } - [4] Reassign store x$7_@0.y[1:10] = read y$8_@0:TObject - [5] Call mutate mutate$4:TFunction(mutate y$8_@0:TObject) - } else { - scope @1 [7:8] deps=[] out=[z$9_@1] { - [7] Const mutate z$9_@1:TObject = Object { } - } - [8] Reassign store x$7_@0.z[1:10] = read z$9_@1:TObject - } - } - return freeze x$7_@0:TObject -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate.expect.md index 33cf4df6c5..42321ee411 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate.expect.md @@ -15,35 +15,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Const mutate a$5_@0:TObject[1:6] = Object { } - [2] Const mutate x$6_@0:TObject[1:6] = read a$5_@0:TObject - [3] Const mutate y$7_@0:TObject[1:6] = Object { } - [4] Reassign store y$7_@0.x[1:6] = read x$6_@0:TObject - [5] Call mutate mutate$4:TFunction(mutate a$5_@0:TObject) - [6] Return freeze y$7_@0:TObject -``` - -## Reactive Scopes - -``` -function foo( -) { - scope @0 [1:6] deps=[] out=[y$7_@0] { - [1] Const mutate a$5_@0:TObject[1:6] = Object { } - [2] Const mutate x$6_@0:TObject[1:6] = read a$5_@0:TObject - [3] Const mutate y$7_@0:TObject[1:6] = Object { } - [4] Reassign store y$7_@0.x[1:6] = read x$6_@0:TObject - [5] Call mutate mutate$4:TFunction(mutate a$5_@0:TObject) - } - return freeze y$7_@0:TObject -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md index a0c4bce260..84fc2f512e 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md @@ -11,35 +11,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$4_@0 = Array [] - [2] Const mutate y$5_@1:TObject[2:5] = Object { x: read x$4_@0 } - [3] Const mutate $6_@1[2:5] = Array [] - [4] Call mutate y$5_@1.x.push(mutate $6_@1) - [5] Return freeze y$5_@1:TObject -``` - -## Reactive Scopes - -``` -function foo( -) { - scope @0 [1:2] deps=[] out=[x$4_@0] { - [1] Const mutate x$4_@0 = Array [] - } - scope @1 [2:5] deps=[read x$4_@0] out=[y$5_@1] { - [2] Const mutate y$5_@1:TObject[2:5] = Object { x: read x$4_@0 } - [3] Const mutate $6_@1[2:5] = Array [] - [4] Call mutate y$5_@1.x.push(mutate $6_@1) - } - return freeze y$5_@1:TObject -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-2.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-2.expect.md index 8d1508c835..f150c10e12 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-2.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-2.expect.md @@ -12,33 +12,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$4_@0[1:5] = Array [] - [2] Const mutate y$5_@0:TObject[1:5] = Object { } - [3] Reassign store y$5_@0.x[1:5] = read x$4_@0 - [4] Call mutate mutate$3:TFunction(mutate x$4_@0) - [5] Return freeze y$5_@0:TObject -``` - -## Reactive Scopes - -``` -function foo( -) { - scope @0 [1:5] deps=[] out=[y$5_@0] { - [1] Const mutate x$4_@0[1:5] = Array [] - [2] Const mutate y$5_@0:TObject[1:5] = Object { } - [3] Reassign store y$5_@0.x[1:5] = read x$4_@0 - [4] Call mutate mutate$3:TFunction(mutate x$4_@0) - } - return freeze y$5_@0:TObject -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-alias.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-alias.expect.md index 56bf236bc8..c7ac5a8947 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-alias.expect.md @@ -15,35 +15,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Const mutate a$5_@0:TObject[1:6] = Object { } - [2] Const mutate y$6_@0:TObject[1:6] = read a$5_@0:TObject - [3] Const mutate x$7_@0[1:6] = Array [] - [4] Reassign store y$6_@0.x[1:6] = read x$7_@0 - [5] Call mutate mutate$4:TFunction(mutate a$5_@0:TObject) - [6] Return freeze y$6_@0:TObject -``` - -## Reactive Scopes - -``` -function foo( -) { - scope @0 [1:6] deps=[] out=[y$6_@0] { - [1] Const mutate a$5_@0:TObject[1:6] = Object { } - [2] Const mutate y$6_@0:TObject[1:6] = read a$5_@0:TObject - [3] Const mutate x$7_@0[1:6] = Array [] - [4] Reassign store y$6_@0.x[1:6] = read x$7_@0 - [5] Call mutate mutate$4:TFunction(mutate a$5_@0:TObject) - } - return freeze y$6_@0:TObject -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate.expect.md index 8ad5180d55..17e871aefa 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate.expect.md @@ -12,33 +12,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$4_@0[1:5] = Array [] - [2] Const mutate y$5_@0:TObject[1:5] = Object { } - [3] Reassign store y$5_@0.x[1:5] = read x$4_@0 - [4] Call mutate mutate$3:TFunction(mutate y$5_@0:TObject) - [5] Return freeze y$5_@0:TObject -``` - -## Reactive Scopes - -``` -function foo( -) { - scope @0 [1:5] deps=[] out=[y$5_@0] { - [1] Const mutate x$4_@0[1:5] = Array [] - [2] Const mutate y$5_@0:TObject[1:5] = Object { } - [3] Reassign store y$5_@0.x[1:5] = read x$4_@0 - [4] Call mutate mutate$3:TFunction(mutate y$5_@0:TObject) - } - return freeze y$5_@0:TObject -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md index 88c56e2c15..5dc6c74d75 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md @@ -11,33 +11,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$3_@0 = Array [] - [2] Const mutate y$4_@1:TObject[2:4] = Object { } - [3] Reassign store y$4_@1.x[2:4] = read x$3_@0 - [4] Return freeze y$4_@1:TObject -``` - -## Reactive Scopes - -``` -function foo( -) { - scope @0 [1:2] deps=[] out=[x$3_@0] { - [1] Const mutate x$3_@0 = Array [] - } - scope @1 [2:4] deps=[read x$3_@0] out=[y$4_@1] { - [2] Const mutate y$4_@1:TObject[2:4] = Object { } - [3] Reassign store y$4_@1.x[2:4] = read x$3_@0 - } - return freeze y$4_@1:TObject -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-reassign.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-reassign.expect.md index 094418e949..4228828e8b 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-reassign.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-reassign.expect.md @@ -12,34 +12,6 @@ function foo(a, b, c) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$8:TPrimitive = 0 - [2] Const mutate x$0$9 = read a$5 - [3] Const mutate x$1$10 = read b$6 - [4] Const mutate x$2$11 = read c$7 - [5] Return read x$2$11 -``` - -## Reactive Scopes - -``` -function foo( - a, - b, - c, -) { - [1] Const mutate x$8:TPrimitive = 0 - [2] Const mutate x$0$9 = read a$5 - [3] Const mutate x$1$10 = read b$6 - [4] Const mutate x$2$11 = read c$7 - return read x$2$11 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-return.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-return.expect.md index 3ee84debd9..25fb920a80 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-return.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-return.expect.md @@ -13,45 +13,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$4:TPrimitive = 1 - [2] Const mutate $5:TPrimitive = 1 - [3] Const mutate $6:TPrimitive = Binary read x$4:TPrimitive === read $5:TPrimitive - [4] Let mutate x$0$8_@0[1:7] = read x$4:TPrimitive - [4] If (read $6:TPrimitive) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [5] Const mutate x$1$7:TPrimitive = 2 - [6] Reassign mutate x$0$8_@0[1:7] = read x$1$7:TPrimitive - [6] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [7] Return read x$0$8_@0 -``` - -## Reactive Scopes - -``` -function foo( -) { - [1] Const mutate x$4:TPrimitive = 1 - [2] Const mutate $5:TPrimitive = 1 - [3] Const mutate $6:TPrimitive = Binary read x$4:TPrimitive === read $5:TPrimitive - scope @0 [1:7] deps=[] out=[x$0$8_@0] { - [4] Let mutate x$0$8_@0[1:7] = read x$4:TPrimitive - if (read $6:TPrimitive) { - [5] Const mutate x$1$7:TPrimitive = 2 - [6] Reassign mutate x$0$8_@0[1:7] = read x$1$7:TPrimitive - } - } - return read x$0$8_@0 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md index 3a31214d77..e56789be06 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md @@ -17,75 +17,12 @@ function Foo(cond) { ``` -## HIR - -``` -bb0: - [1] Return -``` - -## Reactive Scopes - -``` -function log( -) { - return -} - -``` - ## Code ```javascript function log() {} ``` -## HIR - -``` -bb0: - [1] Const mutate str$6:TPrimitive = "" - [2] Let mutate str$0$10_@0[1:8] = read str$6:TPrimitive - [2] If (read cond$5) then:bb2 else:bb3 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [3] Const mutate str$1$7:TPrimitive = "other test" - [4] Call mutate log$4:TFunction(read str$1$7:TPrimitive) - [5] Goto bb1 -bb3: - predecessor blocks: bb0 - [6] Const mutate str$2$8:TPrimitive = "fallthrough test" - [7] Reassign mutate str$0$10_@0[1:8] = read str$2$8:TPrimitive - [7] Goto bb1 -bb1: - predecessor blocks: bb2 bb3 - [8] Call mutate log$4:TFunction(read str$0$10_@0) - [9] Return -``` - -## Reactive Scopes - -``` -function Foo( - cond, -) { - [1] Const mutate str$6:TPrimitive = "" - scope @0 [1:8] deps=[read cond$5] out=[str$0$10_@0] { - [2] Let mutate str$0$10_@0[1:8] = read str$6:TPrimitive - if (read cond$5) { - [3] Const mutate str$1$7:TPrimitive = "other test" - [4] Call mutate log$4:TFunction(read str$1$7:TPrimitive) - } else { - [6] Const mutate str$2$8:TPrimitive = "fallthrough test" - [7] Reassign mutate str$0$10_@0[1:8] = read str$2$8:TPrimitive - } - } - [8] Call mutate log$4:TFunction(read str$0$10_@0) - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-sibling-phis.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-sibling-phis.expect.md index e8e157b3f2..dca51fae7b 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-sibling-phis.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-sibling-phis.expect.md @@ -24,99 +24,6 @@ function foo(a, b, c, d) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$13:TPrimitive = 0 - [2] Const mutate $14:TPrimitive = true - [3] If (read $14:TPrimitive) then:bb2 else:bb6 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [4] Const mutate $15:TPrimitive = true - [5] Let mutate x$0$18_@0[5:10] = undefined - [5] If (read $15:TPrimitive) then:bb4 else:bb5 fallthrough=bb3 -bb4: - predecessor blocks: bb2 - [6] Const mutate x$1$16 = read a$9 - [7] Reassign mutate x$0$18_@0[5:10] = read x$1$16 - [7] Goto bb3 -bb5: - predecessor blocks: bb2 - [8] Const mutate x$2$17 = read b$10 - [9] Reassign mutate x$0$18_@0[5:10] = read x$2$17 - [9] Goto bb3 -bb3: - predecessor blocks: bb4 bb5 - [10] read x$0$18_@0 - [11] Goto bb1 -bb6: - predecessor blocks: bb0 - [12] Const mutate $19:TPrimitive = true - [13] Let mutate x$3$22_@1[13:18] = undefined - [13] If (read $19:TPrimitive) then:bb8 else:bb9 fallthrough=bb7 -bb8: - predecessor blocks: bb6 - [14] Const mutate x$4$20 = read c$11 - [15] Reassign mutate x$3$22_@1[13:18] = read x$4$20 - [15] Goto bb7 -bb9: - predecessor blocks: bb6 - [16] Const mutate x$5$21 = read d$12 - [17] Reassign mutate x$3$22_@1[13:18] = read x$5$21 - [17] Goto bb7 -bb7: - predecessor blocks: bb8 bb9 - [18] read x$3$22_@1 - [19] Goto bb1 -bb1: - predecessor blocks: bb3 bb7 - [20] Return -``` - -## Reactive Scopes - -``` -function foo( - a, - b, - c, - d, -) { - [1] Const mutate x$13:TPrimitive = 0 - [2] Const mutate $14:TPrimitive = true - if (read $14:TPrimitive) { - [4] Const mutate $15:TPrimitive = true - scope @0 [5:10] deps=[read a$9, read b$10] out=[x$0$18_@0] { - [5] Let mutate x$0$18_@0[5:10] = undefined - if (read $15:TPrimitive) { - [6] Const mutate x$1$16 = read a$9 - [7] Reassign mutate x$0$18_@0[5:10] = read x$1$16 - } else { - [8] Const mutate x$2$17 = read b$10 - [9] Reassign mutate x$0$18_@0[5:10] = read x$2$17 - } - } - [10] read x$0$18_@0 - } else { - [12] Const mutate $19:TPrimitive = true - scope @1 [13:18] deps=[read c$11, read d$12] out=[x$3$22_@1] { - [13] Let mutate x$3$22_@1[13:18] = undefined - if (read $19:TPrimitive) { - [14] Const mutate x$4$20 = read c$11 - [15] Reassign mutate x$3$22_@1[13:18] = read x$4$20 - } else { - [16] Const mutate x$5$21 = read d$12 - [17] Reassign mutate x$3$22_@1[13:18] = read x$5$21 - } - } - [18] read x$3$22_@1 - } - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md index b292e564f2..4adef0148b 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md @@ -16,55 +16,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Const mutate y$5:TPrimitive = 2 - [2] Const mutate $6:TPrimitive = 1 - [3] Const mutate $7:TPrimitive = Binary read y$5:TPrimitive > read $6:TPrimitive - [4] Let mutate y$0$10_@0[4:9] = undefined - [4] If (read $7:TPrimitive) then:bb2 else:bb3 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [5] Const mutate y$1$8:TPrimitive = 1 - [6] Reassign mutate y$0$10_@0[4:9] = read y$1$8:TPrimitive - [6] Goto bb1 -bb3: - predecessor blocks: bb0 - [7] Const mutate y$2$9:TPrimitive = 2 - [8] Reassign mutate y$0$10_@0[4:9] = read y$2$9:TPrimitive - [8] Goto bb1 -bb1: - predecessor blocks: bb2 bb3 - [9] Const mutate x$11 = read y$0$10_@0 - [10] Return -``` - -## Reactive Scopes - -``` -function foo( -) { - [1] Const mutate y$5:TPrimitive = 2 - [2] Const mutate $6:TPrimitive = 1 - [3] Const mutate $7:TPrimitive = Binary read y$5:TPrimitive > read $6:TPrimitive - scope @0 [4:9] deps=[] out=[y$0$10_@0] { - [4] Let mutate y$0$10_@0[4:9] = undefined - if (read $7:TPrimitive) { - [5] Const mutate y$1$8:TPrimitive = 1 - [6] Reassign mutate y$0$10_@0[4:9] = read y$1$8:TPrimitive - } else { - [7] Const mutate y$2$9:TPrimitive = 2 - [8] Reassign mutate y$0$10_@0[4:9] = read y$2$9:TPrimitive - } - } - [9] Const mutate x$11 = read y$0$10_@0 - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-simple.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-simple.expect.md index 47485853fe..0048cc265f 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-simple.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-simple.expect.md @@ -9,27 +9,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$3:TPrimitive = 1 - [2] Const mutate y$4:TPrimitive = 2 - [3] Return -``` - -## Reactive Scopes - -``` -function foo( -) { - [1] Const mutate x$3:TPrimitive = 1 - [2] Const mutate y$4:TPrimitive = 2 - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-single-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-single-if.expect.md index 2619499ef9..beddb0e8a0 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-single-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-single-if.expect.md @@ -13,37 +13,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$4:TPrimitive = 1 - [2] Const mutate y$5:TPrimitive = 2 - [3] If (read y$5:TPrimitive) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [4] Const mutate z$6:TPrimitive = Binary read x$4:TPrimitive + read y$5:TPrimitive - [5] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [6] Return -``` - -## Reactive Scopes - -``` -function foo( -) { - [1] Const mutate x$4:TPrimitive = 1 - [2] Const mutate y$5:TPrimitive = 2 - if (read y$5:TPrimitive) { - [4] Const mutate z$6:TPrimitive = Binary read x$4:TPrimitive + read y$5:TPrimitive - } - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md index b19e4ccfb7..6fd1c884fe 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md @@ -24,83 +24,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$10:TPrimitive = 1 - [2] Const mutate $11:TPrimitive = 2 - [3] Const mutate $12:TPrimitive = Binary read x$10:TPrimitive === read $11:TPrimitive - [4] Const mutate $13:TPrimitive = 1 - [5] Const mutate $14:TPrimitive = Binary read x$10:TPrimitive === read $13:TPrimitive - [6] Let mutate x$0$21_@0[6:16] = undefined - [6] Switch (read x$10:TPrimitive) - Case read $14:TPrimitive: bb5 - Case read $12:TPrimitive: bb3 - Default: bb2 - Fallthrough: bb1 -bb5: - predecessor blocks: bb0 - [7] Const mutate $15:TPrimitive = 1 - [8] Const mutate x$1$16:TPrimitive = Binary read x$10:TPrimitive + read $15:TPrimitive - [9] Reassign mutate x$0$21_@0[6:16] = read x$1$16:TPrimitive - [9] Goto bb1 -bb3: - predecessor blocks: bb0 - [10] Const mutate $17:TPrimitive = 2 - [11] Const mutate x$2$18:TPrimitive = Binary read x$10:TPrimitive + read $17:TPrimitive - [12] Reassign mutate x$0$21_@0[6:16] = read x$2$18:TPrimitive - [12] Goto bb1 -bb2: - predecessor blocks: bb0 - [13] Const mutate $19:TPrimitive = 3 - [14] Const mutate x$3$20:TPrimitive = Binary read x$10:TPrimitive + read $19:TPrimitive - [15] Reassign mutate x$0$21_@0[6:16] = read x$3$20:TPrimitive - [15] Goto bb1 -bb1: - predecessor blocks: bb5 bb3 bb2 - [16] Const mutate y$22 = read x$0$21_@0 - [17] Return -``` - -## Reactive Scopes - -``` -function foo( -) { - [1] Const mutate x$10:TPrimitive = 1 - [2] Const mutate $11:TPrimitive = 2 - [3] Const mutate $12:TPrimitive = Binary read x$10:TPrimitive === read $11:TPrimitive - [4] Const mutate $13:TPrimitive = 1 - [5] Const mutate $14:TPrimitive = Binary read x$10:TPrimitive === read $13:TPrimitive - scope @0 [6:16] deps=[] out=[x$0$21_@0] { - [6] Let mutate x$0$21_@0[6:16] = undefined - switch (read x$10:TPrimitive) { - case read $14:TPrimitive: { - [7] Const mutate $15:TPrimitive = 1 - [8] Const mutate x$1$16:TPrimitive = Binary read x$10:TPrimitive + read $15:TPrimitive - [9] Reassign mutate x$0$21_@0[6:16] = read x$1$16:TPrimitive - break bb1 - } - case read $12:TPrimitive: { - [10] Const mutate $17:TPrimitive = 2 - [11] Const mutate x$2$18:TPrimitive = Binary read x$10:TPrimitive + read $17:TPrimitive - [12] Reassign mutate x$0$21_@0[6:16] = read x$2$18:TPrimitive - break bb1 - } - default: { - [13] Const mutate $19:TPrimitive = 3 - [14] Const mutate x$3$20:TPrimitive = Binary read x$10:TPrimitive + read $19:TPrimitive - [15] Reassign mutate x$0$21_@0[6:16] = read x$3$20:TPrimitive - } - } - } - [16] Const mutate y$22 = read x$0$21_@0 - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-throw.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-throw.expect.md index 0583161d7a..af7d8fb324 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-throw.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-throw.expect.md @@ -12,45 +12,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$4:TPrimitive = 1 - [2] Const mutate $5:TPrimitive = 1 - [3] Const mutate $6:TPrimitive = Binary read x$4:TPrimitive === read $5:TPrimitive - [4] Let mutate x$0$8_@0[1:7] = read x$4:TPrimitive - [4] If (read $6:TPrimitive) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [5] Const mutate x$1$7:TPrimitive = 2 - [6] Reassign mutate x$0$8_@0[1:7] = read x$1$7:TPrimitive - [6] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [7] Throw read x$0$8_@0 -``` - -## Reactive Scopes - -``` -function foo( -) { - [1] Const mutate x$4:TPrimitive = 1 - [2] Const mutate $5:TPrimitive = 1 - [3] Const mutate $6:TPrimitive = Binary read x$4:TPrimitive === read $5:TPrimitive - scope @0 [1:7] deps=[] out=[x$0$8_@0] { - [4] Let mutate x$0$8_@0[1:7] = read x$4:TPrimitive - if (read $6:TPrimitive) { - [5] Const mutate x$1$7:TPrimitive = 2 - [6] Reassign mutate x$0$8_@0[1:7] = read x$1$7:TPrimitive - } - } - throw read x$0$8_@0 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-while-no-reassign.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-while-no-reassign.expect.md index 58008a3ad1..cd0bc70b96 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-while-no-reassign.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-while-no-reassign.expect.md @@ -13,46 +13,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$5:TPrimitive = 1 - [2] While test=bb1 loop=bb3 fallthrough=bb2 -bb1: - predecessor blocks: bb0 bb3 - [3] Const mutate $6:TPrimitive = 10 - [4] Const mutate $8:TPrimitive = Binary read x$5:TPrimitive < read $6:TPrimitive - [5] If (read $8:TPrimitive) then:bb3 else:bb2 fallthrough=bb2 -bb3: - predecessor blocks: bb1 - [6] Const mutate $9:TPrimitive = 1 - [7] Binary read x$5:TPrimitive + read $9:TPrimitive - [8] Goto(Continue) bb1 -bb2: - predecessor blocks: bb1 - [9] Return read x$5:TPrimitive -``` - -## Reactive Scopes - -``` -function foo( -) { - [1] Const mutate x$5:TPrimitive = 1 - while ( - [3] Const mutate $6:TPrimitive = 10 - [4] Const mutate $8:TPrimitive = Binary read x$5:TPrimitive < read $6:TPrimitive - read $8:TPrimitive - ) { - [6] Const mutate $9:TPrimitive = 1 - [7] Binary read x$5:TPrimitive + read $9:TPrimitive - } - return read x$5:TPrimitive -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-while.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-while.expect.md index e90c59d658..609b5bd489 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-while.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-while.expect.md @@ -13,48 +13,6 @@ function foo() { ``` -## HIR - -``` -bb0: - [1] Let mutate x$5_@0:TPrimitive[1:9] = 1 - [2] While test=bb1 loop=bb3 fallthrough=bb2 -bb1: - predecessor blocks: bb0 bb3 - [3] Const mutate $6:TPrimitive = 10 - [4] Const mutate $8:TPrimitive = Binary read x$5_@0:TPrimitive < read $6:TPrimitive - [5] If (read $8:TPrimitive) then:bb3 else:bb2 fallthrough=bb2 -bb3: - predecessor blocks: bb1 - [6] Const mutate $9:TPrimitive = 1 - [7] Reassign mutate x$5_@0:TPrimitive[1:9] = Binary read x$5_@0:TPrimitive + read $9:TPrimitive - [8] Goto(Continue) bb1 -bb2: - predecessor blocks: bb1 - [9] Return read x$5_@0:TPrimitive -``` - -## Reactive Scopes - -``` -function foo( -) { - scope @0 [1:9] deps=[] out=[x$5_@0] { - [1] Let mutate x$5_@0:TPrimitive[1:9] = 1 - while ( - [3] Const mutate $6:TPrimitive = 10 - [4] Const mutate $8:TPrimitive = Binary read x$5_@0:TPrimitive < read $6:TPrimitive - read $8:TPrimitive - ) { - [6] Const mutate $9:TPrimitive = 1 - [7] Reassign mutate x$5_@0:TPrimitive[1:9] = Binary read x$5_@0:TPrimitive + read $9:TPrimitive - } - } - return read x$5_@0:TPrimitive -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md b/compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md index ec5464ca79..cf9fddbb82 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md @@ -28,87 +28,6 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$10_@1[1:12] = Array [] - [2] Const mutate y$11:TPrimitive = undefined - [3] Const mutate $12:TPrimitive = false - [4] Const mutate $13:TPrimitive = true - [5] Const mutate $14:TPrimitive = 1 - [6] Let mutate y$0$20_@1[1:12] = read y$11:TPrimitive - [6] Switch (read props$9.p0) - Case read $14:TPrimitive: bb1 - Case read $13:TPrimitive: bb6 - Default: bb1 - Case read $12:TPrimitive: bb2 - Fallthrough: bb1 -bb6: - predecessor blocks: bb0 - [7] Call mutate x$10_@1.push(read props$9.p2) - [8] Const mutate y$1$15_@2 = Array [] - [9] Reassign mutate y$0$20_@1[1:12] = read y$1$15_@2 - [9] Goto bb1 -bb2: - predecessor blocks: bb0 - [10] Const mutate y$2$16 = read x$10_@1 - [11] Reassign mutate y$0$20_@1[1:12] = read y$2$16 - [11] Goto bb1 -bb1: - predecessor blocks: bb0 bb6 bb2 - [12] Const mutate child$19_@3 = JSX - [13] Call read y$0$20_@1.push(read props$9.p4) - [14] Const mutate t8$22_@4 = JSX {read child$19_@3} - [15] Return read t8$22_@4 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - scope @1 [1:12] deps=[read props$9.p0, read props$9.p2] out=[x$10_@1] { - [1] Const mutate x$10_@1[1:12] = Array [] - [2] Const mutate y$11:TPrimitive = undefined - [3] Const mutate $12:TPrimitive = false - [4] Const mutate $13:TPrimitive = true - [5] Const mutate $14:TPrimitive = 1 - [6] Let mutate y$0$20_@1[1:12] = read y$11:TPrimitive - switch (read props$9.p0) { - case read $14:TPrimitive: { - break bb1 - } - case read $13:TPrimitive: { - [7] Call mutate x$10_@1.push(read props$9.p2) - scope @2 [8:9] deps=[] out=[y$1$15_@2] { - [8] Const mutate y$1$15_@2 = Array [] - } - [9] Reassign mutate y$0$20_@1[1:12] = read y$1$15_@2 - break bb1 - } - default: { - break bb1 - } - case read $12:TPrimitive: { - [10] Const mutate y$2$16 = read x$10_@1 - [11] Reassign mutate y$0$20_@1[1:12] = read y$2$16 - } - } - } - scope @3 [12:13] deps=[freeze x$10_@1] out=[child$19_@3] { - [12] Const mutate child$19_@3 = JSX - } - [13] Call read y$0$20_@1.push(read props$9.p4) - scope @4 [14:15] deps=[freeze y$0$20_@1, read child$19_@3] out=[$22_@4] { - [14] Const mutate $22_@4 = JSX {read child$19_@3} - } - return read $22_@4 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/switch-with-fallthrough.expect.md b/compiler/forget/src/__tests__/fixtures/hir/switch-with-fallthrough.expect.md index cf42c9da17..ff95fe5002 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/switch-with-fallthrough.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/switch-with-fallthrough.expect.md @@ -32,98 +32,6 @@ function foo(x) { ``` -## HIR - -``` -bb0: - [1] Const mutate y$10:TPrimitive = undefined - [2] Const mutate $11:TPrimitive = 5 - [3] Const mutate $12:TPrimitive = 4 - [4] Const mutate $13:TPrimitive = 3 - [5] Const mutate $14:TPrimitive = 2 - [6] Const mutate $15:TPrimitive = 1 - [7] Const mutate $16:TPrimitive = 0 - [8] Switch (read x$9) - Case read $16:TPrimitive: bb10 - Case read $15:TPrimitive: bb9 - Case read $14:TPrimitive: bb1 - Case read $13:TPrimitive: bb5 - Case read $12:TPrimitive: bb4 - Case read $11:TPrimitive: bb3 - Default: bb2 - Fallthrough: bb1 -bb10: - predecessor blocks: bb0 - [9] Const mutate y$0$17:TPrimitive = 0 - [10] Goto bb9 -bb9: - predecessor blocks: bb10 bb0 - [11] Const mutate y$1$18:TPrimitive = 1 - [12] Goto bb1 -bb5: - predecessor blocks: bb0 - [13] Const mutate y$2$19:TPrimitive = 3 - [14] Goto bb1 -bb4: - predecessor blocks: bb0 - [15] Const mutate y$3$20:TPrimitive = 4 - [16] Goto bb3 -bb3: - predecessor blocks: bb4 bb0 - [17] Const mutate y$4$21:TPrimitive = 5 - [18] Goto bb2 -bb2: - predecessor blocks: bb3 bb0 - [19] Const mutate y$5$22:TPrimitive = 0 - [20] Goto bb1 -bb1: - predecessor blocks: bb9 bb0 bb5 bb2 - [21] Return -``` - -## Reactive Scopes - -``` -function foo( - x, -) { - [1] Const mutate y$10:TPrimitive = undefined - [2] Const mutate $11:TPrimitive = 5 - [3] Const mutate $12:TPrimitive = 4 - [4] Const mutate $13:TPrimitive = 3 - [5] Const mutate $14:TPrimitive = 2 - [6] Const mutate $15:TPrimitive = 1 - [7] Const mutate $16:TPrimitive = 0 - switch (read x$9) { - case read $16:TPrimitive: { - [9] Const mutate y$0$17:TPrimitive = 0 - } - case read $15:TPrimitive: { - [11] Const mutate y$1$18:TPrimitive = 1 - break bb1 - } - case read $14:TPrimitive: { - break bb1 - } - case read $13:TPrimitive: { - [13] Const mutate y$2$19:TPrimitive = 3 - break bb1 - } - case read $12:TPrimitive: { - [15] Const mutate y$3$20:TPrimitive = 4 - } - case read $11:TPrimitive: { - [17] Const mutate y$4$21:TPrimitive = 5 - } - default: { - [19] Const mutate y$5$22:TPrimitive = 0 - } - } - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/switch.expect.md b/compiler/forget/src/__tests__/fixtures/hir/switch.expect.md index efcd01c369..c9b86b3e34 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/switch.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/switch.expect.md @@ -23,75 +23,6 @@ function Component(props) { ``` -## HIR - -``` -bb0: - [1] Const mutate x$9_@1[1:12] = Array [] - [2] Const mutate y$10:TPrimitive = undefined - [3] Const mutate $11:TPrimitive = false - [4] Const mutate $12:TPrimitive = true - [5] Let mutate y$0$20_@1[1:12] = read y$10:TPrimitive - [5] Switch (read props$8.p0) - Case read $12:TPrimitive: bb4 - Case read $11:TPrimitive: bb2 - Default: bb1 - Fallthrough: bb1 -bb4: - predecessor blocks: bb0 - [6] Call mutate x$9_@1.push(read props$8.p2) - [7] Call mutate x$9_@1.push(read props$8.p3) - [8] Const mutate y$1$13_@2 = Array [] - [9] Goto bb2 -bb2: - predecessor blocks: bb4 bb0 - [10] Const mutate y$2$15 = read x$9_@1 - [11] Reassign mutate y$0$20_@1[1:12] = read y$2$15 - [11] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [12] Const mutate child$19_@3 = JSX - [13] Call read y$0$20_@1.push(read props$8.p4) - [14] Const mutate t8$23_@4 = JSX {read child$19_@3} - [15] Return read t8$23_@4 -``` - -## Reactive Scopes - -``` -function Component( - props, -) { - scope @1 [1:12] deps=[read props$8.p0, read props$8.p2, read props$8.p3] out=[x$9_@1] { - [1] Const mutate x$9_@1[1:12] = Array [] - [2] Const mutate y$10:TPrimitive = undefined - [3] Const mutate $11:TPrimitive = false - [4] Const mutate $12:TPrimitive = true - [5] Let mutate y$0$20_@1[1:12] = read y$10:TPrimitive - switch (read props$8.p0) { - case read $12:TPrimitive: { - [6] Call mutate x$9_@1.push(read props$8.p2) - [7] Call mutate x$9_@1.push(read props$8.p3) - [8] Const mutate y$1$13_@2 = Array [] - } - case read $11:TPrimitive: { - [10] Const mutate y$2$15 = read x$9_@1 - [11] Reassign mutate y$0$20_@1[1:12] = read y$2$15 - } - } - } - scope @3 [12:13] deps=[freeze x$9_@1] out=[child$19_@3] { - [12] Const mutate child$19_@3 = JSX - } - [13] Call read y$0$20_@1.push(read props$8.p4) - scope @4 [14:15] deps=[read y$0$20_@1, read child$19_@3] out=[$23_@4] { - [14] Const mutate $23_@4 = JSX {read child$19_@3} - } - return read $23_@4 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/transitive-alias-fields.expect.md b/compiler/forget/src/__tests__/fixtures/hir/transitive-alias-fields.expect.md index 66cc11bd6a..5d540b365e 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/transitive-alias-fields.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/transitive-alias-fields.expect.md @@ -17,39 +17,6 @@ function component() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$6_@0:TObject[1:9] = Object { } - [2] Const mutate p$7_@0:TObject[1:9] = Object { } - [3] Const mutate q$8_@0:TObject[1:9] = Object { } - [4] Const mutate y$9_@0:TObject[1:9] = Object { } - [5] Reassign store x$6_@0.y[1:9] = read y$9_@0:TObject - [6] Reassign store p$7_@0.y[1:9] = read x$6_@0.y - [7] Reassign store q$8_@0.y[1:9] = read p$7_@0.y - [8] Call mutate mutate$5:TFunction(mutate q$8_@0:TObject) - [9] Return -``` - -## Reactive Scopes - -``` -function component( -) { - [1] Const mutate x$6_@0:TObject[1:9] = Object { } - [2] Const mutate p$7_@0:TObject[1:9] = Object { } - [3] Const mutate q$8_@0:TObject[1:9] = Object { } - [4] Const mutate y$9_@0:TObject[1:9] = Object { } - [5] Reassign store x$6_@0.y[1:9] = read y$9_@0:TObject - [6] Reassign store p$7_@0.y[1:9] = read x$6_@0.y - [7] Reassign store q$8_@0.y[1:9] = read p$7_@0.y - [8] Call mutate mutate$5:TFunction(mutate q$8_@0:TObject) - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-args-test-binary-operator.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-args-test-binary-operator.expect.md index 52daf83ed3..16c53f63f1 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-args-test-binary-operator.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-args-test-binary-operator.expect.md @@ -10,37 +10,6 @@ function component(a, b) { ``` -## HIR - -``` -bb0: - [1] Const mutate $7:TPrimitive = Binary read a$5:TPrimitive > read b$6:TPrimitive - [2] If (read $7:TPrimitive) then:bb2 else:bb1 fallthrough=bb1 -bb2: - predecessor blocks: bb0 - [3] Const mutate m$8_@0:TObject = Object { } - [4] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [5] Return -``` - -## Reactive Scopes - -``` -function component( - a, - b, -) { - [1] Const mutate $7:TPrimitive = Binary read a$5:TPrimitive > read b$6:TPrimitive - if (read $7:TPrimitive) { - [3] Const mutate m$8_@0:TObject = Object { } - } - return -} - -``` - ## Code ```javascript 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 b1ef3ccee2..420043600c 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 @@ -12,43 +12,6 @@ function component() { ``` -## HIR - -``` -bb0: - [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: - predecessor blocks: bb0 - [5] Const mutate m$10_@2:TObject = Object { } - [6] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [7] Return -``` - -## Reactive Scopes - -``` -function component( -) { - scope @0 [1:2] deps=[] out=[a$7_@0] { - [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$3:TFunction() - } - [3] Const mutate $9:TPrimitive = Binary read a$7_@0:TPrimitive > read b$8_@1:TPrimitive - if (read $9:TPrimitive) { - [5] Const mutate m$10_@2:TObject = Object { } - } - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-field-load.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-field-load.expect.md index 77d7817aae..7fc092019f 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-field-load.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-field-load.expect.md @@ -9,31 +9,6 @@ function component() { ``` -## HIR - -``` -bb0: - [1] Const mutate $4:TPrimitive = 1 - [2] Const mutate x$5_@0:TObject = Object { t: read $4:TPrimitive } - [3] Const mutate p$6 = read x$5_@0.t - [4] Return -``` - -## Reactive Scopes - -``` -function component( -) { - [1] Const mutate $4:TPrimitive = 1 - scope @0 [2:3] deps=[] out=[x$5_@0] { - [2] Const mutate x$5_@0:TObject = Object { t: read $4:TPrimitive } - } - [3] Const mutate p$6 = read x$5_@0.t - return -} - -``` - ## Code ```javascript 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 ca714bfe91..e5fc36fb50 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 @@ -15,50 +15,6 @@ function component() { ``` -## HIR - -``` -bb0: - [1] Const mutate t0$10_@0 = Call mutate makeSomePrimitive$1:TFunction() - [2] Const mutate t1$11_@1 = Call mutate makeSomePrimitive$1:TFunction() - [3] Const mutate x$12_@2:TObject = Object { u: read t0$10_@0, v: read t1$11_@1 } - [4] Const mutate u$13:TPrimitive = read x$12_@2.u - [5] Const mutate v$14:TPrimitive = read x$12_@2.v - [6] Const mutate $15:TPrimitive = Binary read u$13:TPrimitive > read v$14:TPrimitive - [7] If (read $15:TPrimitive) then:bb1 else:bb1 fallthrough=bb1 -bb1: - predecessor blocks: bb0 - [8] Const mutate y$16 = read x$12_@2.u - [9] Const mutate z$17 = read x$12_@2.v - [10] Return -``` - -## Reactive Scopes - -``` -function component( -) { - scope @0 [1:2] deps=[] out=[$10_@0] { - [1] Const mutate $10_@0 = Call mutate makeSomePrimitive$1:TFunction() - } - scope @1 [2:3] deps=[] out=[$11_@1] { - [2] Const mutate $11_@1 = Call mutate makeSomePrimitive$1:TFunction() - } - scope @2 [3:4] deps=[read $10_@0, read $11_@1] out=[x$12_@2] { - [3] Const mutate x$12_@2:TObject = Object { u: read $10_@0, v: read $11_@1 } - } - [4] Const mutate u$13:TPrimitive = read x$12_@2.u - [5] Const mutate v$14:TPrimitive = read x$12_@2.v - [6] Const mutate $15:TPrimitive = Binary read u$13:TPrimitive > read v$14:TPrimitive - if (read $15:TPrimitive) { - } - [8] Const mutate y$16 = read x$12_@2.u - [9] Const mutate z$17 = read x$12_@2.v - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-test-field-store.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-test-field-store.expect.md index d39c486c66..be26203e25 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-test-field-store.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-test-field-store.expect.md @@ -11,35 +11,6 @@ function component() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$4_@0:TObject[1:4] = Object { } - [2] Const mutate q$5_@1:TObject = Object { } - [3] Reassign store x$4_@0.t[1:4] = read q$5_@1:TObject - [4] Const mutate z$6 = read x$4_@0.t - [5] Return -``` - -## Reactive Scopes - -``` -function component( -) { - scope @0 [1:4] deps=[] out=[x$4_@0] { - [1] Const mutate x$4_@0:TObject[1:4] = Object { } - scope @1 [2:3] deps=[] out=[q$5_@1] { - [2] Const mutate q$5_@1:TObject = Object { } - } - [3] Reassign store x$4_@0.t[1:4] = read q$5_@1:TObject - } - [4] Const mutate z$6 = read x$4_@0.t - return -} - -``` - ## Code ```javascript 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 9f7f44bce2..8b98fb4d11 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 @@ -18,45 +18,6 @@ function component() { ``` -## HIR - -``` -bb0: - [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 { } - [5] Reassign store x$9_@2.t[4:8] = read p$7_@0:TPrimitive - [6] Const mutate z$10_@2[4:8] = read x$9_@2.t - [7] Reassign store x$9_@2.t[4:8] = read o$8_@1:TObject - [8] Const mutate y$11 = read x$9_@2.t - [9] Return -``` - -## Reactive Scopes - -``` -function component( -) { - scope @0 [1:2] deps=[] out=[p$7_@0] { - [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] { - [3] Const mutate o$8_@1:TObject = Object { } - } - scope @2 [4:8] deps=[read p$7_@0:TPrimitive, read o$8_@1:TObject] out=[x$9_@2] { - [4] Const mutate x$9_@2:TObject[4:8] = Object { } - [5] Reassign store x$9_@2.t[4:8] = read p$7_@0:TPrimitive - [6] Const mutate z$10_@2[4:8] = read x$9_@2.t - [7] Reassign store x$9_@2.t[4:8] = read o$8_@1:TObject - } - [8] Const mutate y$11 = read x$9_@2.t - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-test-primitive.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-test-primitive.expect.md index e9cf4c3e73..12b481767a 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-test-primitive.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-test-primitive.expect.md @@ -9,27 +9,6 @@ function component() { ``` -## HIR - -``` -bb0: - [1] Const mutate x$3:TPrimitive = 1 - [2] Const mutate y$4:TPrimitive = 2 - [3] Return -``` - -## Reactive Scopes - -``` -function component( -) { - [1] Const mutate x$3:TPrimitive = 1 - [2] Const mutate y$4:TPrimitive = 2 - return -} - -``` - ## Code ```javascript 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 6e77c29d30..d8cb32a74f 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 @@ -14,45 +14,6 @@ function component() { ``` -## HIR - -``` -bb0: - [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: - predecessor blocks: bb0 - [5] Const mutate z$10_@2:TObject = Object { } - [6] Goto bb1 -bb1: - predecessor blocks: bb2 bb0 - [7] Const mutate z$12_@3 = Call mutate foo$1:TFunction() - [8] Return -``` - -## Reactive Scopes - -``` -function component( -) { - scope @0 [1:2] deps=[] out=[x$7_@0] { - [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$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$1:TFunction() - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/while-break.expect.md b/compiler/forget/src/__tests__/fixtures/hir/while-break.expect.md index d48f04bc52..c30a5a1e8d 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/while-break.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/while-break.expect.md @@ -11,36 +11,6 @@ function foo(a, b) { ``` -## HIR - -``` -bb0: - [1] While test=bb1 loop=bb2 fallthrough=bb2 -bb1: - predecessor blocks: bb0 - [2] If (read a$3) then:bb2 else:bb2 fallthrough=bb2 -bb2: - predecessor blocks: bb1 - [3] Return read b$4 -``` - -## Reactive Scopes - -``` -function foo( - a, - b, -) { - while ( - read a$3 - ) { - break - } - return read b$4 -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/fixtures/hir/while-conditional-continue.expect.md b/compiler/forget/src/__tests__/fixtures/hir/while-conditional-continue.expect.md index 90d1b0c572..6d77095113 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/while-conditional-continue.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/while-conditional-continue.expect.md @@ -15,53 +15,6 @@ function foo(a, b, c, d) { ``` -## HIR - -``` -bb0: - [1] While test=bb1 loop=bb3 fallthrough=bb2 -bb1: - predecessor blocks: bb0 bb5 bb4 - [2] If (read a$5) then:bb3 else:bb2 fallthrough=bb2 -bb3: - predecessor blocks: bb1 - [3] If (read b$6) then:bb5 else:bb4 fallthrough=bb4 -bb5: - predecessor blocks: bb3 - [4] Goto(Continue) bb1 -bb4: - predecessor blocks: bb3 - [5] Call read c$7:TFunction() - [6] Goto(Continue) bb1 -bb2: - predecessor blocks: bb1 - [7] Call read d$8:TFunction() - [8] Return -``` - -## Reactive Scopes - -``` -function foo( - a, - b, - c, - d, -) { - while ( - read a$5 - ) { - if (read b$6) { - continue - } - [5] Call read c$7:TFunction() - } - [7] Call read d$8:TFunction() - return -} - -``` - ## Code ```javascript diff --git a/compiler/forget/src/__tests__/hir-test.ts b/compiler/forget/src/__tests__/hir-test.ts index a4cfd1e9a8..15fb7a430c 100644 --- a/compiler/forget/src/__tests__/hir-test.ts +++ b/compiler/forget/src/__tests__/hir-test.ts @@ -11,11 +11,9 @@ import generate from "@babel/generator"; import * as parser from "@babel/parser"; import traverse from "@babel/traverse"; import { wasmFolder } from "@hpcc-js/wasm"; -import invariant from "invariant"; import path from "path"; import prettier from "prettier"; import run from "../CompilerPipeline"; -import { printFunction } from "../HIR"; import { toggleLogging } from "../Utils/logger"; import generateTestsFromFixtures from "./test-utils/generateTestsFromFixtures"; @@ -101,16 +99,8 @@ ${wrapWithTripleBackticks(error.message)} } function formatOutput(items: Array): Array { - return items.map(({ ir, js, scopes }) => { + return items.map(({ js }) => { return ` -## HIR - -${wrapWithTripleBackticks(ir)} - -## Reactive Scopes - -${wrapWithTripleBackticks(scopes)} - ## Code ${wrapWithTripleBackticks(js, "javascript")} @@ -119,9 +109,7 @@ ${wrapWithTripleBackticks(js, "javascript")} } type TestOutput = { - ir: string; js: string; - scopes: string; }; function transform(text: string, file: string): Array { @@ -133,16 +121,13 @@ function transform(text: string, file: string): Array { traverse(ast, { FunctionDeclaration: { enter(nodePath) { - const { ir, scopes, ast } = run(nodePath); + const { ast } = run(nodePath); - const textHIR = printFunction(ir); - invariant(ast, "Expected an ast"); - invariant(scopes, "Expected printed scope data"); const text = prettier.format(generate(ast).code.replace("\n\n", "\n"), { semi: true, parser: "babel-ts", }); - items.push({ ir: textHIR, js: text, scopes }); + items.push({ js: text }); }, }, });