Appearance
| 1 | namespace Syntax.Process is | |
| 2 | use Collections; | |
| 3 | ||
| 4 | use Type = Semantic.Types.Type; | |
| 5 | use Value = IR.Values.Value; | |
| 6 | use Variable = Semantic.Symbols.Variable; | |
| 7 | ||
| 8 | // Per-build state the compile-expressions pass family records on | |
| 9 | // statement nodes, read downstream by IL generation. Each struct is | |
| 10 | // hosted as a field on its statement class and knows how to clear | |
| 11 | // itself; the statement classes carry read-only forwarders and no | |
| 12 | // knowledge of the contents. See NodeStateStore for the companion | |
| 13 | // store-based pattern for sparse state. | |
| 14 | struct STATEMENT_STATE is | |
| 15 | value: Value? public; | |
| 16 | want_value: bool public; | |
| 17 | ||
| 18 | init() is | |
| 19 | si | |
| 20 | ||
| 21 | clear() is | |
| 22 | value = null; | |
| 23 | want_value = false; | |
| 24 | si | |
| 25 | si | |
| 26 | ||
| 27 | struct LIST_DISPOSAL_STATE is | |
| 28 | variables_to_dispose: Collections.LIST[Variable]? public; | |
| 29 | want_dispose: bool public; | |
| 30 | ||
| 31 | init() is | |
| 32 | si | |
| 33 | ||
| 34 | add(v: Variable) is | |
| 35 | want_dispose = true; | |
| 36 | ||
| 37 | let list = variables_to_dispose ?? Collections.LIST[Variable](); | |
| 38 | variables_to_dispose = list; | |
| 39 | ||
| 40 | list.add(v); | |
| 41 | si | |
| 42 | ||
| 43 | clear() is | |
| 44 | variables_to_dispose = null; | |
| 45 | want_dispose = false; | |
| 46 | si | |
| 47 | si | |
| 48 | ||
| 49 | struct EXPECTED_TYPE_STATE is | |
| 50 | expected_type: Type? public; | |
| 51 | expected_type_error_message: string? public; | |
| 52 | ||
| 53 | init() is | |
| 54 | si | |
| 55 | ||
| 56 | set(expected_type: Type?, error_message: string?) is | |
| 57 | self.expected_type = expected_type; | |
| 58 | self.expected_type_error_message = error_message; | |
| 59 | si | |
| 60 | ||
| 61 | clear() is | |
| 62 | expected_type = null; | |
| 63 | expected_type_error_message = null; | |
| 64 | si | |
| 65 | si | |
| 66 | ||
| 67 | struct CASE_STATE is | |
| 68 | expected_type: Type? public; | |
| 69 | expected_type_error_message: string? public; | |
| 70 | is_exhaustive: bool public; | |
| 71 | requires_default_fallthrough: bool public; | |
| 72 | ||
| 73 | init() is | |
| 74 | si | |
| 75 | ||
| 76 | set_expected_type(expected_type: Type?, error_message: string?) is | |
| 77 | self.expected_type = expected_type; | |
| 78 | self.expected_type_error_message = error_message; | |
| 79 | si | |
| 80 | ||
| 81 | clear() is | |
| 82 | expected_type = null; | |
| 83 | expected_type_error_message = null; | |
| 84 | is_exhaustive = false; | |
| 85 | requires_default_fallthrough = false; | |
| 86 | si | |
| 87 | si | |
| 88 | si |