Appearance
| 1 | namespace IR.Values is | |
| 2 | use Semantic.Types.Type | |
| 3 | ||
| 4 | // A scalar constructed from another scalar, as `double(n)` is: the | |
| 5 | // conversion `cast` to the same type produces, marked as one so the | |
| 6 | // effects analysis treats it exactly as it treats that cast rather | |
| 7 | // than as a call to whatever conversion operator it lowers to. | |
| 8 | class SCALAR_CONVERSION: Value is | |
| 9 | converted: Value | |
| 10 | ||
| 11 | has_address: bool => converted.has_address | |
| 12 | type: Type? pure => converted.type | |
| 13 | ||
| 14 | init(converted: Value) is | |
| 15 | super.init() | |
| 16 | ||
| 17 | self.converted = converted | |
| 18 | si | |
| 19 | ||
| 20 | accept(visitor: Visitor) is | |
| 21 | visitor.visit(self) | |
| 22 | si | |
| 23 | ||
| 24 | to_string() -> string => | |
| 25 | "scalar-conversion({converted})" | |
| 26 | si | |
| 27 | si |