Appearance
| 1 | namespace Semantic.Symbols is | |
| 2 | // The operator names declared as members on some source type in the | |
| 3 | // compilation. The store-free walk consults it to decide whether an | |
| 4 | // operator applied to an operand whose type it cannot trivially | |
| 5 | // derive could reach a member operator — one that might store — | |
| 6 | // rather than only the innate and free operators, which it already | |
| 7 | // bounds through the operator group. | |
| 8 | // | |
| 9 | // A source-only set is complete: a reflected type never exposes a | |
| 10 | // member under a ghūl operator name, because a .NET operator method | |
| 11 | // imports with a `$op_...` name, so `find_member("%")` on an | |
| 12 | // imported type is always empty. Absent means "no source member | |
| 13 | // operator of this name", the answer that lets an unbounded operand | |
| 14 | // stay store-free. | |
| 15 | // | |
| 16 | // Cleared whenever the symbol tables are cleared, alongside the | |
| 17 | // other name- and id-keyed store-free state. | |
| 18 | class MEMBER_OPERATOR_NAMES is | |
| 19 | _names: Collections.SET[string]? static; | |
| 20 | ||
| 21 | add(name: string) static is | |
| 22 | if !_names? then | |
| 23 | _names = Collections.SET[string](); | |
| 24 | fi | |
| 25 | ||
| 26 | _names.add(name); | |
| 27 | si | |
| 28 | ||
| 29 | contains(name: string) -> bool static => | |
| 30 | _names? /\ _names.contains(name); | |
| 31 | ||
| 32 | clear() static is | |
| 33 | if _names? then | |
| 34 | _names.clear(); | |
| 35 | fi | |
| 36 | si | |
| 37 | si | |
| 38 | si |