35
visitID(_id: InstructionId, _state: TState): void {}
36
visitLValue(_id: InstructionId, _lvalue: Place, _state: TState): void {}
37
visitPlace(_id: InstructionId, _place: Place, _state: TState): void {}
38
+ visitReactiveFunctionValue(
39
+ _id: InstructionId,
40
+ _dependencies: Array<Place>,
41
+ _fn: ReactiveFunction,
42
+ _state: TState
43
+ ): void {}
44
45
visitValue(id: InstructionId, value: ReactiveValue, state: TState): void {
46
this.traverseValue(id, value, state);
69
this.visitValue(value.id, value.value, state);
70
break;
71
}
72
+ case "ReactiveFunctionValue": {
73
+ this.visitReactiveFunctionValue(
74
+ id,
75
+ value.dependencies,
76
+ value.fn,
77
+ state
78
+ );
79
+ break;
80
+ }
81
default: {
67
- for (const place of eachReactiveValueOperand(value)) {
82
+ for (const place of eachInstructionValueOperand(value)) {
83
this.visitPlace(id, place, state);
84
}
85
}
323
return { kind: "keep" };
324
}
325
326
+ transformReactiveFunctionValue(
327
+ id: InstructionId,
328
+ dependencies: Array<Place>,
329
+ fn: ReactiveFunction,
330
+ state: TState
331
+ ): { kind: "keep" } | { kind: "replace"; value: ReactiveFunction } {
332
+ this.visitReactiveFunctionValue(id, dependencies, fn, state);
333
+ return { kind: "keep" };
334
+ }
335
+
336
override traverseValue(
337
id: InstructionId,
338
value: ReactiveValue,
382
}
383
break;
384
}
385
+ case "ReactiveFunctionValue": {
386
+ const nextValue = this.transformReactiveFunctionValue(
387
+ id,
388
+ value.dependencies,
389
+ value.fn,
390
+ state
391
+ );
392
+ if (nextValue.kind === "replace") {
393
+ value.fn = nextValue.value;
394
+ }
395
+ break;
396
+ }
397
default: {
361
- for (const place of eachReactiveValueOperand(value)) {
398
+ for (const place of eachInstructionValueOperand(value)) {
399
this.visitPlace(id, place, state);
400
}
401
}
560
yield* eachReactiveValueOperand(instrValue.alternate);
561
break;
562
}
563
+ case "ReactiveFunctionValue": {
564
+ yield* instrValue.dependencies;
565
+ break;
566
+ }
567
default: {
568
yield* eachInstructionValueOperand(instrValue);
569
}