Skip to content
← Back

src/semantic/dotnet/type_details.ghul

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