52 lines
No EOL
880 B
JavaScript
52 lines
No EOL
880 B
JavaScript
function mutate(x, y) {
|
|
"use no forget";
|
|
|
|
if (x != null) {
|
|
x.value = (x.value ?? 0) + 1;
|
|
}
|
|
if (y != null) {
|
|
y.value = (y.value ?? 0) + 1;
|
|
}
|
|
}
|
|
function cond(x) {
|
|
"use no forget";
|
|
|
|
return x.value > 5;
|
|
}
|
|
function testFunction(props) {
|
|
let a = {};
|
|
let b = {};
|
|
let c = {};
|
|
let d = {};
|
|
while (true) {
|
|
let z = a;
|
|
a = b;
|
|
b = c;
|
|
c = d;
|
|
d = z;
|
|
a |> mutate(%, b);
|
|
if (a |> cond(%)) {
|
|
break;
|
|
}
|
|
}
|
|
|
|
// all of these tests are seemingly readonly, since the values are never directly
|
|
// mutated again. but they are all aliased by `d`, which is later modified, and
|
|
// these are therefore mutable references:
|
|
if (a) {}
|
|
if (b) {}
|
|
if (c) {}
|
|
if (d) {}
|
|
d |> mutate(%, null);
|
|
return {
|
|
a,
|
|
b,
|
|
c,
|
|
d
|
|
};
|
|
}
|
|
export const FIXTURE_ENTRYPOINT = {
|
|
fn: testFunction,
|
|
params: [{}],
|
|
isComponent: false
|
|
}; |