JSTQL-JS-Transform/output_testing/618escape-analysis-non-escaping-interleaved-allocating-dependency.js

14 lines
428 B
JavaScript
Raw Normal View History

function Component(props) {
// a can be independently memoized, is not mutated later
const a = [props.a];
// b and c are interleaved and grouped into a single scope,
// but they are independent values. c does not escape, but
// we need to ensure that a is memoized or else b will invalidate
// on every render since a is a dependency.
const b = [];
const c = {};
c.a = a;
props.b |> b.push(%);
return b;
}