Appearance
| 1 | namespace Syntax.Trees.Expressions is | |
| 2 | ||
| 3 | use Source | |
| 4 | ||
| 5 | // `SPILL(E)` — synthesised by SPILL_AWAITS. Generate-IL emits | |
| 6 | // E's IL plus a stfld to a fresh frame field; the SPILL's | |
| 7 | // `value` becomes a ldfld from that field, which surrounding IR | |
| 8 | // consumes lazily. Type matches the wrapped operand. | |
| 9 | class SPILL: Expression is | |
| 10 | operand: Expression | |
| 11 | ||
| 12 | // The frame field the operand is held in across the suspend. | |
| 13 | // Allocated while the operand's type is settled rather than | |
| 14 | // while the spill is emitted: the emitted assembly's rows are | |
| 15 | // numbered before any body is compiled, so a field first | |
| 16 | // declared during emission is numbered by nothing and has no | |
| 17 | // row to reference. | |
| 18 | spill_field: Semantic.Symbols.Field? public => spill_state.spill_field, = value is spill_state.spill_field = value si | |
| 19 | ||
| 20 | spill_state: Syntax.Process.SPILL_STATE field | |
| 21 | ||
| 22 | clear() is | |
| 23 | super.clear() | |
| 24 | spill_state.clear() | |
| 25 | si | |
| 26 | ||
| 27 | clear_outputs() is | |
| 28 | super.clear_outputs() | |
| 29 | spill_state.clear_outputs() | |
| 30 | si | |
| 31 | ||
| 32 | init(location: LOCATION, operand: Expression) is | |
| 33 | super.init(location) | |
| 34 | ||
| 35 | self.operand = operand | |
| 36 | si | |
| 37 | ||
| 38 | accept(visitor: Visitor) is | |
| 39 | visitor.visit(self) | |
| 40 | si | |
| 41 | ||
| 42 | walk(visitor: Visitor) is | |
| 43 | if !visitor.pre(self) then | |
| 44 | operand.walk(visitor) | |
| 45 | fi | |
| 46 | accept(visitor) | |
| 47 | si | |
| 48 | si | |
| 49 | si |