feat(repl): Record last scope
This commit is contained in:
parent
bc37482212
commit
3e55b4b22f
|
@ -13,6 +13,9 @@ structure State where
|
||||||
nextId: Nat := 0
|
nextId: Nat := 0
|
||||||
goalStates: Std.HashMap Nat GoalState := Std.HashMap.empty
|
goalStates: Std.HashMap Nat GoalState := Std.HashMap.empty
|
||||||
|
|
||||||
|
-- Parser state
|
||||||
|
scope : Elab.Command.Scope := { header := "" }
|
||||||
|
|
||||||
/-- Main state monad for executing commands -/
|
/-- Main state monad for executing commands -/
|
||||||
abbrev MainM := ReaderT Context $ StateRefT State CoreM
|
abbrev MainM := ReaderT Context $ StateRefT State CoreM
|
||||||
/-- Fallible subroutine return type -/
|
/-- Fallible subroutine return type -/
|
||||||
|
@ -85,6 +88,9 @@ def frontend_process_inner (args: Protocol.FrontendProcess): MainM (CR Protocol.
|
||||||
let (li, state') ← frontendM.run context |>.run state
|
let (li, state') ← frontendM.run context |>.run state
|
||||||
if args.inheritEnv then
|
if args.inheritEnv then
|
||||||
setEnv state'.commandState.env
|
setEnv state'.commandState.env
|
||||||
|
if let .some scope := state'.commandState.scopes.head? then
|
||||||
|
-- modify the scope
|
||||||
|
set { (← get) with scope }
|
||||||
let units ← li.mapM λ step => withEnv step.env do
|
let units ← li.mapM λ step => withEnv step.env do
|
||||||
let newConstants? := if args.newConstants then
|
let newConstants? := if args.newConstants then
|
||||||
.some $ step.newConstants.toArray.map λ name => name.toString
|
.some $ step.newConstants.toArray.map λ name => name.toString
|
||||||
|
|
Loading…
Reference in New Issue