Appearance
| 1 | namespace Syntax.Process is | |
| 2 | use Type = Semantic.Types.Type | |
| 3 | use Value = IR.Values.Value | |
| 4 | ||
| 5 | // Per-build compile-expressions output for an expression node, | |
| 6 | // hosted as a field on the Expression base and cleared through its | |
| 7 | // clear() override. Expected-type storage is written only by the | |
| 8 | // node kinds whose set_expected_type override stores (the base | |
| 9 | // implementation deliberately drops the constraint), so a node | |
| 10 | // kind that ignored constraints before still answers null. | |
| 11 | struct EXPRESSION_STATE is | |
| 12 | value: Value? public | |
| 13 | is_call_target: bool public | |
| 14 | expected_type: Type? public | |
| 15 | expected_type_error_message: string? public | |
| 16 | ||
| 17 | // Says the expected type is a formal declared to take an argument | |
| 18 | // pack spread out: zero where it is not, and otherwise one more | |
| 19 | // than the number of returns into the expected type the marker | |
| 20 | // was written at. Written beside the expected type by whatever | |
| 21 | // pushes it, and dropped whenever a new one is pushed. | |
| 22 | pack_marker: int public | |
| 23 | ||
| 24 | // The formal's function type at the marked hop, where the marker | |
| 25 | // is set: what says how many parameters come before the pack. | |
| 26 | pack_slot: Type? public | |
| 27 | ||
| 28 | init() is | |
| 29 | si | |
| 30 | ||
| 31 | set_expected_type(expected_type: Type?, error_message: string?) is | |
| 32 | self.expected_type = expected_type | |
| 33 | self.expected_type_error_message = error_message | |
| 34 | self.pack_marker = 0 | |
| 35 | self.pack_slot = null | |
| 36 | si | |
| 37 | ||
| 38 | clear() is | |
| 39 | value = null | |
| 40 | is_call_target = false | |
| 41 | expected_type = null | |
| 42 | expected_type_error_message = null | |
| 43 | pack_marker = 0 | |
| 44 | pack_slot = null | |
| 45 | si | |
| 46 | ||
| 47 | clear_outputs() is | |
| 48 | value = null | |
| 49 | is_call_target = false | |
| 50 | si | |
| 51 | si | |
| 52 | si |