Skip to content
← Back

src/semantic/dotnet/type_details.ghul

1
namespace Semantic.DotNet is
2
use IO.Std
3
4
use TYPE = System.Type
5
6
class TYPE_DETAILS(
7
dotnet_type: TYPE,
8
ghul_namespace: string,
9
ghul_type_name: string,
10
il_name: string?,
11
assembly_name: string?
12
) is
13
// True for the synthetic class hosting a namespace's globals. A
14
// namespace can have one carrier per contributing assembly, and the
15
// re-homing of the runtime's staging namespace into Ghul.Intrinsics
16
// gives it two from a single one.
17
is_globals_carrier: bool public
18
19
// True for a type the declaring compiler synthesised rather than
20
// any source declared - a state-machine frame, a closure class -
21
// read off its CompilerGeneratedAttribute at import. Such a type
22
// stays resolvable by name but never user-spellable, so member
23
// listings keep it out.
24
is_compiler_generated: bool public
25
26
// The System.Type named by the type.s AsyncMethodBuilderAttribute,
27
// when it carries one - the builder an async function returning
28
// this type drives. Read at import; mapped to a ghūl type when the
29
// type.s symbol is created. Null for the vast majority of types.
30
async_builder_type: TYPE? public
31
32
// True for an enum carrying System.FlagsAttribute - read at
33
// import, the same way is_compiler_generated is. Meaningless
34
// for a non-enum type, so nothing reads it for one.
35
has_flags_attribute: bool public
36
37
matches(namespace_name: string?, name: string) -> bool =>
38
namespace_name? /\ namespace_name =~ ghul_namespace /\ name =~ ghul_type_name
39
40
merge_assembly_reference(type: TYPE, assembly_name: string) is
41
if !self.assembly_name? then
42
self.assembly_name = assembly_name
43
fi
44
si
45
46
to_string() -> string => "(.NET type: {dotnet_type} ghul ns: {ghul_namespace} ghul name: {ghul_type_name} il_name: {il_name} assembly_name: {assembly_name})"
47
si
48
si