Appearance
| 1 | namespace Syntax.Trees.Expressions is | |
| 2 | ||
| 3 | use Source | |
| 4 | ||
| 5 | // A field comparison inside a synthesized union `=~`, where the | |
| 6 | // comparison to run is not knowable when the body is built: it is | |
| 7 | // the field type's own `=~` where the type defines one, and the | |
| 8 | // default equality comparer otherwise. The parser never produces | |
| 9 | // this node — add_accessors_for_properties builds one per compared | |
| 10 | // field, and compile-expressions lowers it once the field's static | |
| 11 | // type is known. | |
| 12 | class FIELD_EQUALS( | |
| 13 | location: LOCATION, | |
| 14 | left: Expression, | |
| 15 | right: Expression | |
| 16 | ): Expression is | |
| 17 | // Whether a member that reaches neither an operator nor an | |
| 18 | // element-wise comparison is worth reporting. A union's | |
| 19 | // structural equality is what choosing a union asks for, so a | |
| 20 | // member that degrades it is; a struct's operator is given | |
| 21 | // rather than asked for, and reporting there would fire on | |
| 22 | // every struct in a program, including the ones nothing ever | |
| 23 | // compares. | |
| 24 | reports_fallback: bool public | |
| 25 | ||
| 26 | super(location) | |
| 27 | ||
| 28 | accept(visitor: Visitor) is | |
| 29 | visitor.visit(self) | |
| 30 | si | |
| 31 | ||
| 32 | walk(visitor: Visitor) is | |
| 33 | if !visitor.pre(self) then | |
| 34 | left.walk(visitor) | |
| 35 | right.walk(visitor) | |
| 36 | fi | |
| 37 | ||
| 38 | accept(visitor) | |
| 39 | si | |
| 40 | si | |
| 41 | si |