Skip to content
← Back

src/syntax/process/expression_state.ghul

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
init() is
18
si
19
20
set_expected_type(expected_type: Type?, error_message: string?) is
21
self.expected_type = expected_type;
22
self.expected_type_error_message = error_message;
23
si
24
25
clear() is
26
value = null;
27
is_call_target = false;
28
expected_type = null;
29
expected_type_error_message = null;
30
si
31
si
32
si