Scoop API

scoop:scoop.core:0.1.0

src/type_info_members.scoop

Selected production source · src/type_info_members.scoop

1/**
2 * A declared member name or a positional payload index.
3 */
4public enum MemberName {
5 /**
6 * A member with an explicit source-level name.
7 */
8 Named(String),
9 /**
10 * A member identified by its zero-based payload position.
11 */
12 Positional(Long)
15/**
16 * Explains why a storage slot exists, separating declared storage from property backing and
17 * compiler-created slots.
18 */
19public enum StorageOrigin {
20 /**
21 * A field explicitly declared in source.
22 */
23 Declared,
24 /**
25 * Storage backing the identified property.
26 */
27 Backing(PropertyRef),
28 /**
29 * Storage holding the delegate of the identified property.
30 */
31 Delegate(PropertyRef),
32 /**
33 * Storage of an enclosing instance reference.
34 */
35 Outer,
36 /**
37 * Storage of a captured value.
38 */
39 Capture,
40 /**
41 * Other compiler-generated storage.
42 */
43 Generated
46/**
47 * Describes one storage field with identity, owner, type use, order, annotations, visibility,
48 * origin, and optional constructor-parameter association.
49 */
50public struct FieldInfo(
51 val id: FieldRef,
52 val owner: TypeRef,
53 val name: MemberName,
54 val typeUse: TypeUseInfo,
55 val isOptionAtDeclaration: Boolean,
56 val index: Long,
57 val annotations: Array<AnnotationInfo>,
58 val visibility: DeclarationVisibility,
59 val origin: StorageOrigin,
60 val constructorParameter: Option<ParameterRef>
61) {
62 /**
63 * The concrete type of this field, without its type-use annotation tree.
64 */
65 public val type: TypeRef get() = typeUse.type
68/**
69 * Describes whether a property uses backing storage, a delegate, or only accessor computation.
70 */
71public enum PropertyStorage {
72 /**
73 * The property is backed by the identified field.
74 */
75 Stored(FieldRef),
76 /**
77 * The property has no backing field.
78 */
79 Computed,
80 /**
81 * The identified field stores the property delegate.
82 */
83 Delegated(FieldRef)
86/**
87 * Describes a property independently of its storage, including accessor visibility, override
88 * identities, and constructor association.
89 */
90public struct PropertyInfo(
91 val id: PropertyRef,
92 val owner: TypeRef,
93 val name: String,
94 val typeUse: TypeUseInfo,
95 val isOptionAtDeclaration: Boolean,
96 val index: Long,
97 val isMutable: Boolean,
98 val visibility: DeclarationVisibility,
99 val annotations: Array<AnnotationInfo>,
100 val getter: AccessorInfo,
101 val setter: Option<AccessorInfo>,
102 val storage: PropertyStorage,
103 val overrides: Array<PropertyRef>,
104 val constructorParameter: Option<ParameterRef>
105) {
106 /**
107 * The concrete property type, without its type-use annotation tree.
108 */
109 public val type: TypeRef get() = typeUse.type
112/**
113 * Classifies storage, constant, explicit-body, and abstract property accessors.
114 */
115public enum AccessorKind {
116 /**
117 * An accessor reads or writes associated storage.
118 */
119 Storage,
120 /**
121 * An accessor produces a constant value.
122 */
123 Constant,
124 /**
125 * An accessor has an explicit implementation body.
126 */
127 Body,
128 /**
129 * An accessor has no implementation in this declaration.
130 */
131 Abstract
134/**
135 * A property accessor's own identity, visibility, annotations, and implementation category.
136 */
137public struct AccessorInfo(
138 val id: AccessorRef,
139 val visibility: DeclarationVisibility,
140 val annotations: Array<AnnotationInfo>,
141 val kind: AccessorKind
144/**
145 * A tuple element's zero-based position, label, and annotated type use.
146 */
147public struct TupleElementInfo(val index: Long, val name: String, val typeUse: TypeUseInfo) {
148 /**
149 * The concrete element type without its type-use annotations.
150 */
151 public val type: TypeRef get() = typeUse.type
154/**
155 * Distinguishes a unit variant from named or positional payload fields.
156 */
157public enum VariantPayload {
158 /**
159 * The variant carries no fields.
160 */
161 Unit,
162 /**
163 * The variant has named payload fields.
164 */
165 Named(Array<FieldInfo>),
166 /**
167 * The variant has positionally indexed payload fields.
168 */
169 Positional(Array<FieldInfo>)
172/**
173 * Describes a payload enum variant, its declaration order, fields, annotations, and constructor.
174 */
175public struct VariantInfo(
176 val id: VariantRef,
177 val owner: TypeRef,
178 val name: String,
179 val annotations: Array<AnnotationInfo>,
180 val index: Long,
181 val payload: VariantPayload,
182 val constructor: ConstructorInfo
185/**
186 * Distinguishes primary, secondary, and enum-variant constructors.
187 */
188public enum ConstructorKind {
189 /**
190 * The nominal type's primary constructor.
191 */
192 Primary,
193 /**
194 * An explicitly declared secondary constructor.
195 */
196 Secondary,
197 /**
198 * The constructor of the identified enum variant.
199 */
200 Variant(VariantRef)
203/**
204 * Describes a constructor and its parameters; metadata does not itself invoke the constructor.
205 */
206public struct ConstructorInfo(
207 val id: ConstructorRef,
208 val owner: TypeRef,
209 val kind: ConstructorKind,
210 val visibility: DeclarationVisibility,
211 val annotations: Array<AnnotationInfo>,
212 val parameters: Array<ParameterInfo>
215/**
216 * Connects a constructor parameter to the field or property it declares, when applicable.
217 */
218public enum ParameterMember {
219 /**
220 * The parameter declares no persistent member.
221 */
222 None,
223 /**
224 * The parameter declares the identified field.
225 */
226 Field(FieldRef),
227 /**
228 * The parameter declares the identified property.
229 */
230 Property(PropertyRef)
233/**
234 * Describes a value parameter, including its annotated type, position, default availability,
235 * vararg status, and declared member association.
236 */
237public struct ParameterInfo(
238 val id: ParameterRef,
239 val name: String,
240 val typeUse: TypeUseInfo,
241 val index: Long,
242 val annotations: Array<AnnotationInfo>,
243 val hasDefault: Boolean,
244 val isVararg: Boolean,
245 val member: ParameterMember