Skip to content
← Back

src/syntax/trees/definitions/trait.ghul

1
namespace Syntax.Trees.Definitions is
2
use System.Exception
3
4
use Source
5
6
class TRAIT(
7
location: LOCATION,
8
name: Identifiers.Identifier,
9
arguments: TypeExpressions.LIST?,
10
ancestors: TypeExpressions.LIST?,
11
modifiers: Modifiers.LIST,
12
body: Definitions.LIST
13
): Classy is
14
super(location, name, arguments, ancestors, modifiers, body)
15
16
accept(visitor: Visitor) is
17
visitor.visit(self)
18
si
19
20
walk(visitor: Visitor) is
21
let symbol_table = IoC.CONTAINER.instance.symbol_table
22
let logger = IoC.CONTAINER.instance.logger
23
let symbol_use_locations = IoC.CONTAINER.instance.symbol_use_locations
24
25
let symbol_table_mark = symbol_table.mark_scope_stack()
26
let diagnostics_mark = logger.mark()
27
let symbol_uses_mark = symbol_use_locations.mark()
28
29
try
30
_walk(visitor)
31
catch e: Exception
32
IoC.CONTAINER.instance.logger.exception(location, e, "exception walking struct syntax tree")
33
finally
34
logger.release(diagnostics_mark)
35
symbol_use_locations.release(symbol_uses_mark)
36
symbol_table.release_scope_stack(symbol_table_mark)
37
yrt
38
si
39
40
_walk(visitor: Visitor) is
41
if !visitor.pre(self) then
42
name.walk(visitor)
43
44
if arguments? then
45
arguments.walk(visitor)
46
fi
47
48
if ancestors? then
49
ancestors.walk(visitor)
50
fi
51
52
modifiers.walk(visitor)
53
body.walk(visitor)
54
fi
55
56
accept(visitor)
57
si
58
si
59
si