Appearance
| 1 | namespace IR.Values is | |
| 2 | use Semantic.Types.Type | |
| 3 | ||
| 4 | // Decrements an int local in place, leaving nothing on the stack. | |
| 5 | // Used by a fused `take` stage: each element that reaches the stage | |
| 6 | // spends one of its count, and the loop checks the count before it | |
| 7 | // pulls the next element, so the stage itself has nothing to decide. | |
| 8 | class DECREMENT: Value is | |
| 9 | counter: IR.LOCAL | |
| 10 | ||
| 11 | type: Type | |
| 12 | ||
| 13 | init(counter: IR.LOCAL, type: Type) is | |
| 14 | super.init() | |
| 15 | ||
| 16 | self.counter = counter | |
| 17 | self.type = type | |
| 18 | si | |
| 19 | ||
| 20 | accept(visitor: Visitor) is | |
| 21 | visitor.visit(self) | |
| 22 | si | |
| 23 | ||
| 24 | to_string() -> string => "decrement:({counter})" | |
| 25 | si | |
| 26 | si |