Skip to content

Commit

Permalink
single promise
Browse files Browse the repository at this point in the history
  • Loading branch information
Kha committed Jul 20, 2024
1 parent 04025e5 commit 68f2d58
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/Lean/Language/Lean.lean
Original file line number Diff line number Diff line change
Expand Up @@ -385,20 +385,19 @@ where
tacticCache
ctx

let next? ← if Parser.isTerminalCommand stx then pure none
if Parser.isTerminalCommand stx then
prom.resolve <| .mk (nextCmdSnap? := none) <| Runtime.markPersistent {
diagnostics := (← Snapshot.Diagnostics.ofMessageLog msgLog)
stx
parserState
elabSnap := { range? := stx.getRange?, task := elabPromise.result }
finishedSnap
tacticCache
}
-- for now, wait on "command finished" snapshot before parsing next command
else some <$> IO.Promise.new
prom.resolve <| .mk (nextCmdSnap? := next?.map ({ range? := none, task := ·.result })) <| Runtime.markPersistent {
diagnostics := (← Snapshot.Diagnostics.ofMessageLog msgLog)
stx
parserState
elabSnap := { range? := stx.getRange?, task := elabPromise.result }
finishedSnap
tacticCache
}
if let some next := next? then
else
finishedSnap.get |> fun finished =>
parseCmd none parserState finished.cmdState next ctx
parseCmd none parserState finished.cmdState prom ctx

doElab (stx : Syntax) (cmdState : Command.State) (beginPos : String.Pos)
(snap : SnapshotBundle DynamicSnapshot) (tacticCache : IO.Ref Tactic.Cache) :
Expand Down

0 comments on commit 68f2d58

Please sign in to comment.