mirror of
https://github.com/github/semantic.git
synced 2024-12-15 01:51:39 +03:00
Set currentScope and currentFrame after running an initial action
Co-Authored-By: Josh Vera <vera@github.com>
This commit is contained in:
parent
cbafcd8114
commit
d020f71862
@ -177,7 +177,9 @@ withFrame address action = do
|
||||
prevFrame <- currentFrame @address @value
|
||||
modify @(Heap address address value) (\h -> h { Heap.currentFrame = Just address })
|
||||
value <- action
|
||||
modify @(Heap address address value) (\h -> h { Heap.currentFrame = prevFrame })
|
||||
case prevFrame of
|
||||
Nothing -> modify @(Heap address address value) (\h -> h { Heap.currentFrame = Just address })
|
||||
_ -> modify @(Heap address address value) (\h -> h { Heap.currentFrame = prevFrame })
|
||||
pure value
|
||||
|
||||
-- box :: ( Member (Allocator address) effects
|
||||
|
@ -191,7 +191,9 @@ withScope scope action = do
|
||||
prevScope <- currentScope
|
||||
modify (\g -> g { ScopeGraph.currentScope = Just scope })
|
||||
value <- action
|
||||
modify (\g -> g { ScopeGraph.currentScope = prevScope })
|
||||
case prevScope of
|
||||
Nothing -> modify (\g -> g { ScopeGraph.currentScope = Just scope })
|
||||
_ -> modify (\g -> g { ScopeGraph.currentScope = prevScope })
|
||||
pure value
|
||||
|
||||
putCurrentScope :: (Ord address, Member (State (ScopeGraph address)) sig, Carrier sig m) => address -> Evaluator term address value m ()
|
||||
|
Loading…
Reference in New Issue
Block a user