Skip to content

Commit

Permalink
Fantomas
Browse files Browse the repository at this point in the history
  • Loading branch information
auduchinok committed Dec 1, 2023
1 parent e0af85f commit 508ce09
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions src/Compiler/SyntaxTree/ParseHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1141,32 +1141,33 @@ let mkAutoPropDefn mVal access ident typ mEquals (expr: SynExpr) accessors xmlDo
)

let mkSynField
parseState
(idOpt: Ident option)
(t: SynType option)
(isMutable: range option)
(vis: SynAccess option)
(attributes: SynAttributes)
(mStatic: range option)
(rangeStart: range)
(leadingKeyword: SynLeadingKeyword option) =
parseState
(idOpt: Ident option)
(t: SynType option)
(isMutable: range option)
(vis: SynAccess option)
(attributes: SynAttributes)
(mStatic: range option)
(rangeStart: range)
(leadingKeyword: SynLeadingKeyword option)
=

let t, mStart =
match t with
| Some value -> value, rangeStart
| None ->

let mType, mStart =
idOpt
|> Option.map _.idRange
|> Option.orElseWith (fun _ -> vis |> Option.map (fun v -> v.Range))
|> Option.orElse isMutable
|> Option.orElseWith (fun _ -> leadingKeyword |> Option.map (fun k -> k.Range))
|> Option.orElseWith (fun _ -> attributes |> List.tryLast |> Option.map (fun l -> l.Range))
|> Option.map (fun m -> m, rangeStart)
|> Option.defaultWith (fun _ -> rangeStart.StartRange, rangeStart.StartRange)

SynType.FromParseError(mType.EndRange), mStart
let mType, mStart =
idOpt
|> Option.map _.idRange
|> Option.orElseWith (fun _ -> vis |> Option.map (fun v -> v.Range))
|> Option.orElse isMutable
|> Option.orElseWith (fun _ -> leadingKeyword |> Option.map (fun k -> k.Range))
|> Option.orElseWith (fun _ -> attributes |> List.tryLast |> Option.map (fun l -> l.Range))
|> Option.map (fun m -> m, rangeStart)
|> Option.defaultWith (fun _ -> rangeStart.StartRange, rangeStart.StartRange)

SynType.FromParseError(mType.EndRange), mStart

let mWhole = unionRanges mStart t.Range
let xmlDoc = grabXmlDocAtRangeStart (parseState, attributes, mWhole)
Expand Down

0 comments on commit 508ce09

Please sign in to comment.