-
Notifications
You must be signed in to change notification settings - Fork 858
Expand file tree
/
Copy pathTypedTreeOps.Attributes.fsi
More file actions
414 lines (269 loc) · 15.8 KB
/
TypedTreeOps.Attributes.fsi
File metadata and controls
414 lines (269 loc) · 15.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
/// TypedTreeOps.Attributes: IL extensions, attribute helpers, and debug printing.
namespace FSharp.Compiler.TypedTreeOps
open System.Collections.Generic
open Internal.Utilities.Library
open FSharp.Compiler
open FSharp.Compiler.AbstractIL.IL
open FSharp.Compiler.DiagnosticsLogger
open FSharp.Compiler.Syntax
open FSharp.Compiler.Syntax.PrettyNaming
open FSharp.Compiler.TcGlobals
open FSharp.Compiler.Text
open FSharp.Compiler.Text.Layout
open FSharp.Compiler.Text.TaggedText
open FSharp.Compiler.TypedTree
open FSharp.Compiler.TypedTreeBasics
[<AutoOpen>]
module internal ILExtensions =
val isILAttribByName: string list * string -> ILAttribute -> bool
val TryDecodeILAttribute: ILTypeRef -> ILAttributes -> (ILAttribElem list * ILAttributeNamedArg list) option
val IsILAttrib: BuiltinAttribInfo -> ILAttribute -> bool
val TryFindILAttribute: BuiltinAttribInfo -> ILAttributes -> bool
val inline hasFlag: flags: ^F -> flag: ^F -> bool when ^F: enum<uint64>
/// Compute well-known attribute flags for an ILAttributes collection.
val classifyILAttrib: attr: ILAttribute -> WellKnownILAttributes
val computeILWellKnownFlags: _g: TcGlobals -> attrs: ILAttributes -> WellKnownILAttributes
val tryFindILAttribByFlag:
flag: WellKnownILAttributes -> cattrs: ILAttributes -> (ILAttribElem list * ILAttributeNamedArg list) option
[<return: Struct>]
val (|ILAttribDecoded|_|):
flag: WellKnownILAttributes -> cattrs: ILAttributes -> (ILAttribElem list * ILAttributeNamedArg list) voption
type ILAttributesStored with
member HasWellKnownAttribute: g: TcGlobals * flag: WellKnownILAttributes -> bool
type ILTypeDef with
member HasWellKnownAttribute: g: TcGlobals * flag: WellKnownILAttributes -> bool
type ILMethodDef with
member HasWellKnownAttribute: g: TcGlobals * flag: WellKnownILAttributes -> bool
type ILFieldDef with
member HasWellKnownAttribute: g: TcGlobals * flag: WellKnownILAttributes -> bool
type ILAttributes with
/// Non-caching (unlike ILAttributesStored.HasWellKnownAttribute which caches).
member HasWellKnownAttribute: flag: WellKnownILAttributes -> bool
val IsMatchingFSharpAttribute: TcGlobals -> BuiltinAttribInfo -> Attrib -> bool
val HasFSharpAttribute: TcGlobals -> BuiltinAttribInfo -> Attribs -> bool
val TryFindFSharpAttribute: TcGlobals -> BuiltinAttribInfo -> Attribs -> Attrib option
[<return: Struct>]
val (|ExtractAttribNamedArg|_|): string -> AttribNamedArg list -> AttribExpr voption
[<return: Struct>]
val (|ExtractILAttributeNamedArg|_|): string -> ILAttributeNamedArg list -> ILAttribElem voption
[<return: Struct>]
val (|StringExpr|_|): (Expr -> string voption)
[<return: Struct>]
val (|AttribInt32Arg|_|): (AttribExpr -> int32 voption)
[<return: Struct>]
val (|AttribInt16Arg|_|): (AttribExpr -> int16 voption)
[<return: Struct>]
val (|AttribBoolArg|_|): (AttribExpr -> bool voption)
[<return: Struct>]
val (|AttribStringArg|_|): (AttribExpr -> string voption)
val (|AttribElemStringArg|_|): (ILAttribElem -> string option)
[<AutoOpen>]
module internal AttributeHelpers =
val computeEntityWellKnownFlags: g: TcGlobals -> attribs: Attribs -> WellKnownEntityAttributes
/// Classify a single entity-level attrib to its well-known flag (or None).
val classifyEntityAttrib: g: TcGlobals -> attrib: Attrib -> WellKnownEntityAttributes
/// Classify a single val-level attrib to its well-known flag (or None).
val classifyValAttrib: g: TcGlobals -> attrib: Attrib -> WellKnownValAttributes
/// Classify a single assembly-level attrib to its well-known flag (or None).
val classifyAssemblyAttrib: g: TcGlobals -> attrib: Attrib -> WellKnownAssemblyAttributes
/// Check if an Entity has a specific well-known attribute, computing and caching flags if needed.
val attribsHaveEntityFlag: g: TcGlobals -> flag: WellKnownEntityAttributes -> attribs: Attribs -> bool
val filterOutWellKnownAttribs:
g: TcGlobals ->
entityMask: WellKnownEntityAttributes ->
valMask: WellKnownValAttributes ->
attribs: Attribs ->
Attribs
val tryFindEntityAttribByFlag: g: TcGlobals -> flag: WellKnownEntityAttributes -> attribs: Attribs -> Attrib option
[<return: Struct>]
val (|EntityAttrib|_|): g: TcGlobals -> flag: WellKnownEntityAttributes -> attribs: Attribs -> Attrib voption
[<return: Struct>]
val (|EntityAttribInt|_|): g: TcGlobals -> flag: WellKnownEntityAttributes -> attribs: Attribs -> int voption
[<return: Struct>]
val (|EntityAttribString|_|): g: TcGlobals -> flag: WellKnownEntityAttributes -> attribs: Attribs -> string voption
val attribsHaveValFlag: g: TcGlobals -> flag: WellKnownValAttributes -> attribs: Attribs -> bool
val tryFindValAttribByFlag: g: TcGlobals -> flag: WellKnownValAttributes -> attribs: Attribs -> Attrib option
[<return: Struct>]
val (|ValAttrib|_|): g: TcGlobals -> flag: WellKnownValAttributes -> attribs: Attribs -> Attrib voption
[<return: Struct>]
val (|ValAttribInt|_|): g: TcGlobals -> flag: WellKnownValAttributes -> attribs: Attribs -> int voption
[<return: Struct>]
val (|ValAttribString|_|): g: TcGlobals -> flag: WellKnownValAttributes -> attribs: Attribs -> string voption
val EntityHasWellKnownAttribute: g: TcGlobals -> flag: WellKnownEntityAttributes -> entity: Entity -> bool
/// Get the computed well-known attribute flags for an entity.
val GetEntityWellKnownFlags: g: TcGlobals -> entity: Entity -> WellKnownEntityAttributes
/// Map a WellKnownILAttributes flag to its entity flag + provided-type AttribInfo equivalents.
val mapILFlag:
g: TcGlobals -> flag: WellKnownILAttributes -> struct (WellKnownEntityAttributes * BuiltinAttribInfo option)
val computeValWellKnownFlags: g: TcGlobals -> attribs: Attribs -> WellKnownValAttributes
/// Check if an ArgReprInfo has a specific well-known attribute, computing and caching flags if needed.
val ArgReprInfoHasWellKnownAttribute: g: TcGlobals -> flag: WellKnownValAttributes -> argInfo: ArgReprInfo -> bool
/// Check if a Val has a specific well-known attribute, computing and caching flags if needed.
val ValHasWellKnownAttribute: g: TcGlobals -> flag: WellKnownValAttributes -> v: Val -> bool
/// Query a three-state bool attribute on an entity. Returns bool option.
val EntityTryGetBoolAttribute:
g: TcGlobals ->
trueFlag: WellKnownEntityAttributes ->
falseFlag: WellKnownEntityAttributes ->
entity: Entity ->
bool option
/// Query a three-state bool attribute on a Val. Returns bool option.
val ValTryGetBoolAttribute:
g: TcGlobals -> trueFlag: WellKnownValAttributes -> falseFlag: WellKnownValAttributes -> v: Val -> bool option
/// Try to find a specific attribute on a type definition, where the attribute accepts a string argument.
///
/// This is used to detect the 'DefaultMemberAttribute' and 'ConditionalAttribute' attributes (on type definitions)
val TryFindTyconRefStringAttribute: TcGlobals -> range -> BuiltinAttribInfo -> TyconRef -> string option
/// Like TryFindTyconRefStringAttribute but with a fast-path flag check on the IL path.
/// Use this when the attribute has a corresponding WellKnownILAttributes flag for O(1) early exit.
val TryFindTyconRefStringAttributeFast:
TcGlobals -> range -> WellKnownILAttributes -> BuiltinAttribInfo -> TyconRef -> string option
/// Try to find a specific attribute on a type definition, where the attribute accepts a bool argument.
val TryFindTyconRefBoolAttribute: TcGlobals -> range -> BuiltinAttribInfo -> TyconRef -> bool option
/// Try to find a specific attribute on a type definition
val TyconRefHasAttribute: TcGlobals -> range -> BuiltinAttribInfo -> TyconRef -> bool
/// Try to find an attribute with a specific full name on a type definition
val TyconRefHasAttributeByName: range -> string -> TyconRef -> bool
/// Check if a TyconRef has a well-known attribute, handling both IL and F# metadata with O(1) flag tests.
val TyconRefHasWellKnownAttribute: g: TcGlobals -> flag: WellKnownILAttributes -> tcref: TyconRef -> bool
/// Check if a TyconRef has AllowNullLiteralAttribute, returning Some true/Some false/None.
val TyconRefAllowsNull: g: TcGlobals -> tcref: TyconRef -> bool option
/// Try to find the AllowMultiple value of the AttributeUsage attribute on a type definition.
val TryFindAttributeUsageAttribute: TcGlobals -> range -> TyconRef -> bool option
val (|AttribBitwiseOrExpr|_|): TcGlobals -> Expr -> (Expr * Expr) voption
[<return: Struct>]
val (|EnumExpr|_|): TcGlobals -> Expr -> Expr voption
[<return: Struct>]
val (|TypeOfExpr|_|): TcGlobals -> Expr -> TType voption
[<return: Struct>]
val (|TypeDefOfExpr|_|): TcGlobals -> Expr -> TType voption
val isNameOfValRef: TcGlobals -> ValRef -> bool
[<return: Struct>]
val (|NameOfExpr|_|): TcGlobals -> Expr -> TType voption
[<return: Struct>]
val (|SeqExpr|_|): TcGlobals -> Expr -> unit voption
val HasDefaultAugmentationAttribute: g: TcGlobals -> tcref: TyconRef -> bool
[<return: Struct>]
val (|UnopExpr|_|): TcGlobals -> Expr -> (ValRef * Expr) voption
[<return: Struct>]
val (|BinopExpr|_|): TcGlobals -> Expr -> (ValRef * Expr * Expr) voption
[<return: Struct>]
val (|SpecificUnopExpr|_|): TcGlobals -> ValRef -> Expr -> Expr voption
[<return: Struct>]
val (|SpecificBinopExpr|_|): TcGlobals -> ValRef -> Expr -> (Expr * Expr) voption
[<return: Struct>]
val (|SignedConstExpr|_|): Expr -> unit voption
[<return: Struct>]
val (|IntegerConstExpr|_|): Expr -> unit voption
[<return: Struct>]
val (|FloatConstExpr|_|): Expr -> unit voption
[<return: Struct>]
val (|UncheckedDefaultOfExpr|_|): TcGlobals -> Expr -> TType voption
[<return: Struct>]
val (|SizeOfExpr|_|): TcGlobals -> Expr -> TType voption
val mkCompilationMappingAttr: TcGlobals -> int -> ILAttribute
val mkCompilationMappingAttrWithSeqNum: TcGlobals -> int -> int -> ILAttribute
val mkCompilationMappingAttrWithVariantNumAndSeqNum: TcGlobals -> int -> int -> int -> ILAttribute
val mkCompilationArgumentCountsAttr: TcGlobals -> int list -> ILAttribute
val mkCompilationSourceNameAttr: TcGlobals -> string -> ILAttribute
val mkCompilationMappingAttrForQuotationResource: TcGlobals -> string * ILTypeRef list -> ILAttribute
#if !NO_TYPEPROVIDERS
/// returns Some(assemblyName) for success
val TryDecodeTypeProviderAssemblyAttr: ILAttribute -> (string | null) option
#endif
val IsSignatureDataVersionAttr: ILAttribute -> bool
val TryFindAutoOpenAttr: ILAttribute -> string option
val TryFindInternalsVisibleToAttr: ILAttribute -> string option
val IsMatchingSignatureDataVersionAttr: ILVersionInfo -> ILAttribute -> bool
val mkSignatureDataVersionAttr: TcGlobals -> ILVersionInfo -> ILAttribute
val isSealedTy: TcGlobals -> TType -> bool
val IsUnionTypeWithNullAsTrueValue: TcGlobals -> Tycon -> bool
val TyconHasUseNullAsTrueValueAttribute: TcGlobals -> Tycon -> bool
val CanHaveUseNullAsTrueValueAttribute: TcGlobals -> Tycon -> bool
val ModuleNameIsMangled: TcGlobals -> Attribs -> bool
val CompileAsEvent: TcGlobals -> Attribs -> bool
val ValCompileAsEvent: TcGlobals -> Val -> bool
val MemberIsCompiledAsInstance: TcGlobals -> TyconRef -> bool -> ValMemberInfo -> Attribs -> bool
val ValSpecIsCompiledAsInstance: TcGlobals -> Val -> bool
val ValRefIsCompiledAsInstanceMember: TcGlobals -> ValRef -> bool
val tryFindExtensionAttribute: g: TcGlobals -> attribs: Attrib list -> Attrib option
/// Add an System.Runtime.CompilerServices.ExtensionAttribute to the module Entity if found via predicate and not already present.
val tryAddExtensionAttributeIfNotAlreadyPresentForModule:
g: TcGlobals ->
tryFindExtensionAttributeIn: ((Attrib list -> Attrib option) -> Attrib option) ->
moduleEntity: Entity ->
Entity
/// Add an System.Runtime.CompilerServices.ExtensionAttribute to the type Entity if found via predicate and not already present.
val tryAddExtensionAttributeIfNotAlreadyPresentForType:
g: TcGlobals ->
tryFindExtensionAttributeIn: ((Attrib list -> Attrib option) -> Attrib option) ->
moduleOrNamespaceTypeAccumulator: ModuleOrNamespaceType ref ->
typeEntity: Entity ->
Entity
[<AutoOpen>]
module internal ByrefAndSpanHelpers =
val isByrefLikeTyconRef: TcGlobals -> range -> TyconRef -> bool
val isSpanLikeTyconRef: TcGlobals -> range -> TyconRef -> bool
val isByrefLikeTy: TcGlobals -> range -> TType -> bool
/// Check if the type is a byref-like but not a byref.
val isSpanLikeTy: TcGlobals -> range -> TType -> bool
val isSpanTy: TcGlobals -> range -> TType -> bool
val tryDestSpanTy: TcGlobals -> range -> TType -> (TyconRef * TType) option
val destSpanTy: TcGlobals -> range -> TType -> (TyconRef * TType)
val isReadOnlySpanTy: TcGlobals -> range -> TType -> bool
val tryDestReadOnlySpanTy: TcGlobals -> range -> TType -> (TyconRef * TType) option
val destReadOnlySpanTy: TcGlobals -> range -> TType -> (TyconRef * TType)
module internal DebugPrint =
/// A global flag indicating whether debug output should include ValReprInfo
val mutable layoutValReprInfo: bool
/// A global flag indicating whether debug output should include stamps of Val and Entity
val mutable layoutStamps: bool
/// A global flag indicating whether debug output should include ranges
val mutable layoutRanges: bool
/// A global flag indicating whether debug output should include type information
val mutable layoutTypes: bool
/// Convert a type to a string for debugging purposes
val showType: TType -> string
/// Convert an expression to a string for debugging purposes
val showExpr: Expr -> string
/// Debug layout for a reference to a value
val valRefL: ValRef -> Layout
/// Debug layout for a reference to a union case
val unionCaseRefL: UnionCaseRef -> Layout
/// Debug layout for an value definition at its binding site
val valAtBindL: Val -> Layout
/// Debug layout for an integer
val intL: int -> Layout
/// Debug layout for a value definition
val valL: Val -> Layout
/// Debug layout for a type parameter definition
val typarDeclL: Typar -> Layout
/// Debug layout for a trait constraint
val traitL: TraitConstraintInfo -> Layout
/// Debug layout for a type parameter
val typarL: Typar -> Layout
/// Debug layout for a set of type parameters
val typarsL: Typars -> Layout
/// Debug layout for a type
val typeL: TType -> Layout
/// Debug layout for a method slot signature
val slotSigL: SlotSig -> Layout
/// Debug layout for a module or namespace definition
val entityL: ModuleOrNamespace -> Layout
/// Debug layout for a binding of an expression to a value
val bindingL: Binding -> Layout
/// Debug layout for an expression
val exprL: Expr -> Layout
/// Debug layout for a type definition
val tyconL: Tycon -> Layout
/// Debug layout for a decision tree
val decisionTreeL: DecisionTree -> Layout
/// Debug layout for an implementation file
val implFileL: CheckedImplFile -> Layout
/// Debug layout for a list of implementation files
val implFilesL: CheckedImplFile list -> Layout
/// Debug layout for class and record fields
val recdFieldRefL: RecdFieldRef -> Layout
/// Serialize an entity to a very basic json structure.
val serializeEntity: path: string -> entity: Entity -> unit