Skip to content
← Back

src/semantic/scope/empty_scope.ghul

1
namespace Semantic is
2
use IO.Std;
3
4
use Collections.MutableMap;
5
use Collections.LIST;
6
use Collections.Iterable;
7
8
use Symbols.Symbol;
9
10
use Types.Type;
11
12
class EMPTY_SCOPE(namespace_name: string?): Scope is
13
_qualifier: string;
14
name: string => if let n = namespace_name then n else "" fi;
15
qualified_name: string => name;
16
symbols: Iterable[Symbol] => LIST[Symbol]();
17
type: Type? => null;
18
unspecialized_symbol: Symbol? => null;
19
20
init(..) is
21
if name.length > 0 then
22
_qualifier = "{name}.";
23
else
24
_qualifier = "";
25
fi
26
si
27
28
qualify(name: string) -> string => "{_qualifier}{name}";
29
30
find_direct(name: string) -> Symbol? => null;
31
find_member(name: string) -> Symbol? => null;
32
find_enclosing(name: string) -> Symbol? => null;
33
34
find_direct_matches(prefix: string, results: MutableMap[string,Symbol]) is
35
si
36
37
find_member_matches(prefix: string, results: MutableMap[string,Symbol]) is
38
si
39
40
find_enclosing_matches(prefix: string, results: MutableMap[string,Symbol]) is
41
si
42
43
gen_dot(buffer: System.Text.StringBuilder) is
44
buffer.append(".");
45
si
46
47
gen_dotted_name(buffer: System.Text.StringBuilder, qualifying: Scope?) is
48
if qualifying? then
49
buffer.append(qualified_name);
50
else
51
buffer
52
.append(name)
53
.append(' ');
54
fi
55
si
56
57
gen_type_spec(buffer: System.Text.StringBuilder) => throw System.NotImplementedException("not implemented by {get_type()}");
58
gen_class_name(buffer: System.Text.StringBuilder) => throw System.NotImplementedException("not implemented by {get_type()}");
59
gen_reference(buffer: System.Text.StringBuilder) => throw System.NotImplementedException("not implemented by {get_type()}");
60
gen_type(buffer: System.Text.StringBuilder) => throw System.NotImplementedException("not implemented by {get_type()}");
61
si
62
si