Skip to content

Commit

Permalink
Use standard options (dotnet#2075)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinRansom authored Dec 22, 2016
1 parent 9ae2d6c commit 04c5e59
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions Common/CommonHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,6 @@ type internal SymbolLookupKind =
| ByRightColumn
| ByLongIdent

[<RequireQualifiedAccess>]
module Option =
/// Gets the value associated with the option or the supplied default value.
let inline getOrElse v = function
| Some x -> x | None -> v

/// Gets the option if Some x, otherwise try to get another value
let inline orTry f =
function
| Some x -> Some x
| None -> f()

module internal CommonHelpers =
type private SourceLineData(lineStart: int, lexStateAtStartOfLine: FSharpTokenizerLexState, lexStateAtEndOfLine: FSharpTokenizerLexState,
hashCode: int, classifiedSpans: IReadOnlyList<ClassifiedSpan>, tokens: FSharpTokenInfo list) =
Expand Down Expand Up @@ -318,7 +306,7 @@ module internal CommonHelpers =
| LexerSymbolKind.GenericTypeParameter
| LexerSymbolKind.StaticallyResolvedTypeParameter -> true
| _ -> false)
|> Option.orTry (fun _ -> tokensUnderCursor |> List.tryFind (fun { DraftToken.Kind = k } -> k = LexerSymbolKind.Operator))
|> Option.orElseWith (fun _ -> tokensUnderCursor |> List.tryFind (fun { DraftToken.Kind = k } -> k = LexerSymbolKind.Operator))
|> Option.map (fun token ->
{ Kind = token.Kind
Line = linePos.Line
Expand Down

0 comments on commit 04c5e59

Please sign in to comment.