Skip to content
← Back

src/semantic/custom_attribute.ghul

1
namespace Semantic is
2
// One `name = value` argument of an attribute application, resolved
3
// against the attribute's own members.
4
//
5
// `il_name` is the member's .NET name rather than the identifier the
6
// call site used: a reflected attribute can be renamed on the way in
7
// - `TypeDiscriminatorPropertyName` is written
8
// `type_discriminator_property_name` in ghūl - and it is the
9
// original a reader looks the member up by.
10
class NAMED_ATTRIBUTE_ARGUMENT(
11
is_field: bool,
12
il_name: string,
13
member_type: Types.Type,
14
value: IR.Values.Value?,
15
location: Source.LOCATION
16
)
17
18
// A resolved attribute application: the constructor it selected and
19
// its arguments. `positional` and `named` are what the value blob is
20
// encoded from; `positional` is the completed list, one entry per
21
// constructor parameter, a trailing parameter the call site omitted
22
// carrying the default the resolver filled in for it.
23
class CUSTOM_ATTRIBUTE(
24
constructor: Symbols.Function,
25
positional: Collections.List[IR.Values.Value],
26
named: Collections.List[NAMED_ATTRIBUTE_ARGUMENT],
27
// The pragma this attribute was resolved from, so a re-walk of
28
// the same source replaces the attribute rather than adding a
29
// second copy to the symbol.
30
pragma: Syntax.Trees.Pragmas.PRAGMA
31
)
32
si