Appearance
| 1 | namespace IR.Values is | |
| 2 | use Semantic.Types.Type | |
| 3 | ||
| 4 | // A built-in conversion of a scalar to another scalar kind. `from` | |
| 5 | // is the kind converted from, or null where the source is not a | |
| 6 | // scalar (an enum). | |
| 7 | class CONVERT: Value is | |
| 8 | type: Type | |
| 9 | value: Value | |
| 10 | from: IR.Scalar? | |
| 11 | to: IR.Scalar | |
| 12 | ||
| 13 | init( | |
| 14 | type: Type, | |
| 15 | value: Value, | |
| 16 | from: IR.Scalar?, | |
| 17 | to: IR.Scalar | |
| 18 | ) is | |
| 19 | super.init() | |
| 20 | ||
| 21 | self.type = type | |
| 22 | self.value = value | |
| 23 | self.from = from | |
| 24 | self.to = to | |
| 25 | si | |
| 26 | ||
| 27 | accept(visitor: Visitor) is | |
| 28 | visitor.visit(self) | |
| 29 | si | |
| 30 | ||
| 31 | to_string() -> string => | |
| 32 | "cast:[{type}]({value})" | |
| 33 | si | |
| 34 | si |