Skip to content
← Back

src/syntax/trees/definitions/impl.ghul

1
namespace Syntax.Trees.Definitions is
2
3
use Source
4
5
// An interface-implementation block injected into an already-declared type:
6
// impl <Interface> for <Target>[<params>] is <members> si
7
// Attaches <Interface> to the target and adds the members that fill its
8
// slots. `name`/`arguments` identify the target (as for `partial`);
9
// `ancestors` holds the single interface being implemented.
10
class IMPL(
11
location: LOCATION,
12
name: Identifiers.Identifier,
13
arguments: TypeExpressions.LIST?,
14
ancestors: TypeExpressions.LIST?,
15
modifiers: Modifiers.LIST,
16
body: Definitions.LIST
17
): Classy is
18
super(location, name, arguments, ancestors, modifiers, body)
19
20
description_for_walk: string => "impl"
21
22
accept(visitor: Visitor) is
23
visitor.visit(self)
24
si
25
26
_walk(visitor: Visitor) is
27
if !visitor.pre(self) then
28
name.walk(visitor)
29
30
if arguments? then
31
arguments.walk(visitor)
32
fi
33
34
if ancestors? then
35
ancestors.walk(visitor)
36
fi
37
38
modifiers.walk(visitor)
39
body.walk(visitor)
40
fi
41
42
accept(visitor)
43
si
44
si
45
si