Skip to content

Commit

Permalink
updated per compiler suggestion #868 (#869)
Browse files Browse the repository at this point in the history
Thanks, sorry it took so long to get back to this!
  • Loading branch information
jcmrva authored Jan 17, 2022
1 parent 6f74c84 commit dc4b88a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions src/FsAutoComplete.Core/UntypedAstUtils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1642,10 +1642,11 @@ module Printf =
let appStack: AppWithArg list ref = ref []

let addAppWithArg appWithArg =
match !appStack with
match appStack.Value with
| lastApp :: _ when not (Range.rangeContainsRange lastApp.Range appWithArg.Range) ->
appStack := [appWithArg]
| _ -> appStack := appWithArg :: !appStack
appStack.Value <- [appWithArg]
| _ ->
appStack.Value <- appWithArg :: appStack.Value

let rec walkImplFileInput (ParsedImplFileInput(_, _, _, _, _, moduleOrNamespaceList, _)) =
List.iter walkSynModuleOrNamespace moduleOrNamespaceList
Expand Down Expand Up @@ -1693,7 +1694,7 @@ module Printf =
and walkExpr e =
match e with
| SynExpr.App (_, _, SynExpr.Ident _, SynExpr.Const (SynConst.String (_, _, stringRange), _), r) ->
match !appStack with
match appStack.Value with
| (lastApp :: _) as apps when Range.rangeContainsRange lastApp.Range e.Range ->
let intersectsWithFuncOrString (arg: Range) =
Range.rangeContainsRange arg stringRange
Expand Down Expand Up @@ -1724,7 +1725,7 @@ module Printf =
Args = args }
result.Add res
| _ -> ()
appStack := []
appStack.Value <- []
| SynExpr.App (_, _, SynExpr.App(_, true, SynExpr.Ident op, e1, _), e2, _) ->
let rec deconstruct = function
| SynExpr.Paren (exp, _, _, _) -> deconstruct exp
Expand Down
6 changes: 3 additions & 3 deletions src/FsAutoComplete.Core/Utils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -520,9 +520,9 @@ module String =

[| let line = ref (reader.ReadLine())

while not (isNull (!line)) do
yield !line
line := reader.ReadLine()
while not (isNull (line.Value)) do
yield line.Value
line.Value <- reader.ReadLine()

if str.EndsWith("\n") then
// last trailing space not returned
Expand Down

0 comments on commit dc4b88a

Please sign in to comment.