Skip to content
← Back

src/semantic/symbols/method_override_set.ghul

1
namespace Semantic is
2
use IO.Std
3
4
use System.Text.StringBuilder
5
6
use Collections.Iterable
7
use Collections.Iterator
8
9
use Collections.SET
10
11
use Symbols.Function
12
13
use Ghul.Pipes
14
15
class METHOD_OVERRIDE_SET(override_class: METHOD_OVERRIDE_CLASS) is
16
_set: SET[FUNCTION_WRAPPER]
17
18
iterator: Iterator[Function] => iterable.iterator
19
20
iterable: Iterable[Function] =>
21
_set |>
22
map(from => from.function)
23
24
count: int => _set.count
25
26
init(..) is
27
_set = SET[FUNCTION_WRAPPER]()
28
si
29
30
add(method: Function) is
31
assert method.override_class =~ override_class
32
_set.add(FUNCTION_WRAPPER(method))
33
si
34
35
to_string() -> string => "{override_class}: {_set |> join(", ")}"
36
37
get_overrider(into: Symbols.Symbol) -> Function =>
38
(iterable |> first())!
39
si
40
si