forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathast.fs
More file actions
2271 lines (1959 loc) · 98.2 KB
/
Copy pathast.fs
File metadata and controls
2271 lines (1959 loc) · 98.2 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
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
module internal Microsoft.FSharp.Compiler.Ast
open System.Collections.Generic
open Internal.Utilities
open Internal.Utilities.Text.Lexing
open Internal.Utilities.Text.Parsing
open Microsoft.FSharp.Compiler.AbstractIL
open Microsoft.FSharp.Compiler.AbstractIL.IL
open Microsoft.FSharp.Compiler.AbstractIL.Internal
open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library
open Microsoft.FSharp.Compiler
open Microsoft.FSharp.Compiler.UnicodeLexing
open Microsoft.FSharp.Compiler.ErrorLogger
open Microsoft.FSharp.Compiler.PrettyNaming
open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics
open Microsoft.FSharp.Compiler.Lib
open Microsoft.FSharp.Compiler.Range
/// The prefix of the names used for the fake namespace path added to all dynamic code entries in FSI.EXE
let FsiDynamicModulePrefix = "FSI_"
[<RequireQualifiedAccess>]
module FSharpLib =
let Root = "Microsoft.FSharp"
let RootPath = IL.splitNamespace Root
let Core = Root + ".Core"
let CorePath = IL.splitNamespace Core
[<RequireQualifiedAccess>]
module CustomOperations =
[<Literal>]
let Into = "into"
//------------------------------------------------------------------------
// XML doc pre-processing
//-----------------------------------------------------------------------
/// Used to collect XML documentation during lexing and parsing.
type XmlDocCollector() =
let mutable savedLines = new ResizeArray<(string * pos)>()
let mutable savedGrabPoints = new ResizeArray<pos>()
let posCompare p1 p2 = if posGeq p1 p2 then 1 else if posEq p1 p2 then 0 else -1
let savedGrabPointsAsArray =
lazy (savedGrabPoints.ToArray() |> Array.sortWith posCompare)
let savedLinesAsArray =
lazy (savedLines.ToArray() |> Array.sortWith (fun (_,p1) (_,p2) -> posCompare p1 p2))
let check() =
assert (not savedLinesAsArray.IsValueCreated && "can't add more XmlDoc elements to XmlDocCOllector after extracting first XmlDoc from the overall results" <> "")
member x.AddGrabPoint(pos) =
check()
savedGrabPoints.Add pos
member x.AddXmlDocLine(line,pos) =
check()
savedLines.Add(line,pos)
member x.LinesBefore(grabPointPos) =
let lines = savedLinesAsArray.Force()
let grabPoints = savedGrabPointsAsArray.Force()
let firstLineIndexAfterGrabPoint = Array.findFirstIndexWhereTrue lines (fun (_,pos) -> posGeq pos grabPointPos)
let grabPointIndex = Array.findFirstIndexWhereTrue grabPoints (fun pos -> posGeq pos grabPointPos)
assert (posEq grabPoints.[grabPointIndex] grabPointPos)
let firstLineIndexAfterPrevGrabPoint =
if grabPointIndex = 0 then
0
else
let prevGrabPointPos = grabPoints.[grabPointIndex-1]
Array.findFirstIndexWhereTrue lines (fun (_,pos) -> posGeq pos prevGrabPointPos)
//printfn "#lines = %d, firstLineIndexAfterPrevGrabPoint = %d, firstLineIndexAfterGrabPoint = %d" lines.Length firstLineIndexAfterPrevGrabPoint firstLineIndexAfterGrabPoint
lines.[firstLineIndexAfterPrevGrabPoint..firstLineIndexAfterGrabPoint-1] |> Array.map fst
type XmlDoc =
| XmlDoc of string[]
static member Empty = XmlDocStatics.Empty
static member Merge (XmlDoc lines) (XmlDoc lines') = XmlDoc (Array.append lines lines')
static member Process (XmlDoc lines) =
// This code runs for .XML generation and thus influences cross-project xmldoc tooltips; for within-project tooltips, see XmlDocumentation.fs in the language service
let rec processLines (lines:string list) =
match lines with
| [] -> []
| (lineA::rest) as lines ->
let lineAT = lineA.TrimStart([|' '|])
if lineAT = "" then processLines rest
else if String.hasPrefix lineAT "<" then lines
else ["<summary>"] @
(lines |> List.map (fun line -> System.Security.SecurityElement.Escape(line))) @
["</summary>"]
let lines = processLines (Array.toList lines)
if lines.Length = 0 then XmlDoc.Empty
else XmlDoc (Array.ofList lines)
// Discriminated unions can't contain statics, so we use a separate type
and XmlDocStatics() =
static let empty = XmlDoc[| |]
static member Empty = empty
type PreXmlDoc =
| PreXmlMerge of PreXmlDoc * PreXmlDoc
| PreXmlDoc of pos * XmlDocCollector
| PreXmlDocEmpty
member x.ToXmlDoc() =
match x with
| PreXmlMerge(a,b) -> XmlDoc.Merge (a.ToXmlDoc()) (b.ToXmlDoc())
| PreXmlDocEmpty -> XmlDoc.Empty
| PreXmlDoc (pos,collector) ->
let lines = collector.LinesBefore pos
if lines.Length = 0 then XmlDoc.Empty
else XmlDoc lines
static member CreateFromGrabPoint(collector:XmlDocCollector,grabPointPos) =
collector.AddGrabPoint grabPointPos
PreXmlDoc(grabPointPos,collector)
static member Empty = PreXmlDocEmpty
static member Merge a b = PreXmlMerge (a,b)
type ParserDetail =
| Ok
| ThereWereSignificantParseErrorsSoDoNotTypecheckThisNode // would cause spurious/misleading diagnostics
//------------------------------------------------------------------------
// AST: identifiers and long identifiers
//-----------------------------------------------------------------------
// PERFORMANCE: consider making this a struct.
[<System.Diagnostics.DebuggerDisplay("{idText}")>]
[<Sealed>]
[<NoEquality; NoComparison>]
type Ident (text,range) =
member x.idText = text
member x.idRange = range
override x.ToString() = text
type LongIdent = Ident list
type LongIdentWithDots =
/// LongIdentWithDots(lid, dotms)
/// Typically dotms.Length = lid.Length-1, but they may be same if (incomplete) code ends in a dot, e.g. "Foo.Bar."
/// The dots mostly matter for parsing, and are typically ignored by the typechecker, but
/// if dotms.Length = lid.Length, then the parser must have reported an error, so the typechecker is allowed
/// more freedom about typechecking these expressions.
/// LongIdent can be empty list - it is used to denote that name of some AST element is absent (i.e. empty type name in inherit)
| LongIdentWithDots of LongIdent * range list
with member this.Range =
match this with
| LongIdentWithDots([],_) -> failwith "rangeOfLidwd"
| LongIdentWithDots([id],[]) -> id.idRange
| LongIdentWithDots([id],[m]) -> unionRanges id.idRange m
| LongIdentWithDots(h::t,[]) -> unionRanges h.idRange (List.last t).idRange
| LongIdentWithDots(h::t,dotms) -> unionRanges h.idRange (List.last t).idRange |> unionRanges (List.last dotms)
member this.Lid = match this with LongIdentWithDots(lid,_) -> lid
member this.ThereIsAnExtraDotAtTheEnd = match this with LongIdentWithDots(lid,dots) -> lid.Length = dots.Length
member this.RangeSansAnyExtraDot =
match this with
| LongIdentWithDots([],_) -> failwith "rangeOfLidwd"
| LongIdentWithDots([id],_) -> id.idRange
| LongIdentWithDots(h::t,dotms) ->
let nonExtraDots = if dotms.Length = t.Length then dotms else List.take t.Length dotms
unionRanges h.idRange (List.last t).idRange |> unionRanges (List.last nonExtraDots)
//------------------------------------------------------------------------
// AST: the grammar of implicitly scoped type parameters
//-----------------------------------------------------------------------
type TyparStaticReq =
| NoStaticReq
| HeadTypeStaticReq
[<NoEquality; NoComparison>]
type SynTypar =
| Typar of Ident * TyparStaticReq * (* isCompGen: *) bool
with member this.Range =
match this with
| Typar(id,_,_) ->
id.idRange
//------------------------------------------------------------------------
// AST: the grammar of constants and measures
//-----------------------------------------------------------------------
type
[<NoEquality; NoComparison; RequireQualifiedAccess>]
/// The unchecked abstract syntax tree of constants in F# types and expressions.
SynConst =
/// F# syntax: ()
| Unit
/// F# syntax: true, false
| Bool of bool
/// F# syntax: 13y, 0xFFy, 0o077y, 0b0111101y
| SByte of sbyte
/// F# syntax: 13uy, 0x40uy, 0oFFuy, 0b0111101uy
| Byte of byte
/// F# syntax: 13s, 0x4000s, 0o0777s, 0b0111101s
| Int16 of int16
/// F# syntax: 13us, 0x4000us, 0o0777us, 0b0111101us
| UInt16 of uint16
/// F# syntax: 13, 0x4000, 0o0777
| Int32 of int32
/// F# syntax: 13u, 0x4000u, 0o0777u
| UInt32 of uint32
/// F# syntax: 13L
| Int64 of int64
/// F# syntax: 13UL
| UInt64 of uint64
/// F# syntax: 13n
| IntPtr of int64
/// F# syntax: 13un
| UIntPtr of uint64
/// F# syntax: 1.30f, 1.40e10f etc.
| Single of single
/// F# syntax: 1.30, 1.40e10 etc.
| Double of double
/// F# syntax: 'a'
| Char of char
/// F# syntax: 23.4M
| Decimal of System.Decimal
/// UserNum(value, suffix)
///
/// F# syntax: 1Q, 1Z, 1R, 1N, 1G
| UserNum of ( string * string)
/// F# syntax: verbatim or regular string, e.g. "abc"
| String of string * range
/// F# syntax: verbatim or regular byte string, e.g. "abc"B.
///
/// Also used internally in the typechecker once an array of unit16 contants
/// is detected, to allow more efficient processing of large arrays of uint16 constants.
| Bytes of byte[] * range
/// Used internally in the typechecker once an array of unit16 contants
/// is detected, to allow more efficient processing of large arrays of uint16 constants.
| UInt16s of uint16[]
/// Old comment: "we never iterate, so the const here is not another SynConst.Measure"
| Measure of SynConst * SynMeasure
member c.Range dflt =
match c with
| SynConst.String (_,m0) | SynConst.Bytes (_,m0) -> m0
| _ -> dflt
and
[<NoEquality; NoComparison; RequireQualifiedAccess>]
/// The unchecked abstract syntax tree of F# unit of measure annotaitons.
/// This should probably be merged with the represenation of SynType.
SynMeasure =
| Named of LongIdent * range
| Product of SynMeasure * SynMeasure * range
| Seq of SynMeasure list * range
| Divide of SynMeasure * SynMeasure * range
| Power of SynMeasure * SynRationalConst * range
| One
| Anon of range
| Var of SynTypar * range
and
[<NoEquality; NoComparison; RequireQualifiedAccess>]
/// The unchecked abstract syntax tree of F# unit of measure exponents.
SynRationalConst =
| Integer of int32
| Rational of int32 * int32 * range
| Negate of SynRationalConst
//------------------------------------------------------------------------
// AST: the grammar of types, expressions, declarations etc.
//-----------------------------------------------------------------------
[<RequireQualifiedAccess>]
type SynAccess =
| Public
| Internal
| Private
type SequencePointInfoForTarget =
| SequencePointAtTarget
| SuppressSequencePointAtTarget
type SequencePointInfoForSeq =
| SequencePointsAtSeq
// This means "suppress a in 'a;b'" and "suppress b in 'a before b'"
| SuppressSequencePointOnExprOfSequential
// This means "suppress b in 'a;b'" and "suppress a in 'a before b'"
| SuppressSequencePointOnStmtOfSequential
type SequencePointInfoForTry =
| SequencePointAtTry of range
// Used for "use" and "for"
| SequencePointInBodyOfTry
| NoSequencePointAtTry
type SequencePointInfoForWith =
| SequencePointAtWith of range
| NoSequencePointAtWith
type SequencePointInfoForFinally =
| SequencePointAtFinally of range
| NoSequencePointAtFinally
type SequencePointInfoForForLoop =
| SequencePointAtForLoop of range
| NoSequencePointAtForLoop
type SequencePointInfoForWhileLoop =
| SequencePointAtWhileLoop of range
| NoSequencePointAtWhileLoop
type SequencePointInfoForBinding =
| SequencePointAtBinding of range
// Indicates the ommission of a sequence point for a binding for a 'do expr'
| NoSequencePointAtDoBinding
// Indicates the ommission of a sequence point for a binding for a 'let e = expr' where 'expr' has immediate control flow
| NoSequencePointAtLetBinding
// Indicates the ommission of a sequence point for a compiler generated binding
// where we've done a local expansion of some construct into something that involves
// a 'let'. e.g. we've inlined a function and bound its arguments using 'let'
// The let bindings are 'sticky' in that the inversion of the inlining would involve
// replacing the entire expression with the original and not just the let bindings alone.
| NoSequencePointAtStickyBinding
// Given 'let v = e1 in e2', where this is a compiler generated binding,
// we are sometimes forced to generate a sequence point for the expression anyway based on its
// overall range. If the let binding is given the flag below then it is asserting that
// the binding has no interesting side effects and can be totally ignored and the range
// of the inner expression is used instead
| NoSequencePointAtInvisibleBinding
// Don't drop sequence points when combining sequence points
member x.Combine(y:SequencePointInfoForBinding) =
match x,y with
| SequencePointAtBinding _ as g, _ -> g
| _, (SequencePointAtBinding _ as g) -> g
| _ -> x
/// Indicates if a for loop is 'for x in e1 -> e2', only valid in sequence expressions
type SeqExprOnly =
| SeqExprOnly of bool
/// denotes location of the separator block + optional position of the semicolon (used for tooling support)
type BlockSeparator = range * pos option
/// stores pair: record field name + (true if given record field name is syntactically correct and can be used in name resolution)
type RecordFieldName = LongIdentWithDots * bool
type ExprAtomicFlag =
/// Says that the expression is an atomic expression, i.e. is of a form that has no whitespace unless
/// enclosed in parantheses, e.g. 1, "3", ident, ident.[expr] and (expr). If an atomic expression has
/// type T, then the largest expression ending at the same range as the atomic expression also has type T.
| Atomic = 0
| NonAtomic = 1
/// The kind associated with a binding - "let", "do" or a standalone expression
type SynBindingKind =
/// A standalone expression in a module
| StandaloneExpression
/// A normal 'let' binding in a module
| NormalBinding
/// A 'do' binding in a module. Must have type 'unit'
| DoBinding
type
[<NoEquality; NoComparison>]
/// Represents the explicit declaration of a type parameter
SynTyparDecl =
| TyparDecl of SynAttributes * SynTypar
and
[<NoEquality; NoComparison>]
/// The unchecked abstract syntax tree of F# type constraints
SynTypeConstraint =
/// F# syntax : is 'typar : struct
| WhereTyparIsValueType of SynTypar * range
/// F# syntax : is 'typar : not struct
| WhereTyparIsReferenceType of SynTypar * range
/// F# syntax is 'typar : unmanaged
| WhereTyparIsUnmanaged of SynTypar * range
/// F# syntax is 'typar : null
| WhereTyparSupportsNull of SynTypar * range
/// F# syntax is 'typar : comparison
| WhereTyparIsComparable of SynTypar * range
/// F# syntax is 'typar : equality
| WhereTyparIsEquatable of SynTypar * range
/// F# syntax is default ^T : type
| WhereTyparDefaultsToType of SynTypar * SynType * range
/// F# syntax is 'typar :> type
| WhereTyparSubtypeOfType of SynTypar * SynType * range
/// F# syntax is ^T : (static member MemberName : ^T * int -> ^T)
| WhereTyparSupportsMember of SynTypar list * SynMemberSig * range
/// F# syntax is 'typar : enum<'UnderlyingType>
| WhereTyparIsEnum of SynTypar * SynType list * range
/// F# syntax is 'typar : delegate<'Args,unit>
| WhereTyparIsDelegate of SynTypar * SynType list * range
and
[<NoEquality; NoComparison;RequireQualifiedAccess>]
/// The unchecked abstract syntax tree of F# types
SynType =
/// F# syntax : A.B.C
| LongIdent of LongIdentWithDots
/// App(typeName, LESSm, typeArgs, commasm, GREATERm, isPostfix, m)
///
/// F# syntax : type<type, ..., type> or type type or (type,...,type) type
/// isPostfix: indicates a postfix type application e.g. "int list" or "(int,string) dict"
/// commasm: ranges for interstitial commas, these only matter for parsing/design-time tooling, the typechecker may munge/discard them
| App of SynType * range option * SynType list * range list * range option * bool * range
/// LongIdentApp(typeName, longId, LESSm, tyArgs, commasm, GREATERm, wholem)
///
/// F# syntax : type.A.B.C<type, ..., type>
/// commasm: ranges for interstitial commas, these only matter for parsing/design-time tooling, the typechecker may munge/discard them
| LongIdentApp of SynType * LongIdentWithDots * range option * SynType list * range list * range option * range
/// F# syntax : type * ... * type
// the bool is true if / rather than * follows the type
| Tuple of (bool*SynType) list * range
/// F# syntax : type[]
| Array of int * SynType * range
/// F# syntax : type -> type
| Fun of SynType * SynType * range
/// F# syntax : 'Var
| Var of SynTypar * range
/// F# syntax : _
| Anon of range
/// F# syntax : typ with constraints
| WithGlobalConstraints of SynType * SynTypeConstraint list * range
/// F# syntax : #type
| HashConstraint of SynType * range
/// F# syntax : for units of measure e.g. m / s
| MeasureDivide of SynType * SynType * range
/// F# syntax : for units of measure e.g. m^3, kg^1/2
| MeasurePower of SynType * SynRationalConst * range
/// F# syntax : 1, "abc" etc, used in parameters to type providers
/// For the dimensionless units i.e. 1 , and static parameters to provided types
| StaticConstant of SynConst * range
/// F# syntax : const expr, used in static parameters to type providers
| StaticConstantExpr of SynExpr * range
/// F# syntax : ident=1 etc., used in static parameters to type providers
| StaticConstantNamed of SynType * SynType * range
/// Get the syntactic range of source code covered by this construct.
member x.Range =
match x with
| SynType.LongIdent(lidwd) -> lidwd.Range
| SynType.App(_,_,_,_,_,_,m) | SynType.LongIdentApp(_,_,_,_,_,_,m) | SynType.Tuple(_,m) | SynType.Array(_,_,m) | SynType.Fun(_,_,m)
| SynType.Var(_,m) | SynType.Anon m | SynType.WithGlobalConstraints(_,_,m)
| SynType.StaticConstant(_,m) | SynType.StaticConstantExpr(_,m) | SynType.StaticConstantNamed(_,_,m)
| SynType.HashConstraint(_,m) | SynType.MeasureDivide(_,_,m) | SynType.MeasurePower(_,_,m) -> m
and
[<NoEquality; NoComparison;RequireQualifiedAccess>]
SynExpr =
/// F# syntax: (expr)
///
/// Paren(expr, leftParenRange, rightParenRange, wholeRangeIncludingParentheses)
///
/// Parenthesized expressions. Kept in AST to distinguish A.M((x,y))
/// from A.M(x,y), among other things.
| Paren of SynExpr * range * range option * range
/// F# syntax: <@ expr @>, <@@ expr @@>
///
/// Quote(operator,isRaw,quotedSynExpr,isFromQueryExpression,m)
| Quote of SynExpr * bool * SynExpr * bool * range
/// F# syntax: 1, 1.3, () etc.
| Const of SynConst * range
/// F# syntax: expr : type
| Typed of SynExpr * SynType * range
/// F# syntax: e1, ..., eN
| Tuple of SynExpr list * range list * range // "range list" is for interstitial commas, these only matter for parsing/design-time tooling, the typechecker may munge/discard them
/// F# syntax: [ e1; ...; en ], [| e1; ...; en |]
| ArrayOrList of bool * SynExpr list * range
/// F# syntax: { f1=e1; ...; fn=en }
/// SynExpr.Record((baseType, baseCtorArgs, mBaseCtor, sepAfterBase, mInherits), (copyExpr, sepAfterCopyExpr), (recordFieldName, fieldValue, sepAfterField), mWholeExpr)
/// inherit includes location of separator (for tooling)
/// copyOpt contains range of the following WITH part (for tooling)
/// every field includes range of separator after the field (for tooling)
| Record of (SynType * SynExpr * range * BlockSeparator option * range) option * (SynExpr * BlockSeparator) option * (RecordFieldName * (SynExpr option) * BlockSeparator option) list * range
/// F# syntax: new C(...)
/// The flag is true if known to be 'family' ('protected') scope
| New of bool * SynType * SynExpr * range
/// SynExpr.ObjExpr(objTy,argOpt,binds,extraImpls,mNewExpr,mWholeExpr)
///
/// F# syntax: { new ... with ... }
| ObjExpr of SynType * (SynExpr * Ident option) option * SynBinding list * SynInterfaceImpl list * range * range
/// F# syntax: 'while ... do ...'
| While of SequencePointInfoForWhileLoop * SynExpr * SynExpr * range
/// F# syntax: 'for i = ... to ... do ...'
| For of SequencePointInfoForForLoop * Ident * SynExpr * bool * SynExpr * SynExpr * range
/// SynExpr.ForEach (spBind, seqExprOnly, isFromSource, pat, enumExpr, bodyExpr, mWholeExpr).
///
/// F# syntax: 'for ... in ... do ...'
| ForEach of SequencePointInfoForForLoop * SeqExprOnly * bool * SynPat * SynExpr * SynExpr * range
/// F# syntax: [ expr ], [| expr |]
| ArrayOrListOfSeqExpr of bool * SynExpr * range
/// CompExpr(isArrayOrList, isNotNakedRefCell, expr)
///
/// F# syntax: { expr }
| CompExpr of bool * bool ref * SynExpr * range
/// First bool indicates if lambda originates from a method. Patterns here are always "simple"
/// Second bool indicates if this is a "later" part of an iterated sequence of lambdas
///
/// F# syntax: fun pat -> expr
| Lambda of bool * bool * SynSimplePats * SynExpr * range
/// F# syntax: function pat1 -> expr | ... | patN -> exprN
| MatchLambda of bool * range * SynMatchClause list * SequencePointInfoForBinding * range
/// F# syntax: match expr with pat1 -> expr | ... | patN -> exprN
| Match of SequencePointInfoForBinding * SynExpr * SynMatchClause list * bool * range (* bool indicates if this is an exception match in a computation expression which throws unmatched exceptions *)
/// F# syntax: do expr
| Do of SynExpr * range
/// F# syntax: assert expr
| Assert of SynExpr * range
/// App(exprAtomicFlag, isInfix, funcExpr, argExpr, m)
/// - exprAtomicFlag: indicates if the applciation is syntactically atomic, e.g. f.[1] is atomic, but 'f x' is not
/// - isInfix is true for the first app of an infix operator, e.g. 1+2 becomes App(App(+,1),2), where the inner node is marked isInfix
/// (or more generally, for higher operator fixities, if App(x,y) is such that y comes before x in the source code, then the node is marked isInfix=true)
///
/// F# syntax: f x
| App of ExprAtomicFlag * bool * SynExpr * SynExpr * range
/// TypeApp(expr, mLessThan, types, mCommas, mGreaterThan, mTypeArgs, mWholeExpr)
/// "mCommas" are the ranges for interstitial commas, these only matter for parsing/design-time tooling, the typechecker may munge/discard them
///
/// F# syntax: expr<type1,...,typeN>
| TypeApp of SynExpr * range * SynType list * range list * range option * range * range
/// LetOrUse(isRecursive, isUse, bindings, body, wholeRange)
///
/// F# syntax: let pat = expr in expr
/// F# syntax: let f pat1 .. patN = expr in expr
/// F# syntax: let rec f pat1 .. patN = expr in expr
/// F# syntax: use pat = expr in expr
| LetOrUse of bool * bool * SynBinding list * SynExpr * range
/// F# syntax: try expr with pat -> expr
| TryWith of SynExpr * range * SynMatchClause list * range * range * SequencePointInfoForTry * SequencePointInfoForWith
/// F# syntax: try expr finally expr
| TryFinally of SynExpr * SynExpr * range * SequencePointInfoForTry * SequencePointInfoForFinally
/// F# syntax: lazy expr
| Lazy of SynExpr * range
/// Seq(seqPoint, isTrueSeq, e1, e2, m)
/// isTrueSeq: false indicates "let v = a in b; v"
///
/// F# syntax: expr; expr
| Sequential of SequencePointInfoForSeq * bool * SynExpr * SynExpr * range
/// IfThenElse(exprGuard,exprThen,optionalExprElse,spIfToThen,isFromErrorRecovery,mIfToThen,mIfToEndOfLastBranch)
///
/// F# syntax: if expr then expr
/// F# syntax: if expr then expr else expr
| IfThenElse of SynExpr * SynExpr * SynExpr option * SequencePointInfoForBinding * bool * range * range
/// F# syntax: ident
/// Optimized representation, = SynExpr.LongIdent(false,[id],id.idRange)
| Ident of Ident
/// F# syntax: ident.ident...ident
/// LongIdent(isOptional, longIdent, altNameRefCell, m)
/// isOptional: true if preceded by a '?' for an optional named parameter
/// altNameRefCell: Normally 'None' except for some compiler-generated variables in desugaring pattern matching. See SynSimplePat.Id
| LongIdent of bool * LongIdentWithDots * SynSimplePatAlternativeIdInfo ref option * range
/// F# syntax: ident.ident...ident <- expr
| LongIdentSet of LongIdentWithDots * SynExpr * range
/// DotGet(expr, rangeOfDot, lid, wholeRange)
///
/// F# syntax: expr.ident.ident
| DotGet of SynExpr * range * LongIdentWithDots * range
/// F# syntax: expr.ident...ident <- expr
| DotSet of SynExpr * LongIdentWithDots * SynExpr * range
/// F# syntax: expr.[expr,...,expr]
| DotIndexedGet of SynExpr * SynIndexerArg list * range * range
/// DotIndexedSet (objectExpr, indexExprs, valueExpr, rangeOfLeftOfSet, rangeOfDot, rangeOfWholeExpr)
///
/// F# syntax: expr.[expr,...,expr] <- expr
| DotIndexedSet of SynExpr * SynIndexerArg list * SynExpr * range * range * range
/// F# syntax: Type.Items(e1) <- e2 , rarely used named-property-setter notation, e.g. Foo.Bar.Chars(3) <- 'a'
| NamedIndexedPropertySet of LongIdentWithDots * SynExpr * SynExpr * range
/// F# syntax: expr.Items(e1) <- e2 , rarely used named-property-setter notation, e.g. (stringExpr).Chars(3) <- 'a'
| DotNamedIndexedPropertySet of SynExpr * LongIdentWithDots * SynExpr * SynExpr * range
/// F# syntax: expr :? type
| TypeTest of SynExpr * SynType * range
/// F# syntax: expr :> type
| Upcast of SynExpr * SynType * range
/// F# syntax: expr :?> type
| Downcast of SynExpr * SynType * range
/// F# syntax: upcast expr
| InferredUpcast of SynExpr * range
/// F# syntax: downcast expr
| InferredDowncast of SynExpr * range
/// F# syntax: null
| Null of range
/// F# syntax: &expr, &&expr
| AddressOf of bool * SynExpr * range * range
/// F# syntax: ((typar1 or ... or typarN): (member-dig) expr)
| TraitCall of SynTypar list * SynMemberSig * SynExpr * range
/// F# syntax: ... in ...
/// Computation expressions only, based on JOIN_IN token from lex filter
| JoinIn of SynExpr * range * SynExpr * range
/// F# syntax: <implicit>
/// Computation expressions only, implied by final "do" or "do!"
| ImplicitZero of range
/// F# syntax: yield expr
/// F# syntax: return expr
/// Computation expressions only
| YieldOrReturn of (bool * bool) * SynExpr * range
/// F# syntax: yield! expr
/// F# syntax: return! expr
/// Computation expressions only
| YieldOrReturnFrom of (bool * bool) * SynExpr * range
/// SynExpr.LetOrUseBang(spBind, isUse, isFromSource, pat, rhsExpr, bodyExpr, mWholeExpr).
///
/// F# syntax: let! pat = expr in expr
/// F# syntax: use! pat = expr in expr
/// Computation expressions only
| LetOrUseBang of SequencePointInfoForBinding * bool * bool * SynPat * SynExpr * SynExpr * range
/// F# syntax: do! expr
/// Computation expressions only
| DoBang of SynExpr * range
/// Only used in FSharp.Core
| LibraryOnlyILAssembly of ILInstr array * SynType list * SynExpr list * SynType list * range (* Embedded IL assembly code *)
/// Only used in FSharp.Core
| LibraryOnlyStaticOptimization of SynStaticOptimizationConstraint list * SynExpr * SynExpr * range
/// Only used in FSharp.Core
| LibraryOnlyUnionCaseFieldGet of SynExpr * LongIdent * int * range
/// Only used in FSharp.Core
| LibraryOnlyUnionCaseFieldSet of SynExpr * LongIdent * int * SynExpr * range
/// Inserted for error recovery
| ArbitraryAfterError of (*debugStr:*) string * range
/// Inserted for error recovery
| FromParseError of SynExpr * range
/// Inserted for error recovery when there is "expr." and missing tokens or error recovery after the dot
| DiscardAfterMissingQualificationAfterDot of SynExpr * range
/// Get the syntactic range of source code covered by this construct.
member e.Range =
match e with
| SynExpr.Paren(_,_,_,m)
| SynExpr.Quote(_,_,_,_,m)
| SynExpr.Const(_,m)
| SynExpr.Typed (_,_,m)
| SynExpr.Tuple (_,_,m)
| SynExpr.ArrayOrList (_,_,m)
| SynExpr.Record (_,_,_,m)
| SynExpr.New (_,_,_,m)
| SynExpr.ObjExpr (_,_,_,_,_,m)
| SynExpr.While (_,_,_,m)
| SynExpr.For (_,_,_,_,_,_,m)
| SynExpr.ForEach (_,_,_,_,_,_,m)
| SynExpr.CompExpr (_,_,_,m)
| SynExpr.ArrayOrListOfSeqExpr (_,_,m)
| SynExpr.Lambda (_,_,_,_,m)
| SynExpr.Match (_,_,_,_,m)
| SynExpr.MatchLambda (_,_,_,_,m)
| SynExpr.Do (_,m)
| SynExpr.Assert (_,m)
| SynExpr.App (_,_,_,_,m)
| SynExpr.TypeApp (_,_,_,_,_,_,m)
| SynExpr.LetOrUse (_,_,_,_,m)
| SynExpr.TryWith (_,_,_,_,m,_,_)
| SynExpr.TryFinally (_,_,m,_,_)
| SynExpr.Sequential (_,_,_,_,m)
| SynExpr.ArbitraryAfterError(_,m)
| SynExpr.FromParseError (_,m)
| SynExpr.DiscardAfterMissingQualificationAfterDot (_,m)
| SynExpr.IfThenElse (_,_,_,_,_,_,m)
| SynExpr.LongIdent (_,_,_,m)
| SynExpr.LongIdentSet (_,_,m)
| SynExpr.NamedIndexedPropertySet (_,_,_,m)
| SynExpr.DotIndexedGet (_,_,_,m)
| SynExpr.DotIndexedSet (_,_,_,_,_,m)
| SynExpr.DotGet (_,_,_,m)
| SynExpr.DotSet (_,_,_,m)
| SynExpr.DotNamedIndexedPropertySet (_,_,_,_,m)
| SynExpr.LibraryOnlyUnionCaseFieldGet (_,_,_,m)
| SynExpr.LibraryOnlyUnionCaseFieldSet (_,_,_,_,m)
| SynExpr.LibraryOnlyILAssembly (_,_,_,_,m)
| SynExpr.LibraryOnlyStaticOptimization (_,_,_,m)
| SynExpr.TypeTest (_,_,m)
| SynExpr.Upcast (_,_,m)
| SynExpr.AddressOf (_,_,_,m)
| SynExpr.Downcast (_,_,m)
| SynExpr.JoinIn (_,_,_,m)
| SynExpr.InferredUpcast (_,m)
| SynExpr.InferredDowncast (_,m)
| SynExpr.Null m
| SynExpr.Lazy (_, m)
| SynExpr.TraitCall(_,_,_,m)
| SynExpr.ImplicitZero (m)
| SynExpr.YieldOrReturn (_,_,m)
| SynExpr.YieldOrReturnFrom (_,_,m)
| SynExpr.LetOrUseBang (_,_,_,_,_,_,m)
| SynExpr.DoBang (_,m) -> m
| SynExpr.Ident id -> id.idRange
/// range ignoring any (parse error) extra trailing dots
member e.RangeSansAnyExtraDot =
match e with
| SynExpr.Paren(_,_,_,m)
| SynExpr.Quote(_,_,_,_,m)
| SynExpr.Const(_,m)
| SynExpr.Typed (_,_,m)
| SynExpr.Tuple (_,_,m)
| SynExpr.ArrayOrList (_,_,m)
| SynExpr.Record (_,_,_,m)
| SynExpr.New (_,_,_,m)
| SynExpr.ObjExpr (_,_,_,_,_,m)
| SynExpr.While (_,_,_,m)
| SynExpr.For (_,_,_,_,_,_,m)
| SynExpr.ForEach (_,_,_,_,_,_,m)
| SynExpr.CompExpr (_,_,_,m)
| SynExpr.ArrayOrListOfSeqExpr (_,_,m)
| SynExpr.Lambda (_,_,_,_,m)
| SynExpr.Match (_,_,_,_,m)
| SynExpr.MatchLambda (_,_,_,_,m)
| SynExpr.Do (_,m)
| SynExpr.Assert (_,m)
| SynExpr.App (_,_,_,_,m)
| SynExpr.TypeApp (_,_,_,_,_,_,m)
| SynExpr.LetOrUse (_,_,_,_,m)
| SynExpr.TryWith (_,_,_,_,m,_,_)
| SynExpr.TryFinally (_,_,m,_,_)
| SynExpr.Sequential (_,_,_,_,m)
| SynExpr.ArbitraryAfterError(_,m)
| SynExpr.FromParseError (_,m)
| SynExpr.IfThenElse (_,_,_,_,_,_,m)
| SynExpr.LongIdentSet (_,_,m)
| SynExpr.NamedIndexedPropertySet (_,_,_,m)
| SynExpr.DotIndexedGet (_,_,_,m)
| SynExpr.DotIndexedSet (_,_,_,_,_,m)
| SynExpr.DotSet (_,_,_,m)
| SynExpr.DotNamedIndexedPropertySet (_,_,_,_,m)
| SynExpr.LibraryOnlyUnionCaseFieldGet (_,_,_,m)
| SynExpr.LibraryOnlyUnionCaseFieldSet (_,_,_,_,m)
| SynExpr.LibraryOnlyILAssembly (_,_,_,_,m)
| SynExpr.LibraryOnlyStaticOptimization (_,_,_,m)
| SynExpr.TypeTest (_,_,m)
| SynExpr.Upcast (_,_,m)
| SynExpr.AddressOf (_,_,_,m)
| SynExpr.Downcast (_,_,m)
| SynExpr.JoinIn (_,_,_,m)
| SynExpr.InferredUpcast (_,m)
| SynExpr.InferredDowncast (_,m)
| SynExpr.Null m
| SynExpr.Lazy (_, m)
| SynExpr.TraitCall(_,_,_,m)
| SynExpr.ImplicitZero (m)
| SynExpr.YieldOrReturn (_,_,m)
| SynExpr.YieldOrReturnFrom (_,_,m)
| SynExpr.LetOrUseBang (_,_,_,_,_,_,m)
| SynExpr.DoBang (_,m) -> m
| SynExpr.DotGet (expr,_,lidwd,m) -> if lidwd.ThereIsAnExtraDotAtTheEnd then unionRanges expr.Range lidwd.RangeSansAnyExtraDot else m
| SynExpr.LongIdent (_,lidwd,_,_) -> lidwd.RangeSansAnyExtraDot
| SynExpr.DiscardAfterMissingQualificationAfterDot (expr,_) -> expr.Range
| SynExpr.Ident id -> id.idRange
/// Attempt to get the range of the first token or initial portion only - this is extremely ad-hoc, just a cheap way to improve a certain 'query custom operation' error range
member e.RangeOfFirstPortion =
match e with
// haven't bothered making these cases better than just .Range
| SynExpr.Quote(_,_,_,_,m)
| SynExpr.Const(_,m)
| SynExpr.Typed (_,_,m)
| SynExpr.Tuple (_,_,m)
| SynExpr.ArrayOrList (_,_,m)
| SynExpr.Record (_,_,_,m)
| SynExpr.New (_,_,_,m)
| SynExpr.ObjExpr (_,_,_,_,_,m)
| SynExpr.While (_,_,_,m)
| SynExpr.For (_,_,_,_,_,_,m)
| SynExpr.CompExpr (_,_,_,m)
| SynExpr.ArrayOrListOfSeqExpr (_,_,m)
| SynExpr.Lambda (_,_,_,_,m)
| SynExpr.Match (_,_,_,_,m)
| SynExpr.MatchLambda (_,_,_,_,m)
| SynExpr.Do (_,m)
| SynExpr.Assert (_,m)
| SynExpr.TypeApp (_,_,_,_,_,_,m)
| SynExpr.LetOrUse (_,_,_,_,m)
| SynExpr.TryWith (_,_,_,_,m,_,_)
| SynExpr.TryFinally (_,_,m,_,_)
| SynExpr.ArbitraryAfterError(_,m)
| SynExpr.FromParseError (_,m)
| SynExpr.DiscardAfterMissingQualificationAfterDot (_,m)
| SynExpr.IfThenElse (_,_,_,_,_,_,m)
| SynExpr.LongIdent (_,_,_,m)
| SynExpr.LongIdentSet (_,_,m)
| SynExpr.NamedIndexedPropertySet (_,_,_,m)
| SynExpr.DotIndexedGet (_,_,_,m)
| SynExpr.DotIndexedSet (_,_,_,_,_,m)
| SynExpr.DotGet (_,_,_,m)
| SynExpr.DotSet (_,_,_,m)
| SynExpr.DotNamedIndexedPropertySet (_,_,_,_,m)
| SynExpr.LibraryOnlyUnionCaseFieldGet (_,_,_,m)
| SynExpr.LibraryOnlyUnionCaseFieldSet (_,_,_,_,m)
| SynExpr.LibraryOnlyILAssembly (_,_,_,_,m)
| SynExpr.LibraryOnlyStaticOptimization (_,_,_,m)
| SynExpr.TypeTest (_,_,m)
| SynExpr.Upcast (_,_,m)
| SynExpr.AddressOf (_,_,_,m)
| SynExpr.Downcast (_,_,m)
| SynExpr.JoinIn (_,_,_,m)
| SynExpr.InferredUpcast (_,m)
| SynExpr.InferredDowncast (_,m)
| SynExpr.Null m
| SynExpr.Lazy (_, m)
| SynExpr.TraitCall(_,_,_,m)
| SynExpr.ImplicitZero (m)
| SynExpr.YieldOrReturn (_,_,m)
| SynExpr.YieldOrReturnFrom (_,_,m)
| SynExpr.LetOrUseBang (_,_,_,_,_,_,m)
| SynExpr.DoBang (_,m) -> m
// these are better than just .Range, and also commonly applicable inside queries
| SynExpr.Paren(_,m,_,_) -> m
| SynExpr.Sequential (_,_,e1,_,_)
| SynExpr.App (_,_,e1,_,_) ->
e1.RangeOfFirstPortion
| SynExpr.ForEach (_,_,_,pat,_,_,m) ->
let start = m.Start
let e = (pat.Range : range).Start
mkRange m.FileName start e
| SynExpr.Ident id -> id.idRange
and
[<NoEquality; NoComparison; RequireQualifiedAccess>]
SynIndexerArg =
| Two of SynExpr * SynExpr
| One of SynExpr
member x.Range = match x with Two (e1,e2) -> unionRanges e1.Range e2.Range | One e -> e.Range
member x.Exprs = match x with Two (e1,e2) -> [e1;e2] | One e -> [e]
and
[<NoEquality; NoComparison; RequireQualifiedAccess>]
SynSimplePat =
/// Id (ident, altNameRefCell, isCompilerGenerated, isThisVar, isOptArg, range)
///
/// Indicates a simple pattern variable.
///
/// altNameRefCell
/// Normally 'None' except for some compiler-generated variables in desugaring pattern matching.
/// Pattern processing sets this reference for hidden variable introduced by desugaring pattern matching in arguments.
/// The info indicates an alternative (compiler generated) identifier to be used because the name of the identifier is already bound.
/// See Product Studio FSharp 1.0, bug 6389.
///
/// isCompilerGenerated : true if a compiler generated name
/// isThisVar: true if 'this' variable in member
/// isOptArg: true if a '?' is in front of the name
| Id of Ident * SynSimplePatAlternativeIdInfo ref option * bool * bool * bool * range
| Typed of SynSimplePat * SynType * range
| Attrib of SynSimplePat * SynAttributes * range
and SynSimplePatAlternativeIdInfo =
/// We have not decided to use an alternative name in tha pattern and related expression
| Undecided of Ident
/// We have decided to use an alternative name in tha pattern and related expression
| Decided of Ident
and
[<NoEquality; NoComparison>]
SynStaticOptimizationConstraint =
| WhenTyparTyconEqualsTycon of SynTypar * SynType * range
| WhenTyparIsStruct of SynTypar * range
and
[<NoEquality; NoComparison;RequireQualifiedAccess>]
/// Represents a simple set of variable bindings a, (a,b) or (a:Type,b:Type) at a lambda,
/// function definition or other binding point, after the elimination of pattern matching
/// from the construct, e.g. after changing a "function pat1 -> rule1 | ..." to a
/// "fun v -> match v with ..."
SynSimplePats =
| SimplePats of SynSimplePat list * range
| Typed of SynSimplePats * SynType * range
and SynConstructorArgs =
| Pats of SynPat list
| NamePatPairs of (Ident * SynPat) list * range
and
[<NoEquality; NoComparison;RequireQualifiedAccess>]
SynPat =
| Const of SynConst * range
| Wild of range
| Named of SynPat * Ident * bool (* true if 'this' variable *) * SynAccess option * range
| Typed of SynPat * SynType * range
| Attrib of SynPat * SynAttributes * range
| Or of SynPat * SynPat * range
| Ands of SynPat list * range
| LongIdent of LongIdentWithDots * (* holds additional ident for tooling *) Ident option * SynValTyparDecls option (* usually None: temporary used to parse "f<'a> x = x"*) * SynConstructorArgs * SynAccess option * range
| Tuple of SynPat list * range
| Paren of SynPat * range
| ArrayOrList of bool * SynPat list * range
| Record of ((LongIdent * Ident) * SynPat) list * range
/// 'null'
| Null of range
/// '?id' -- for optional argument names
| OptionalVal of Ident * range
/// ':? type '
| IsInst of SynType * range
/// <@ expr @>, used for active pattern arguments
| QuoteExpr of SynExpr * range
/// Deprecated character ranges
| DeprecatedCharRange of char * char * range
/// Used internally in the type checker
| InstanceMember of Ident * Ident * (* holds additional ident for tooling *) Ident option * SynAccess option * range (* adhoc overloaded method/property *)
/// A pattern arising from a parse error
| FromParseError of SynPat * range
member p.Range =
match p with
| SynPat.Const(_,m) | SynPat.Wild m | SynPat.Named (_,_,_,_,m) | SynPat.Or (_,_,m) | SynPat.Ands (_,m)
| SynPat.LongIdent (_,_,_,_,_,m) | SynPat.ArrayOrList(_,_,m) | SynPat.Tuple (_,m) |SynPat.Typed(_,_,m) |SynPat.Attrib(_,_,m)
| SynPat.Record (_,m) | SynPat.DeprecatedCharRange (_,_,m) | SynPat.Null m | SynPat.IsInst (_,m) | SynPat.QuoteExpr (_,m)
| SynPat.InstanceMember(_,_,_,_,m) | SynPat.OptionalVal(_,m) | SynPat.Paren(_,m)
| SynPat.FromParseError (_,m) -> m
and
[<NoEquality; NoComparison>]
SynInterfaceImpl =
| InterfaceImpl of SynType * SynBinding list * range
and
[<NoEquality; NoComparison>]
SynMatchClause =
| Clause of SynPat * SynExpr option * SynExpr * range * SequencePointInfoForTarget
member this.RangeOfGuardAndRhs =
match this with
| Clause(_,eo,e,_,_) ->
match eo with
| None -> e.Range
| Some x -> unionRanges e.Range x.Range
member this.Range =
match this with
| Clause(_,eo,e,m,_) ->
match eo with
| None -> unionRanges e.Range m
| Some x -> unionRanges (unionRanges e.Range m) x.Range
and SynAttributes = SynAttribute list
and
[<NoEquality; NoComparison; RequireQualifiedAccess>]
SynAttribute =
{ TypeName: LongIdentWithDots;
ArgExpr: SynExpr
/// Target specifier, e.g. "assembly","module",etc.
Target: Ident option