Appearance
| 1 | namespace IR.Values is | |
| 2 | use Semantic.Types.Type | |
| 3 | ||
| 4 | // Reads an int local, decrements it, and leaves the decremented value | |
| 5 | // on the stack. Used by a fused `skip` stage: each pulled element | |
| 6 | // decrements the running counter, and the new value is compared against | |
| 7 | // zero to decide whether the element is dropped - mirroring | |
| 8 | // FilterPipeBase.have_moved followed by should_include. | |
| 9 | class PRE_DECREMENT: Value is | |
| 10 | counter: IR.LOCAL | |
| 11 | ||
| 12 | type: Type | |
| 13 | ||
| 14 | init(counter: IR.LOCAL, type: Type) is | |
| 15 | super.init() | |
| 16 | ||
| 17 | self.counter = counter | |
| 18 | self.type = type | |
| 19 | si | |
| 20 | ||
| 21 | accept(visitor: Visitor) is | |
| 22 | visitor.visit(self) | |
| 23 | si | |
| 24 | ||
| 25 | to_string() -> string => "pre_decrement:({counter})" | |
| 26 | si | |
| 27 | si |