Skip to content
← Back

src/syntax/trees/bodies/expression.ghul

1
namespace Syntax.Trees.Bodies is
2
use Source
3
4
class EXPRESSION(location: LOCATION, expression: Expressions.Expression public): Body, ScopeCarrier, DisposalHost is
5
scope: Semantic.Scope? public
6
7
// Where the `=>` that opens the body was written, when it was. The
8
// body's own location is the expression's, which is where a
9
// diagnostic about the value belongs.
10
arrow: LOCATION? public
11
12
// From the `=>`: the expression can start later than the body does,
13
// as a thread-first call is located from its `|>` rather than from
14
// its subject.
15
extent: LOCATION => if let a = arrow then a :: location else location fi
16
17
// Compile-expressions output, read by IL generation.
18
dispose_state: Syntax.Process.LIST_DISPOSAL_STATE field
19
20
let_in_disposals: Collections.List[Semantic.Symbols.Variable]? => dispose_state.variables_to_dispose
21
22
super(location)
23
24
add_let_in_disposal(v: Semantic.Symbols.Variable) is
25
dispose_state.add(v)
26
si
27
28
clear() is
29
super.clear()
30
dispose_state.clear()
31
si
32
33
clear_outputs() is
34
super.clear_outputs()
35
dispose_state.clear()
36
si
37
38
accept(visitor: Visitor) is
39
visitor.visit(self)
40
si
41
42
walk(visitor: Visitor) is
43
if !visitor.pre(self) then
44
visitor.enter_node(expression)
45
try
46
expression.walk(visitor)
47
finally
48
visitor.leave_node(expression)
49
yrt
50
fi
51
52
accept(visitor)
53
si
54
si
55
si