29 lines
570 B
JavaScript
29 lines
570 B
JavaScript
function compute() {}
|
|||
|
|
function mutate() {}
|
||
|
|
function foo() {}
|
||
|
|
function Foo() {}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Should produce 3 scopes:
|
||
|
|
*
|
||
|
|
* a: inputs=props.a & props.c; outputs=a
|
||
|
|
* a = compute(props.a);
|
||
|
|
* if (props.c)
|
||
|
|
* mutate(a)
|
||
|
|
* b: inputs=props.b & props.c; outputs=b
|
||
|
|
* b = compute(props.b);
|
||
|
|
* if (props.c)
|
||
|
|
* mutate(b)
|
||
|
|
* return: inputs=a, b outputs=return
|
||
|
|
* return = <Foo a={a} b={b} />
|
||
|
|
*/
|
||
|
|
function Component(props) {
|
||
|
|
const a = compute(props.a);
|
||
|
|
const b = compute(props.b);
|
||
|
|
if (props.c) {
|
||
|
|
mutate(a);
|
||
|
|
mutate(b);
|
||
|
|
}
|
||
|
|
return <Foo a={a} b={b} />;
|
||
|
|
}
|