From 9b6f7dd148a155d82f1fdb22fe861a92e2dbedd2 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 22 Jul 2019 11:32:58 -0400 Subject: [PATCH] Obj holds an Env, not a Frame. --- semantic-core/src/Analysis/Concrete.hs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/semantic-core/src/Analysis/Concrete.hs b/semantic-core/src/Analysis/Concrete.hs index 368d005d9..dbdcad287 100644 --- a/semantic-core/src/Analysis/Concrete.hs +++ b/semantic-core/src/Analysis/Concrete.hs @@ -44,10 +44,10 @@ data Concrete | Unit | Bool Bool | String Text - | Obj Frame + | Obj Env deriving (Eq, Ord, Show) -objectFrame :: Concrete -> Maybe Frame +objectFrame :: Concrete -> Maybe Env objectFrame (Obj frame) = Just frame objectFrame _ = Nothing @@ -120,7 +120,7 @@ concreteAnalysis = Analysis{..} addr <- alloc name assign addr value pure (name, addr) - pure (Obj (Frame (Map.fromList fields'))) + pure (Obj (Map.fromList fields')) addr ... n = do val <- deref addr heap <- get @@ -133,7 +133,7 @@ lookupConcrete heap name = run . evalState IntSet.empty . runNonDet . inConcrete where -- look up the name in a concrete value inConcrete = inFrame <=< maybeA . objectFrame -- look up the name in a specific 'Frame', with slots taking precedence over parents - inFrame (Frame fs) = maybeA (Map.lookup name fs) + inFrame fs = maybeA (Map.lookup name fs) -- look up the name in the value an address points to, if we haven’t already visited it _inAddress addr = do visited <- get @@ -162,8 +162,7 @@ heapGraph vertex edge h = foldr (uncurry graph) G.empty (IntMap.toList h) Bool _ -> G.empty String _ -> G.empty Closure _ _ _ -> G.empty - Obj frame -> fromFrame frame - fromFrame (Frame ss) = foldr (G.overlay . uncurry (edge . Right)) G.empty (Map.toList ss) + Obj frame -> foldr (G.overlay . uncurry (edge . Right)) G.empty (Map.toList frame) heapValueGraph :: Heap -> G.Graph Concrete heapValueGraph h = heapGraph (const id) (const fromAddr) h