Skip to content
← Back

src/syntax/trees/statements/try.ghul

1
namespace Syntax.Trees.Statements is
2
use Source;
3
4
class TRY(
5
location: LOCATION,
6
body: LIST,
7
catches: Collections.LIST[CATCH],
8
`finally: LIST?
9
): Statement, ScopeCarrier is
10
scope: Semantic.Scope? public;
11
12
expression: Expressions.Expression;
13
14
super(location);
15
16
accept(visitor: Visitor) is
17
visitor.visit(self);
18
si
19
20
walk(visitor: Visitor) is
21
if !visitor.pre(self) then
22
body.walk(visitor);
23
24
for c in catches do
25
c.walk(visitor);
26
od
27
28
if `finally? then
29
`finally.walk(visitor);
30
fi
31
fi
32
accept(visitor);
33
si
34
si
35
36
class CATCH(location: LOCATION, variable: Variables.VARIABLE?, body: LIST): Statement, ScopeCarrier is
37
scope: Semantic.Scope? public;
38
39
super(location);
40
41
accept(visitor: Visitor) is
42
visitor.visit(self);
43
si
44
45
walk(visitor: Visitor) is
46
if !visitor.pre(self) then
47
if variable? then
48
variable.walk(visitor);
49
fi
50
51
body.walk(visitor);
52
fi
53
54
accept(visitor);
55
si
56
si
57
si