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 | init() is | |
| 25 | si | |
| 26 | ||
| 27 | set_expected_type(expected_type: Type?, error_message: string?) is | |
| 28 | self.expected_type = expected_type | |
| 29 | self.expected_type_error_message = error_message | |
| 30 | self.pack_marker = 0 | |
| 31 | si | |
| 32 | ||
| 33 | clear() is | |
| 34 | value = null | |
| 35 | is_call_target = false | |
| 36 | expected_type = null | |
| 37 | expected_type_error_message = null | |
| 38 | pack_marker = 0 | |
| 39 | si | |
| 40 | ||
| 41 | clear_outputs() is | |
| 42 | value = null | |
| 43 | is_call_target = false | |
| 44 | si | |
| 45 | si | |
| 46 | si |