Codegen for scopes without dependencies

Completes a todo for the `if` condition of scopes without any inputs. In this 
case since there are no inputs we can check for changes, we check if the first 
_output_ cache slot is set to the sentinel. 

For this to work we need to ensure that all scopes have at least one output, 
which isn't currently the case. Dead code can produce output-less sentinels. So 
this PR also adds a pass to find scopes w/o any outputs and convert them to 
regular blocks. We could in theory also just delete them, but for now let's be 
more conservative. This is something we'd want to highlight as a diagnostic in 
an IDE, though existing dead code linters would almost certainly find this case 
too.
This commit is contained in:
Joe Savona
2022-12-20 11:06:07 -08:00
parent ae8f9066dd
commit cedaee5b03
67 changed files with 613 additions and 757 deletions
+2
View File
@@ -23,6 +23,7 @@ import {
printReactiveFunction,
propagateScopeDependencies,
pruneUnusedLabels,
pruneUnusedScopes,
} from "./ReactiveScopes";
import { eliminateRedundantPhi, enterSSA, leaveSSA } from "./SSA";
import { logHIRFunction } from "./Utils/logger";
@@ -69,6 +70,7 @@ export default function (
pruneUnusedLabels(reactiveFunction);
flattenReactiveLoops(reactiveFunction);
propagateScopeDependencies(reactiveFunction);
pruneUnusedScopes(reactiveFunction);
const scopes = printReactiveFunction(reactiveFunction);
const ast = codegenReactiveFunction(reactiveFunction);
@@ -166,8 +166,12 @@ function codegenReactiveScope(
)
);
}
let firstOutputIndex: number | null = null;
for (const output of scope.outputs) {
const index = cx.nextCacheIndex;
if (firstOutputIndex === null) {
firstOutputIndex = index;
}
// TODO @josephsavona: ensure change and temp variables have non-conflicting names
output.name ??= `t${index}`;
@@ -194,16 +198,34 @@ function codegenReactiveScope(
)
);
}
const testCondition =
(changeIdentifiers as Array<t.Expression>).reduce(
(acc: t.Expression | null, ident: t.Expression) => {
if (acc == null) {
return ident;
}
return t.logicalExpression("||", acc, ident);
},
null as t.Expression | null
) ?? t.booleanLiteral(true); // TODO @josephsavona handle case of empty dependencies
invariant(
firstOutputIndex !== null,
"Expected scope '@%s' to have at least one output",
scope.id
);
let testCondition = (changeIdentifiers as Array<t.Expression>).reduce(
(acc: t.Expression | null, ident: t.Expression) => {
if (acc == null) {
return ident;
}
return t.logicalExpression("||", acc, ident);
},
null as t.Expression | null
);
if (testCondition === null) {
testCondition = t.binaryExpression(
"===",
t.memberExpression(
t.identifier("$"),
t.numericLiteral(firstOutputIndex),
true
),
t.callExpression(
t.memberExpression(t.identifier("Symbol"), t.identifier("for")),
[t.stringLiteral("react.memo_cache_sentinel")]
)
);
}
const computationBlock = codegenBlock(cx, block);
computationBlock.body.push(...cacheStoreStatements);
@@ -0,0 +1,52 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { ReactiveBlock, ReactiveFunction } from "../HIR/HIR";
import { assertExhaustive } from "../Utils/utils";
import { mapTerminalBlocks } from "./visitors";
/**
* Converts scopes without outputs into regular blocks.
*/
export function pruneUnusedScopes(fn: ReactiveFunction): void {
fn.body = visitBlock(fn.body);
}
function visitBlock(block: ReactiveBlock): ReactiveBlock {
let nextBlock: ReactiveBlock | null = null;
for (let i = 0; i < block.length; i++) {
const stmt = block[i]!;
switch (stmt.kind) {
case "terminal": {
mapTerminalBlocks(stmt.terminal, visitBlock);
break;
}
case "instruction": {
break;
}
case "scope": {
stmt.instructions = visitBlock(stmt.instructions);
if (stmt.scope.outputs.size === 0) {
nextBlock ??= block.slice(0, i);
nextBlock.push(...stmt.instructions);
continue;
}
break;
}
default: {
assertExhaustive(
stmt,
`Unexpected statement kind '${(stmt as any).kind}'`
);
}
}
if (nextBlock !== null) {
nextBlock.push(stmt);
}
}
return nextBlock ?? block;
}
@@ -13,3 +13,4 @@ export { inferReactiveScopeVariables } from "./InferReactiveScopeVariables";
export { printReactiveFunction } from "./PrintReactiveFunction";
export { propagateScopeDependencies } from "./PropagateScopeDependencies";
export { pruneUnusedLabels } from "./PruneUnusedLabels";
export { pruneUnusedScopes } from "./PruneUnusedScopes";
@@ -0,0 +1,52 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { ReactiveBlock, ReactiveTerminal } from "../HIR/HIR";
import { assertExhaustive } from "../Utils/utils";
export function mapTerminalBlocks(
terminal: ReactiveTerminal,
fn: (block: ReactiveBlock) => ReactiveBlock
): void {
switch (terminal.kind) {
case "break":
case "continue":
case "return":
case "throw": {
break;
}
case "for": {
terminal.loop = fn(terminal.loop);
break;
}
case "while": {
terminal.loop = fn(terminal.loop);
break;
}
case "if": {
terminal.consequent = fn(terminal.consequent);
if (terminal.alternate !== null) {
terminal.alternate = fn(terminal.alternate);
}
break;
}
case "switch": {
for (const case_ of terminal.cases) {
if (case_.block !== undefined) {
case_.block = fn(case_.block);
}
}
break;
}
default: {
assertExhaustive(
terminal,
`Unexpected terminal kind '${(terminal as any).kind}'`
);
}
}
}
@@ -43,15 +43,13 @@ bb1:
function Component(
props,
) {
scope @0 [1:7] deps=[read props$3.a, read props$3.b, read props$3.d, read props$3.c] out=[] {
[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)
[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)
}
```
@@ -60,27 +58,14 @@ function Component(
```javascript
function Component$0(props$3) {
const $ = React.useMemoCache();
const c_0 = $[0] !== props$3.a;
const c_1 = $[1] !== props$3.b;
const c_2 = $[2] !== props$3.d;
const c_3 = $[3] !== props$3.c;
if (c_0 || c_1 || c_2 || c_3) {
const a$4 = [];
a$4.push(props$3.a);
if (props$3.b) {
a$4.push(props$3.d);
return a$4;
}
a$4.push(props$3.c);
$[0] = props$3.a;
$[1] = props$3.b;
$[2] = props$3.d;
$[3] = props$3.c;
} else {
const a$4 = [];
a$4.push(props$3.a);
if (props$3.b) {
a$4.push(props$3.d);
return a$4;
}
a$4.push(props$3.c);
}
```
@@ -31,14 +31,12 @@ bb0:
```
function component(
) {
scope @0 [1:7] deps=[] out=[] {
[1] Const mutate z$5_@0[1:7] = Array []
[2] Const mutate y$6_@0:TObject[1:7] = Object { }
[3] Reassign mutate y$6_@0.z[1:7] = read z$5_@0
[4] Const mutate x$7_@0:TObject[1:7] = Object { }
[5] Reassign mutate x$7_@0.y[1:7] = read y$6_@0:TObject
[6] Call mutate mutate$4:TFunction(mutate x$7_@0.y.z)
}
[1] Const mutate z$5_@0[1:7] = Array []
[2] Const mutate y$6_@0:TObject[1:7] = Object { }
[3] Reassign mutate y$6_@0.z[1:7] = read z$5_@0
[4] Const mutate x$7_@0:TObject[1:7] = Object { }
[5] Reassign mutate x$7_@0.y[1:7] = read y$6_@0:TObject
[6] Call mutate mutate$4:TFunction(mutate x$7_@0.y.z)
return
}
@@ -48,15 +46,12 @@ function component(
```javascript
function component$0() {
if (true) {
const z$5 = [];
const y$6 = {};
y$6.z = z$5;
const x$7 = {};
x$7.y = y$6;
mutate$4(x$7.y.z);
} else {
}
const z$5 = [];
const y$6 = {};
y$6.z = z$5;
const x$7 = {};
x$7.y = y$6;
mutate$4(x$7.y.z);
}
```
@@ -52,7 +52,7 @@ function component(
function component$0() {
const $ = React.useMemoCache();
let z$4;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
z$4 = [];
$[0] = z$4;
} else {
@@ -76,11 +76,9 @@ function g(
a,
) {
[1] Const mutate $5:TPrimitive = 1
scope @0 [0:5] deps=[] out=[] {
[2] Reassign mutate a$4_@0.b.c[0:5] = Binary read a$4_@0.b.c + read $5:TPrimitive
[3] Const mutate $6:TPrimitive = 2
[4] Reassign mutate a$4_@0.b.c[0:5] = Binary read a$4_@0.b.c * read $6:TPrimitive
}
[2] Reassign mutate a$4_@0.b.c[0:5] = Binary read a$4_@0.b.c + read $5:TPrimitive
[3] Const mutate $6:TPrimitive = 2
[4] Reassign mutate a$4_@0.b.c[0:5] = Binary read a$4_@0.b.c * read $6:TPrimitive
return
}
@@ -90,11 +88,8 @@ function g(
```javascript
function g$0(a$4) {
if (true) {
a$4.c.b = a$4.b.c + 1;
a$4.c.b = a$4.b.c * 2;
} else {
}
a$4.c.b = a$4.b.c + 1;
a$4.c.b = a$4.b.c * 2;
}
```
@@ -49,8 +49,8 @@ bb0:
[5] Const mutate _$13_@1 = JSX <read $12:TPrimitive a={freeze a$10_@0} ></read $12:TPrimitive>
[6] Call mutate foo$4:TFunction(mutate b$11_@0:TObject)
[7] Const mutate $14:TPrimitive = "div"
[8] Const mutate t5$15_@2 = JSX <read $14:TPrimitive a={read a$10_@0} b={freeze b$11_@0:TObject} ></read $14:TPrimitive>
[9] Return read t5$15_@2
[8] Const mutate t4$15_@2 = JSX <read $14:TPrimitive a={read a$10_@0} b={freeze b$11_@0:TObject} ></read $14:TPrimitive>
[9] Return read t4$15_@2
```
## Reactive Scopes
@@ -64,9 +64,7 @@ function Component(
[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"
scope @1 [5:6] deps=[freeze a$10_@0] out=[] {
[5] Const mutate _$13_@1 = JSX <read $12:TPrimitive a={freeze a$10_@0} ></read $12:TPrimitive>
}
[5] Const mutate _$13_@1 = JSX <read $12:TPrimitive a={freeze a$10_@0} ></read $12:TPrimitive>
[6] Call mutate foo$4:TFunction(mutate b$11_@0:TObject)
}
[7] Const mutate $14:TPrimitive = "div"
@@ -85,18 +83,12 @@ function Component$0(props$9) {
const $ = React.useMemoCache();
let a$10;
let b$11;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
a$10 = [];
b$11 = {};
foo$4(a$10, b$11);
const c_2 = $[2] !== a$10;
if (c_2) {
const _$13 = <div a={a$10}></div>;
$[2] = a$10;
} else {
}
const _$13 = <div a={a$10}></div>;
foo$4(b$11);
$[0] = a$10;
@@ -106,20 +98,20 @@ function Component$0(props$9) {
b$11 = $[1];
}
const c_3 = $[3] !== a$10;
const c_4 = $[4] !== b$11;
let t5$15;
const c_2 = $[2] !== a$10;
const c_3 = $[3] !== b$11;
let t4$15;
if (c_3 || c_4) {
t5$15 = <div a={a$10} b={b$11}></div>;
$[3] = a$10;
$[4] = b$11;
$[5] = t5$15;
if (c_2 || c_3) {
t4$15 = <div a={a$10} b={b$11}></div>;
$[2] = a$10;
$[3] = b$11;
$[4] = t4$15;
} else {
t5$15 = $[5];
t4$15 = $[4];
}
return t5$15;
return t4$15;
}
```
@@ -374,15 +374,13 @@ bb1:
function Component(
props,
) {
scope @0 [1:7] deps=[read props$3.a, read props$3.b, read props$3.d, read props$3.c] out=[] {
[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)
[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)
}
```
@@ -391,27 +389,14 @@ function Component(
```javascript
function Component$0(props$3) {
const $ = React.useMemoCache();
const c_0 = $[0] !== props$3.a;
const c_1 = $[1] !== props$3.b;
const c_2 = $[2] !== props$3.d;
const c_3 = $[3] !== props$3.c;
if (c_0 || c_1 || c_2 || c_3) {
const a$4 = [];
a$4.push(props$3.a);
if (props$3.b) {
a$4.push(props$3.d);
return a$4;
}
a$4.push(props$3.c);
$[0] = props$3.a;
$[1] = props$3.b;
$[2] = props$3.d;
$[3] = props$3.c;
} else {
const a$4 = [];
a$4.push(props$3.a);
if (props$3.b) {
a$4.push(props$3.d);
return a$4;
}
a$4.push(props$3.c);
}
```
@@ -49,8 +49,8 @@ bb0:
[5] Const mutate _$13_@1 = JSX <read $12:TPrimitive a={freeze a$10_@0} ></read $12:TPrimitive>
[6] New mutate Foo$4(mutate b$11_@0:TObject)
[7] Const mutate $14:TPrimitive = "div"
[8] Const mutate t5$15_@2 = JSX <read $14:TPrimitive a={read a$10_@0} b={freeze b$11_@0:TObject} ></read $14:TPrimitive>
[9] Return read t5$15_@2
[8] Const mutate t4$15_@2 = JSX <read $14:TPrimitive a={read a$10_@0} b={freeze b$11_@0:TObject} ></read $14:TPrimitive>
[9] Return read t4$15_@2
```
## Reactive Scopes
@@ -64,9 +64,7 @@ function Component(
[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"
scope @1 [5:6] deps=[freeze a$10_@0] out=[] {
[5] Const mutate _$13_@1 = JSX <read $12:TPrimitive a={freeze a$10_@0} ></read $12:TPrimitive>
}
[5] Const mutate _$13_@1 = JSX <read $12:TPrimitive a={freeze a$10_@0} ></read $12:TPrimitive>
[6] New mutate Foo$4(mutate b$11_@0:TObject)
}
[7] Const mutate $14:TPrimitive = "div"
@@ -85,18 +83,12 @@ function Component$0(props$9) {
const $ = React.useMemoCache();
let a$10;
let b$11;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
a$10 = [];
b$11 = {};
new Foo$4(a$10, b$11);
const c_2 = $[2] !== a$10;
if (c_2) {
const _$13 = <div a={a$10}></div>;
$[2] = a$10;
} else {
}
const _$13 = <div a={a$10}></div>;
new Foo$4(b$11);
$[0] = a$10;
@@ -106,20 +98,20 @@ function Component$0(props$9) {
b$11 = $[1];
}
const c_3 = $[3] !== a$10;
const c_4 = $[4] !== b$11;
let t5$15;
const c_2 = $[2] !== a$10;
const c_3 = $[3] !== b$11;
let t4$15;
if (c_3 || c_4) {
t5$15 = <div a={a$10} b={b$11}></div>;
$[3] = a$10;
$[4] = b$11;
$[5] = t5$15;
if (c_2 || c_3) {
t4$15 = <div a={a$10} b={b$11}></div>;
$[2] = a$10;
$[3] = b$11;
$[4] = t4$15;
} else {
t5$15 = $[5];
t4$15 = $[4];
}
return t5$15;
return t4$15;
}
```
@@ -57,14 +57,12 @@ function foo(
}
[3] Const mutate $9:TPrimitive = "div"
[4] JSX <read $9:TPrimitive>{freeze x$8_@0}</read $9:TPrimitive>
scope @1 [5:12] deps=[read x$8_@0, read b$7] out=[] {
[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)
}
[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
}
@@ -88,23 +86,14 @@ function foo$0(a$6, b$7) {
}
<div>{x$8}</div>;
const c_2 = $[2] !== x$8;
const c_3 = $[3] !== b$7;
const y$10 = [];
if (c_2 || c_3) {
const y$10 = [];
if (x$8.length) {
y$10.push(x$8);
}
if (x$8.length) {
y$10.push(x$8);
}
if (b$7) {
y$10.push(b$7);
}
$[2] = x$8;
$[3] = b$7;
} else {
if (b$7) {
y$10.push(b$7);
}
}
@@ -52,19 +52,17 @@ function foo(
y,
z,
) {
scope @0 [1:10] deps=[read z$8, read x$6, read y$7] out=[] {
[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)
[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
}
@@ -75,38 +73,27 @@ function foo(
```javascript
function foo$0(x$6, y$7, z$8) {
const $ = React.useMemoCache();
const c_0 = $[0] !== z$8;
const c_1 = $[1] !== x$6;
const c_2 = $[2] !== y$7;
if (c_0 || c_1 || c_2) {
const items$9 = [z$8];
items$9.push(x$6);
const c_3 = $[3] !== x$6;
const c_4 = $[4] !== y$7;
let items2$10;
const items$9 = [z$8];
items$9.push(x$6);
const c_0 = $[0] !== x$6;
const c_1 = $[1] !== y$7;
let items2$10;
if (c_0 || c_1) {
items2$10 = [];
if (c_3 || c_4) {
items2$10 = [];
if (x$6) {
items2$10.push(y$7);
}
$[3] = x$6;
$[4] = y$7;
$[5] = items2$10;
} else {
items2$10 = $[5];
if (x$6) {
items2$10.push(y$7);
}
if (y$7) {
items$9.push(x$6);
}
$[0] = z$8;
$[1] = x$6;
$[2] = y$7;
$[0] = x$6;
$[1] = y$7;
$[2] = items2$10;
} else {
items2$10 = $[2];
}
if (y$7) {
items$9.push(x$6);
}
return items2$10;
@@ -56,14 +56,12 @@ function foo(
b,
c,
) {
scope @0 [1:8] deps=[read a$7, read b$8, read c$9] out=[] {
[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)
}
[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)
}
}
}
@@ -80,25 +78,13 @@ function foo(
```javascript
function foo$0(a$7, b$8, c$9) {
const $ = React.useMemoCache();
const c_0 = $[0] !== a$7;
const c_1 = $[1] !== b$8;
const c_2 = $[2] !== c$9;
if (c_0 || c_1 || c_2) {
const x$10 = [];
if (a$7) {
if (b$8) {
if (c$9) {
x$10.push(0);
}
const x$10 = [];
if (a$7) {
if (b$8) {
if (c$9) {
x$10.push(0);
}
}
$[0] = a$7;
$[1] = b$8;
$[2] = c$9;
} else {
}
if (a$7.length) {
@@ -47,7 +47,7 @@ function Component(
function Component$0() {
const $ = React.useMemoCache();
let a$5;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
a$5 = [];
$[0] = a$5;
} else {
@@ -109,7 +109,7 @@ function Component(
function Component$0(props$10) {
const $ = React.useMemoCache();
let x$11;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x$11 = [];
$[0] = x$11;
} else {
@@ -48,7 +48,7 @@ function Component(
function Component$0() {
const $ = React.useMemoCache();
let a$4;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
a$4 = [];
$[0] = a$4;
} else {
@@ -40,12 +40,10 @@ function foo(
b,
c,
) {
scope @0 [1:6] deps=[read a$5, read b$6, read c$7] out=[] {
[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)
}
[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
@@ -57,23 +55,11 @@ function foo(
```javascript
function foo$0(a$5, b$6, c$7) {
const $ = React.useMemoCache();
const c_0 = $[0] !== a$5;
const c_1 = $[1] !== b$6;
const c_2 = $[2] !== c$7;
if (c_0 || c_1 || c_2) {
const y$8 = [];
if (a$5) {
if (b$6) {
y$8.push(c$7);
}
const y$8 = [];
if (a$5) {
if (b$6) {
y$8.push(c$7);
}
$[0] = a$5;
$[1] = b$6;
$[2] = c$7;
} else {
}
}
@@ -67,7 +67,7 @@ function Foo(
function Foo$0(props$13) {
const $ = React.useMemoCache();
let t0$20;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0$20 = <>Text</>;
$[0] = t0$20;
} else {
@@ -66,7 +66,7 @@ function And(
function And$0() {
const $ = React.useMemoCache();
let t0$5;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0$5 = f$1();
$[0] = t0$5;
} else {
@@ -142,7 +142,7 @@ function Or(
function Or$0() {
const $ = React.useMemoCache();
let t0$5;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0$5 = f$1();
$[0] = t0$5;
} else {
@@ -223,7 +223,7 @@ function QuestionQuestion(
function QuestionQuestion$0(props$8) {
const $ = React.useMemoCache();
let t0$9;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0$9 = f$2();
$[0] = t0$9;
} else {
@@ -139,37 +139,35 @@ bb13:
function Component(
props,
) {
scope @0 [1:23] deps=[] out=[] {
[1] Let mutate a$18_@0[1:23] = Object { }
[2] Let mutate b$20_@0[1:23] = Object { }
[3] Let mutate c$22_@0[1:23] = Object { }
[4] Let mutate d$24_@0[1:23] = Object { }
while (
[6] Const mutate $17:TPrimitive = true
read $17:TPrimitive
) {
[8] Const mutate z$19_@0[1:23] = read a$18_@0
[9] Reassign mutate a$18_@0[1:23] = read b$20_@0
[10] Reassign mutate b$20_@0[1:23] = read c$22_@0
[11] Reassign mutate c$22_@0[1:23] = read d$24_@0
[12] Reassign mutate d$24_@0[1:23] = read z$19_@0
[13] Call mutate mutate$7:TFunction(mutate a$18_@0, mutate b$20_@0)
[14] Const mutate $29_@0[1:23] = Call mutate cond$8:TFunction(mutate a$18_@0)
if (read $29_@0) {
break
}
[1] Let mutate a$18_@0[1:23] = Object { }
[2] Let mutate b$20_@0[1:23] = Object { }
[3] Let mutate c$22_@0[1:23] = Object { }
[4] Let mutate d$24_@0[1:23] = Object { }
while (
[6] Const mutate $17:TPrimitive = true
read $17:TPrimitive
) {
[8] Const mutate z$19_@0[1:23] = read a$18_@0
[9] Reassign mutate a$18_@0[1:23] = read b$20_@0
[10] Reassign mutate b$20_@0[1:23] = read c$22_@0
[11] Reassign mutate c$22_@0[1:23] = read d$24_@0
[12] Reassign mutate d$24_@0[1:23] = read z$19_@0
[13] Call mutate mutate$7:TFunction(mutate a$18_@0, mutate b$20_@0)
[14] Const mutate $29_@0[1:23] = Call mutate cond$8:TFunction(mutate a$18_@0)
if (read $29_@0) {
break
}
if (read a$18_@0) {
}
if (read b$20_@0) {
}
if (read c$22_@0) {
}
if (read d$24_@0) {
}
[21] Const mutate $34:TPrimitive = null
[22] Call mutate mutate$7:TFunction(mutate d$24_@0, read $34:TPrimitive)
}
if (read a$18_@0) {
}
if (read b$20_@0) {
}
if (read c$22_@0) {
}
if (read d$24_@0) {
}
[21] Const mutate $34:TPrimitive = null
[22] Call mutate mutate$7:TFunction(mutate d$24_@0, read $34:TPrimitive)
return
}
@@ -179,39 +177,36 @@ function Component(
```javascript
function Component$0(props$12) {
if (true) {
let a$18 = {};
let b$20 = {};
let c$22 = {};
let d$24 = {};
while (true) {
const z$19 = a$18;
a$18 = b$20;
b$20 = c$22;
c$22 = d$24;
d$24 = z$19;
mutate$7(a$18, b$20);
let a$18 = {};
let b$20 = {};
let c$22 = {};
let d$24 = {};
while (true) {
const z$19 = a$18;
a$18 = b$20;
b$20 = c$22;
c$22 = d$24;
d$24 = z$19;
mutate$7(a$18, b$20);
if (cond$8(a$18)) {
break;
}
if (cond$8(a$18)) {
break;
}
if (a$18) {
}
if (b$20) {
}
if (c$22) {
}
if (d$24) {
}
mutate$7(d$24, null);
} else {
}
if (a$18) {
}
if (b$20) {
}
if (c$22) {
}
if (d$24) {
}
mutate$7(d$24, null);
}
```
@@ -100,28 +100,26 @@ function Component(
scope @0 [1:2] deps=[] out=[a$11_@0] {
[1] Const mutate a$11_@0:TObject = Object { }
}
scope @1 [2:15] deps=[read a$11_@0:TObject] out=[] {
[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 mutate x$15_@1.b[2:15] = read b$12_@1
[7] Const mutate y$16_@1[2:15] = Call mutate mutate$8:TFunction(mutate x$15_@1:TObject, mutate d$14_@1:TObject)
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$8:TFunction(mutate x$15_@1:TObject, read $17:TPrimitive)
[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 mutate x$15_@1.b[2:15] = read b$12_@1
[7] Const mutate y$16_@1[2:15] = Call mutate mutate$8:TFunction(mutate x$15_@1:TObject, mutate d$14_@1:TObject)
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$8:TFunction(mutate x$15_@1:TObject, read $17:TPrimitive)
return
}
@@ -133,52 +131,46 @@ function Component(
function Component$0(props$10) {
const $ = React.useMemoCache();
let a$11;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
a$11 = {};
$[0] = a$11;
} else {
a$11 = $[0];
}
const c_1 = $[1] !== a$11;
const b$12 = [a$11];
let c$13;
if (c_1) {
const b$12 = [a$11];
let c$13;
if (true) {
c$13 = {};
$[2] = c$13;
} else {
c$13 = $[2];
}
const d$14 = {
c: c$13,
};
const x$15 = {};
x$15.b = b$12;
const y$16 = mutate$8(x$15, d$14);
if (a$11) {
}
if (b$12) {
}
if (c$13) {
}
if (d$14) {
}
if (y$16) {
}
mutate$8(x$15, null);
$[1] = a$11;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
c$13 = {};
$[1] = c$13;
} else {
c$13 = $[1];
}
const d$14 = {
c: c$13,
};
const x$15 = {};
x$15.b = b$12;
const y$16 = mutate$8(x$15, d$14);
if (a$11) {
}
if (b$12) {
}
if (c$13) {
}
if (d$14) {
}
if (y$16) {
}
mutate$8(x$15, null);
}
```
@@ -126,34 +126,32 @@ bb13:
function Component(
props,
) {
scope @0 [1:18] deps=[] out=[] {
[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)
[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
}
@@ -164,43 +162,39 @@ function Component(
```javascript
function Component$0(props$11) {
const $ = React.useMemoCache();
if (true) {
const a$12 = {};
const b$13 = {};
let c$14;
if (true) {
c$14 = {};
$[0] = c$14;
} else {
c$14 = $[0];
}
const d$15 = {};
while (true) {
mutate$6(a$12, b$13);
if (cond$7(a$12)) {
break;
}
}
if (a$12) {
}
if (b$13) {
}
if (c$14) {
}
if (d$15) {
}
mutate$6(d$15, null);
const a$12 = {};
const b$13 = {};
let c$14;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
c$14 = {};
$[0] = c$14;
} else {
c$14 = $[0];
}
const d$15 = {};
while (true) {
mutate$6(a$12, b$13);
if (cond$7(a$12)) {
break;
}
}
if (a$12) {
}
if (b$13) {
}
if (c$14) {
}
if (d$15) {
}
mutate$6(d$15, null);
}
```
@@ -37,14 +37,12 @@ function foo(
b,
c,
) {
scope @0 [1:6] deps=[read a$6, read b$7] out=[] {
[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)
[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
}
@@ -54,22 +52,13 @@ function foo(
```javascript
function foo$0(a$6, b$7, c$8) {
const $ = React.useMemoCache();
const c_0 = $[0] !== a$6;
const c_1 = $[1] !== b$7;
if (c_0 || c_1) {
const x$9 = [];
const y$10 = [];
if (x$9) {
}
y$10.push(a$6);
x$9.push(b$7);
$[0] = a$6;
$[1] = b$7;
} else {
const x$9 = [];
const y$10 = [];
if (x$9) {
}
y$10.push(a$6);
x$9.push(b$7);
}
```
@@ -29,12 +29,10 @@ function foo(
a,
b,
) {
scope @0 [1:5] deps=[read a$5, read b$6] out=[] {
[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)
}
[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
}
@@ -44,18 +42,10 @@ function foo(
```javascript
function foo$0(a$5, b$6) {
const $ = React.useMemoCache();
const c_0 = $[0] !== a$5;
const c_1 = $[1] !== b$6;
if (c_0 || c_1) {
const x$7 = [];
const y$8 = [];
x$7.push(a$5);
y$8.push(b$6);
$[0] = a$5;
$[1] = b$6;
} else {
}
const x$7 = [];
const y$8 = [];
x$7.push(a$5);
y$8.push(b$6);
}
```
@@ -29,14 +29,10 @@ function foo(
a,
b,
) {
scope @0 [1:5] deps=[read b$6, read a$5] out=[] {
[1] Const mutate x$7_@0[1:5] = Array []
scope @1 [2:4] deps=[read b$6] out=[] {
[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)
}
[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
}
@@ -46,25 +42,10 @@ function foo(
```javascript
function foo$0(a$5, b$6) {
const $ = React.useMemoCache();
const c_0 = $[0] !== b$6;
const c_1 = $[1] !== a$5;
if (c_0 || c_1) {
const x$7 = [];
const c_2 = $[2] !== b$6;
if (c_2) {
const y$8 = [];
y$8.push(b$6);
$[2] = b$6;
} else {
}
x$7.push(a$5);
$[0] = b$6;
$[1] = a$5;
} else {
}
const x$7 = [];
const y$8 = [];
y$8.push(b$6);
x$7.push(a$5);
}
```
@@ -41,15 +41,13 @@ function foo(
b,
c,
) {
scope @0 [1:8] deps=[read c$8, read b$7, read a$6] out=[] {
[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)
}
[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
}
@@ -60,23 +58,11 @@ function foo(
```javascript
function foo$0(a$6, b$7, c$8) {
const $ = React.useMemoCache();
const c_0 = $[0] !== c$8;
const c_1 = $[1] !== b$7;
const c_2 = $[2] !== a$6;
if (c_0 || c_1 || c_2) {
const x$9 = [];
const y$10 = [];
while (c$8) {
y$10.push(b$7);
x$9.push(a$6);
}
$[0] = c$8;
$[1] = b$7;
$[2] = a$6;
} else {
const x$9 = [];
const y$10 = [];
while (c$8) {
y$10.push(b$7);
x$9.push(a$6);
}
}
@@ -51,11 +51,11 @@ function foo(
function foo$0() {
const $ = React.useMemoCache();
let x$4;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x$4 = {};
let y$5;
if (true) {
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
y$5 = [];
const z$6 = {};
y$5.push(z$6);
@@ -35,8 +35,8 @@ bb1:
predecessor blocks: bb2 bb0
[7] Const mutate _$12_@1 = JSX <read Component$0 x={freeze x$7_@0} ></read Component$0>
[8] Call read y$8.push(read props$6.p2)
[9] Const mutate t6$15_@2 = JSX <read Component$0 x={read x$7_@0} y={read y$8} ></read Component$0>
[10] Return read t6$15_@2
[9] Const mutate t5$15_@2 = JSX <read Component$0 x={read x$7_@0} y={read y$8} ></read Component$0>
[10] Return read t5$15_@2
```
## Reactive Scopes
@@ -53,9 +53,7 @@ function Component(
[5] Reassign mutate x$7_@0[1:7] = Array []
}
}
scope @1 [7:8] deps=[freeze x$7_@0] out=[] {
[7] Const mutate _$12_@1 = JSX <read Component$0 x={freeze x$7_@0} ></read Component$0>
}
[7] Const mutate _$12_@1 = JSX <read Component$0 x={freeze x$7_@0} ></read Component$0>
[8] Call read y$8.push(read props$6.p2)
scope @2 [9:10] deps=[read x$7_@0, read y$8] out=[$15_@2] {
[9] Const mutate $15_@2 = JSX <read Component$0 x={read x$7_@0} y={read y$8} ></read Component$0>
@@ -89,30 +87,23 @@ function Component$0(props$6) {
x$7 = $[2];
}
const c_3 = $[3] !== x$7;
if (c_3) {
const _$12 = <Component$0 x={x$7}></Component$0>;
$[3] = x$7;
} else {
}
const _$12 = <Component$0 x={x$7}></Component$0>;
y$8.push(props$6.p2);
const c_4 = $[4] !== x$7;
const c_5 = $[5] !== y$8;
let t6$15;
const c_3 = $[3] !== x$7;
const c_4 = $[4] !== y$8;
let t5$15;
if (c_4 || c_5) {
t6$15 = <Component$0 x={x$7} y={y$8}></Component$0>;
$[4] = x$7;
$[5] = y$8;
$[6] = t6$15;
if (c_3 || c_4) {
t5$15 = <Component$0 x={x$7} y={y$8}></Component$0>;
$[3] = x$7;
$[4] = y$8;
$[5] = t5$15;
} else {
t6$15 = $[6];
t5$15 = $[5];
}
return t6$15;
return t5$15;
}
```
@@ -27,8 +27,8 @@ bb0:
[4] Const mutate x$9_@1 = Array []
[5] Const mutate _$10_@2 = JSX <read Component$0 x={freeze x$9_@1} ></read Component$0>
[6] Call mutate y$8_@0.push(read props$6.p1)
[7] Const mutate t7$11_@3 = JSX <read Component$0 x={read x$9_@1} y={freeze y$8_@0} ></read Component$0>
[8] Return read t7$11_@3
[7] Const mutate t6$11_@3 = JSX <read Component$0 x={read x$9_@1} y={freeze y$8_@0} ></read Component$0>
[8] Return read t6$11_@3
```
## Reactive Scopes
@@ -44,9 +44,7 @@ function Component(
scope @1 [4:5] deps=[] out=[x$9_@1] {
[4] Const mutate x$9_@1 = Array []
}
scope @2 [5:6] deps=[freeze x$9_@1] out=[] {
[5] Const mutate _$10_@2 = JSX <read Component$0 x={freeze x$9_@1} ></read Component$0>
}
[5] Const mutate _$10_@2 = JSX <read Component$0 x={freeze x$9_@1} ></read Component$0>
[6] Call mutate y$8_@0.push(read props$6.p1)
}
scope @3 [7:8] deps=[read x$9_@1, freeze y$8_@0] out=[$11_@3] {
@@ -71,21 +69,14 @@ function Component$0(props$6) {
y$8 = x$7;
let x$9;
if (true) {
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
x$9 = [];
$[3] = x$9;
} else {
x$9 = $[3];
}
const c_4 = $[4] !== x$9;
if (c_4) {
const _$10 = <Component$0 x={x$9}></Component$0>;
$[4] = x$9;
} else {
}
const _$10 = <Component$0 x={x$9}></Component$0>;
y$8.push(props$6.p1);
$[0] = props$6.p0;
@@ -95,20 +86,20 @@ function Component$0(props$6) {
y$8 = $[2];
}
const c_5 = $[5] !== x$9;
const c_6 = $[6] !== y$8;
let t7$11;
const c_4 = $[4] !== x$9;
const c_5 = $[5] !== y$8;
let t6$11;
if (c_5 || c_6) {
t7$11 = <Component$0 x={x$9} y={y$8}></Component$0>;
$[5] = x$9;
$[6] = y$8;
$[7] = t7$11;
if (c_4 || c_5) {
t6$11 = <Component$0 x={x$9} y={y$8}></Component$0>;
$[4] = x$9;
$[5] = y$8;
$[6] = t6$11;
} else {
t7$11 = $[7];
t6$11 = $[6];
}
return t7$11;
return t6$11;
}
```
@@ -58,9 +58,7 @@ bb0:
```
function foo(
) {
scope @0 [1:2] deps=[] out=[] {
[1] Const mutate a$5_@0:TObject = Object { }
}
[1] Const mutate a$5_@0:TObject = Object { }
scope @1 [2:8] deps=[] out=[c$10_@1] {
[2] Const mutate b$6_@1:TObject[2:8] = Object { }
[3] Const mutate c$7_@1:TObject[2:8] = Object { }
@@ -79,14 +77,9 @@ function foo(
```javascript
function foo$0() {
const $ = React.useMemoCache();
if (true) {
const a$5 = {};
} else {
}
const a$5 = {};
let c$10;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
const b$6 = {};
const c$7 = {};
const a$8 = b$6;
@@ -75,7 +75,7 @@ function foo$0(x$8, y$9) {
let t2$14;
if (true) {
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
t2$14 = [y$9 * 10];
$[2] = t2$14;
} else {
@@ -45,7 +45,7 @@ function Component$0(props$5) {
const a$6 = 1;
const b$7 = 2;
let x$8;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x$8 = [a$6, b$7];
$[0] = x$8;
} else {
@@ -59,8 +59,8 @@ 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 t6$20_@3 = JSX <read $19:TPrimitive a={freeze a$11_@0} b={freeze b$12_@0:TObject} ></read $19:TPrimitive>
[12] Return read t6$20_@3
[11] Const mutate t5$20_@3 = JSX <read $19:TPrimitive a={freeze a$11_@0} b={freeze b$12_@0:TObject} ></read $19:TPrimitive>
[12] Return read t5$20_@3
```
## Reactive Scopes
@@ -78,9 +78,7 @@ function Component(
}
if (read $13_@1) {
[6] Const mutate $14:TPrimitive = "div"
scope @2 [7:8] deps=[freeze a$11_@0] out=[] {
[7] Const mutate _$15_@2 = JSX <read $14:TPrimitive a={freeze a$11_@0} ></read $14:TPrimitive>
}
[7] Const mutate _$15_@2 = JSX <read $14:TPrimitive a={freeze a$11_@0} ></read $14:TPrimitive>
}
[9] Call mutate foo$4:TFunction(read a$11_@0, mutate b$12_@0:TObject)
}
@@ -100,13 +98,13 @@ function Component$0(props$10) {
const $ = React.useMemoCache();
let a$11;
let b$12;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
a$11 = [];
b$12 = {};
foo$4(a$11, b$12);
let t2$13;
if (true) {
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
t2$13 = foo$4();
$[2] = t2$13;
} else {
@@ -114,14 +112,7 @@ function Component$0(props$10) {
}
if (t2$13) {
const c_3 = $[3] !== a$11;
if (c_3) {
const _$15 = <div a={a$11}></div>;
$[3] = a$11;
} else {
}
const _$15 = <div a={a$11}></div>;
}
foo$4(a$11, b$12);
@@ -132,20 +123,20 @@ function Component$0(props$10) {
b$12 = $[1];
}
const c_4 = $[4] !== a$11;
const c_5 = $[5] !== b$12;
let t6$20;
const c_3 = $[3] !== a$11;
const c_4 = $[4] !== b$12;
let t5$20;
if (c_4 || c_5) {
t6$20 = <div a={a$11} b={b$12}></div>;
$[4] = a$11;
$[5] = b$12;
$[6] = t6$20;
if (c_3 || c_4) {
t5$20 = <div a={a$11} b={b$12}></div>;
$[3] = a$11;
$[4] = b$12;
$[5] = t5$20;
} else {
t6$20 = $[6];
t5$20 = $[5];
}
return t6$20;
return t5$20;
}
```
@@ -49,8 +49,8 @@ bb0:
[5] Const mutate _$13_@1 = JSX <read $12:TPrimitive a={freeze a$10_@0} ></read $12:TPrimitive>
[6] Call mutate foo$4:TFunction(read a$10_@0, mutate b$11_@0:TObject)
[7] Const mutate $14:TPrimitive = "div"
[8] Const mutate t5$15_@2 = JSX <read $14:TPrimitive a={read a$10_@0} b={freeze b$11_@0:TObject} ></read $14:TPrimitive>
[9] Return read t5$15_@2
[8] Const mutate t4$15_@2 = JSX <read $14:TPrimitive a={read a$10_@0} b={freeze b$11_@0:TObject} ></read $14:TPrimitive>
[9] Return read t4$15_@2
```
## Reactive Scopes
@@ -64,9 +64,7 @@ function Component(
[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"
scope @1 [5:6] deps=[freeze a$10_@0] out=[] {
[5] Const mutate _$13_@1 = JSX <read $12:TPrimitive a={freeze a$10_@0} ></read $12:TPrimitive>
}
[5] Const mutate _$13_@1 = JSX <read $12:TPrimitive a={freeze a$10_@0} ></read $12:TPrimitive>
[6] Call mutate foo$4:TFunction(read a$10_@0, mutate b$11_@0:TObject)
}
[7] Const mutate $14:TPrimitive = "div"
@@ -85,18 +83,12 @@ function Component$0(props$9) {
const $ = React.useMemoCache();
let a$10;
let b$11;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
a$10 = [];
b$11 = {};
foo$4(a$10, b$11);
const c_2 = $[2] !== a$10;
if (c_2) {
const _$13 = <div a={a$10}></div>;
$[2] = a$10;
} else {
}
const _$13 = <div a={a$10}></div>;
foo$4(a$10, b$11);
$[0] = a$10;
@@ -106,20 +98,20 @@ function Component$0(props$9) {
b$11 = $[1];
}
const c_3 = $[3] !== a$10;
const c_4 = $[4] !== b$11;
let t5$15;
const c_2 = $[2] !== a$10;
const c_3 = $[3] !== b$11;
let t4$15;
if (c_3 || c_4) {
t5$15 = <div a={a$10} b={b$11}></div>;
$[3] = a$10;
$[4] = b$11;
$[5] = t5$15;
if (c_2 || c_3) {
t4$15 = <div a={a$10} b={b$11}></div>;
$[2] = a$10;
$[3] = b$11;
$[4] = t4$15;
} else {
t5$15 = $[5];
t4$15 = $[4];
}
return t5$15;
return t4$15;
}
```
@@ -76,7 +76,7 @@ function foo(
function foo$0() {
const $ = React.useMemoCache();
let x$7;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x$7 = 1;
const y$8 = 2;
@@ -59,7 +59,7 @@ function foo(
function foo$0() {
const $ = React.useMemoCache();
let x$5;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x$5 = 1;
const y$6 = 2;
@@ -46,9 +46,7 @@ bb2:
function foo(
cond,
) {
scope @0 [1:2] deps=[] out=[] {
[1] Const mutate items$5_@0 = Array []
}
[1] Const mutate items$5_@0 = Array []
}
```
@@ -57,10 +55,7 @@ function foo(
```javascript
function foo$0(cond$4) {
if (true) {
const items$5 = [];
} else {
}
const items$5 = [];
}
```
@@ -72,7 +72,7 @@ function foo(
function foo$0() {
const $ = React.useMemoCache();
let x$6;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x$6 = 1;
for (const i$7 = 0; i$7 < 10; i$7) {
@@ -76,7 +76,7 @@ function foo(
function foo$0() {
const $ = React.useMemoCache();
let x$7;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x$7 = 1;
for (let i$8 = 0; i$8 < 10; i$8 = i$8 + 1, i$8) {
@@ -44,14 +44,12 @@ function foo(
b,
c,
) {
scope @0 [1:8] deps=[read a$5, read b$6, read c$7] out=[] {
[1] Const mutate x$8_@0[1:8] = read a$5
if (read b$6) {
if (read c$7) {
[4] Reassign mutate x$8_@0[1:8] = read c$7
}
[6] read x$8_@0
[1] Const mutate x$8_@0[1:8] = read a$5
if (read b$6) {
if (read c$7) {
[4] Reassign mutate x$8_@0[1:8] = read c$7
}
[6] read x$8_@0
}
return
}
@@ -62,25 +60,13 @@ function foo(
```javascript
function foo$0(a$5, b$6, c$7) {
const $ = React.useMemoCache();
const c_0 = $[0] !== a$5;
const c_1 = $[1] !== b$6;
const c_2 = $[2] !== c$7;
if (c_0 || c_1 || c_2) {
const x$8 = a$5;
if (b$6) {
if (c$7) {
x$8 = c$7;
}
x$8;
const x$8 = a$5;
if (b$6) {
if (c$7) {
x$8 = c$7;
}
$[0] = a$5;
$[1] = b$6;
$[2] = c$7;
} else {
x$8;
}
}
@@ -68,7 +68,7 @@ function Component(
function Component$0(props$6) {
const $ = React.useMemoCache();
let c$9;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
const a$7 = [];
const b$8 = {};
c$9 = new Foo$5(a$7, b$8);
@@ -71,7 +71,7 @@ function foo(
function foo$0() {
const $ = React.useMemoCache();
let x$6;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x$6 = 1;
let y$7 = 2;
@@ -45,7 +45,7 @@ function Component$0(props$5) {
const a$6 = 1;
const b$7 = 2;
let x$8;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x$8 = {
a: a$6,
b: b$7,
@@ -75,7 +75,7 @@ function foo$0(a$5) {
if (a$5) {
let y$7;
if (true) {
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
y$7 = {};
$[2] = y$7;
} else {
@@ -86,7 +86,7 @@ function foo$0(a$5) {
} else {
let z$8;
if (true) {
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
z$8 = {};
$[3] = z$8;
} else {
@@ -80,7 +80,7 @@ function foo$0(a$6) {
} else {
let z$9;
if (true) {
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
z$9 = {};
$[2] = z$9;
} else {
@@ -50,7 +50,7 @@ function foo(
function foo$0() {
const $ = React.useMemoCache();
let y$7;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
const a$5 = {};
const x$6 = a$5;
y$7 = {};
@@ -46,7 +46,7 @@ function foo(
function foo$0() {
const $ = React.useMemoCache();
let x$4;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x$4 = [];
$[0] = x$4;
} else {
@@ -45,7 +45,7 @@ function foo(
function foo$0() {
const $ = React.useMemoCache();
let y$5;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
const x$4 = [];
y$5 = {};
y$5.x = x$4;
@@ -50,7 +50,7 @@ function foo(
function foo$0() {
const $ = React.useMemoCache();
let y$6;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
const a$5 = {};
y$6 = a$5;
const x$7 = [];
@@ -45,7 +45,7 @@ function foo(
function foo$0() {
const $ = React.useMemoCache();
let y$5;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
const x$4 = [];
y$5 = {};
y$5.x = x$4;
@@ -44,7 +44,7 @@ function foo(
function foo$0() {
const $ = React.useMemoCache();
let x$3;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x$3 = [];
$[0] = x$3;
} else {
@@ -54,7 +54,7 @@ function foo(
function foo$0() {
const $ = React.useMemoCache();
let x$4;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x$4 = 1;
if (x$4 === 1) {
@@ -68,7 +68,7 @@ function foo$0() {
const $ = React.useMemoCache();
const y$5 = 2;
let y$8;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
y$8 = undefined;
if (y$5 > 1) {
@@ -102,7 +102,7 @@ function foo$0() {
const $ = React.useMemoCache();
const x$10 = 1;
let x$16;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x$16 = undefined;
bb1: switch (x$10) {
@@ -53,7 +53,7 @@ function foo(
function foo$0() {
const $ = React.useMemoCache();
let x$4;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x$4 = 1;
if (x$4 === 1) {
@@ -61,7 +61,7 @@ function foo(
function foo$0() {
const $ = React.useMemoCache();
let x$5;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x$5 = 1;
while (x$5 < 10) {
@@ -69,9 +69,7 @@ function Component(
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)
scope @2 [8:9] deps=[] out=[] {
[8] Const mutate y$13_@2 = Array []
}
[8] Const mutate y$13_@2 = Array []
}
case read $11:TPrimitive: {
[10] Reassign mutate y$10_@1:TPrimitive[1:12] = read x$9_@1
@@ -107,11 +105,7 @@ function Component$0(props$8) {
case true: {
x$9.push(props$8.p2);
x$9.push(props$8.p3);
if (true) {
const y$13 = [];
} else {
}
const y$13 = [];
}
case false: {
@@ -37,16 +37,14 @@ bb0:
```
function component(
) {
scope @0 [1:9] deps=[] out=[] {
[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 mutate x$6_@0.y[1:9] = read y$9_@0:TObject
[6] Reassign mutate p$7_@0.y[1:9] = read x$6_@0.y
[7] Reassign mutate q$8_@0.y[1:9] = read p$7_@0.y
[8] Call mutate mutate$5:TFunction(mutate q$8_@0:TObject)
}
[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 mutate x$6_@0.y[1:9] = read y$9_@0:TObject
[6] Reassign mutate p$7_@0.y[1:9] = read x$6_@0.y
[7] Reassign mutate q$8_@0.y[1:9] = read p$7_@0.y
[8] Call mutate mutate$5:TFunction(mutate q$8_@0:TObject)
return
}
@@ -56,17 +54,14 @@ function component(
```javascript
function component$0() {
if (true) {
const x$6 = {};
const p$7 = {};
const q$8 = {};
const y$9 = {};
x$6.y = y$9;
p$7.y = x$6.y;
q$8.y = p$7.y;
mutate$5(q$8);
} else {
}
const x$6 = {};
const p$7 = {};
const q$8 = {};
const y$9 = {};
x$6.y = y$9;
p$7.y = x$6.y;
q$8.y = p$7.y;
mutate$5(q$8);
}
```
@@ -34,9 +34,7 @@ function component(
) {
[1] Const mutate $7:TPrimitive = Binary read a$5:TPrimitive > read b$6:TPrimitive
if (read $7:TPrimitive) {
scope @0 [3:4] deps=[] out=[] {
[3] Const mutate m$8_@0:TObject = Object { }
}
[3] Const mutate m$8_@0:TObject = Object { }
}
return
}
@@ -48,10 +46,7 @@ function component(
```javascript
function component$0(a$5, b$6) {
if (a$5 > b$6) {
if (true) {
const m$8 = {};
} else {
}
const m$8 = {};
}
}
@@ -42,9 +42,7 @@ function component(
}
[3] Const mutate $9:TPrimitive = Binary read a$7_@0:TPrimitive > read b$8_@1:TPrimitive
if (read $9:TPrimitive) {
scope @2 [5:6] deps=[] out=[] {
[5] Const mutate m$10_@2:TObject = Object { }
}
[5] Const mutate m$10_@2:TObject = Object { }
}
return
}
@@ -57,7 +55,7 @@ function component(
function component$0() {
const $ = React.useMemoCache();
let a$7;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
a$7 = some$2();
$[0] = a$7;
} else {
@@ -66,7 +64,7 @@ function component$0() {
let b$8;
if (true) {
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
b$8 = someOther$4();
$[1] = b$8;
} else {
@@ -74,10 +72,7 @@ function component$0() {
}
if (a$7 > b$8) {
if (true) {
const m$10 = {};
} else {
}
const m$10 = {};
}
}
@@ -40,7 +40,7 @@ function component(
function component$0() {
const $ = React.useMemoCache();
let x$5;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x$5 = {
t: 1,
};
@@ -65,7 +65,7 @@ function component(
function component$0() {
const $ = React.useMemoCache();
let t0$10;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0$10 = makeSomePrimitive$2();
$[0] = t0$10;
} else {
@@ -74,7 +74,7 @@ function component$0() {
let t1$11;
if (true) {
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t1$11 = makeSomePrimitive$2();
$[1] = t1$11;
} else {
@@ -46,11 +46,11 @@ function component(
function component$0() {
const $ = React.useMemoCache();
let x$4;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x$4 = {};
let q$5;
if (true) {
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
q$5 = {};
$[1] = q$5;
} else {
@@ -63,7 +63,7 @@ function component(
function component$0() {
const $ = React.useMemoCache();
let p$7;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
p$7 = makePrimitive$2();
$[0] = p$7;
} else {
@@ -73,7 +73,7 @@ function component$0() {
p$7 + p$7;
let o$8;
if (true) {
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
o$8 = {};
$[1] = o$8;
} else {
@@ -45,13 +45,9 @@ function component(
}
[3] Const mutate $9:TPrimitive = Binary read x$7_@0:TPrimitive > read y$8_@1:TPrimitive
if (read $9:TPrimitive) {
scope @2 [5:6] deps=[] out=[] {
[5] Const mutate z$10_@2:TObject = Object { }
}
}
scope @3 [7:8] deps=[] out=[] {
[7] Const mutate z$12_@3 = Call mutate foo$2:TFunction()
[5] Const mutate z$10_@2:TObject = Object { }
}
[7] Const mutate z$12_@3 = Call mutate foo$2:TFunction()
return
}
@@ -63,7 +59,7 @@ function component(
function component$0() {
const $ = React.useMemoCache();
let x$7;
if (true) {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x$7 = foo$2();
$[0] = x$7;
} else {
@@ -72,7 +68,7 @@ function component$0() {
let y$8;
if (true) {
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
y$8 = foo$2();
$[1] = y$8;
} else {
@@ -80,16 +76,10 @@ function component$0() {
}
if (x$7 > y$8) {
if (true) {
const z$10 = {};
} else {
}
const z$10 = {};
}
if (true) {
const z$12 = foo$2();
} else {
}
const z$12 = foo$2();
}
```