Appearance
| 1 | namespace Semantic.Symbols is | |
| 2 | // Supplies the `^` operator for an enum type. Mirrors | |
| 3 | // `ENUM_AND_OPERATOR`, which explains the shared rationale; this | |
| 4 | // supplies `^` via the same `arithmetic` innate family, `xor` | |
| 5 | // rather than `and`. | |
| 6 | class ENUM_XOR_OPERATOR is | |
| 7 | register(owner: Classy) static is | |
| 8 | let type = owner.type | |
| 9 | ||
| 10 | if !type? then | |
| 11 | return | |
| 12 | fi | |
| 13 | ||
| 14 | let operator = | |
| 15 | INNATE_METHOD(owner.location, owner, "^", owner, "arithmetic.xor") | |
| 16 | ||
| 17 | operator.argument_names = Collections.LIST[string](["other"]) | |
| 18 | operator.arguments = Collections.LIST[Types.Type]([type]) | |
| 19 | operator.return_type = type | |
| 20 | ||
| 21 | operator.mark_declared_pure() | |
| 22 | ||
| 23 | owner.add_member(operator) | |
| 24 | si | |
| 25 | si | |
| 26 | si |