Skip to content

Commit

Permalink
Fix zero with statements wiping caches
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspervdj-luminal authored May 28, 2020
1 parent 5ccbc57 commit e0dbb30
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lib/Fregot/Eval.hs
Original file line number Diff line number Diff line change
Expand Up @@ -588,24 +588,21 @@ evalLiteral lit next
next r
where
localWiths (w : ws) mx = localWith w $ localWiths ws mx
localWiths [] mx = do
c <- view cache >>= Cache.bump
local (cache .~ c) mx
localWiths [] mx = mx

localWith w mx = do
val <- evalTerm (w ^. withAs) >>= ground (w ^. withAnn)
modifier <- case w ^. withPath of
InputWithPath path -> do
input0 <- view inputDoc
input1 <- patchObject (w ^. withAnn) path val input0
pure $ local (inputDoc .~ input1)
pure $ inputDoc .~ input1
DataWithPath path -> do
tree0 <- view rules
tree1 <- patchTree (w ^. withAnn) path val tree0
pure $ local (rules .~ tree1)
-- NOTE(jaspervdj): Should we bump the cache here? I think multiple
-- with statements may lead to inconsistencies right now.
modifier mx
pure $ rules .~ tree1
c <- view cache >>= Cache.bump
local ((cache .~ c) . modifier) mx
{-# INLINE evalLiteral #-}


Expand Down

0 comments on commit e0dbb30

Please sign in to comment.