Appearance
| 1 | namespace IR.Values is | |
| 2 | use Ghul.Pipes | |
| 3 | ||
| 4 | use Semantic.Types.Type | |
| 5 | ||
| 6 | // Values encoded one after another as a single value, the last | |
| 7 | // leaving the result. A step can consume what the one before it | |
| 8 | // left on the stack, so the steps are only ever straight-line code: | |
| 9 | // no branch falls between them. Part of a composite's expansion, so | |
| 10 | // it marks no source position. | |
| 11 | class STEPS: Value is | |
| 12 | steps: Collections.List[Value] | |
| 13 | ||
| 14 | type: Type pure => steps[steps.count - 1].type! | |
| 15 | has_location: bool => false | |
| 16 | ||
| 17 | init(steps: Collections.List[Value]) is | |
| 18 | super.init() | |
| 19 | ||
| 20 | assert steps.count > 0 else "steps needs at least one value" | |
| 21 | ||
| 22 | self.steps = steps | |
| 23 | si | |
| 24 | ||
| 25 | accept(visitor: Visitor) is | |
| 26 | visitor.visit(self) | |
| 27 | si | |
| 28 | ||
| 29 | to_string() -> string => "steps:({steps |> join("; ")})" | |
| 30 | si | |
| 31 | si |