Appearance
| 1 | namespace IR.Values is | |
| 2 | use TypeTyped = Semantic.Types.Typed | |
| 3 | use Semantic.Types.Type | |
| 4 | ||
| 5 | class NOT: Value is | |
| 6 | value: Value | |
| 7 | ||
| 8 | type: Type? pure => value.type | |
| 9 | is_value_type: bool => value.is_value_type | |
| 10 | ||
| 11 | // An operator marks its operand's position and then its own, | |
| 12 | // before the negation, rather than its own before the operand. | |
| 13 | has_location: bool => !is_operator /\ super.has_location | |
| 14 | ||
| 15 | is_operator: bool | |
| 16 | ||
| 17 | init(value: Value) is | |
| 18 | super.init() | |
| 19 | ||
| 20 | self.value = value | |
| 21 | si | |
| 22 | ||
| 23 | // The negation written as an operator in source. | |
| 24 | operator(value: Value) -> NOT static is | |
| 25 | let result = NOT(value) | |
| 26 | ||
| 27 | result.is_operator = true | |
| 28 | ||
| 29 | return result | |
| 30 | si | |
| 31 | ||
| 32 | accept(visitor: Visitor) is | |
| 33 | visitor.visit(self) | |
| 34 | si | |
| 35 | ||
| 36 | to_string() -> string => | |
| 37 | "not:[{type}]({value})" | |
| 38 | si | |
| 39 | si |