1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

🔥 the parent addr from the import & scope graph analyses.

This commit is contained in:
Rob Rix 2019-07-25 13:09:16 -04:00
parent 53e08b38ba
commit 3654aac2c8
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7
2 changed files with 6 additions and 12 deletions

View File

@ -41,7 +41,7 @@ instance Monoid Value where
mempty = Value Abstract mempty
data Semi
= Closure Loc User (Term Core.Core User) User
= Closure Loc User (Term Core.Core User)
-- FIXME: Bound String values.
| String Text
| Abstract
@ -58,7 +58,6 @@ importGraph
runFile :: ( Carrier sig m
, Effect sig
, Member Fresh sig
, Member (Reader (FrameId User)) sig
, Member (State (Heap User Value)) sig
)
=> File (Term Core.Core User)
@ -72,7 +71,6 @@ runFile file = traverse run file
-- FIXME: decompose into a product domain and two atomic domains
importGraphAnalysis :: ( Alternative m
, Carrier sig m
, Member (Reader (FrameId User)) sig
, Member (Reader Loc) sig
, Member (State (Heap User Value)) sig
, MonadFail m
@ -86,9 +84,8 @@ importGraphAnalysis = Analysis{..}
assign addr ty = modify (Map.insertWith (<>) addr (Set.singleton ty))
abstract _ name body = do
loc <- ask
FrameId parentAddr <- ask
pure (Value (Closure loc name body parentAddr) mempty)
apply eval (Value (Closure loc name body _) _) a = local (const loc) $ do
pure (Value (Closure loc name body) mempty)
apply eval (Value (Closure loc name body) _) a = local (const loc) $ do
addr <- alloc name
assign addr a
bind name addr (eval body)

View File

@ -49,7 +49,7 @@ instance Monoid Value where
mempty = Value Abstract mempty
data Semi
= Closure Loc User (Term Core.Core User) User
= Closure Loc User (Term Core.Core User)
| Abstract
deriving (Eq, Ord, Show)
@ -65,7 +65,6 @@ runFile
:: ( Carrier sig m
, Effect sig
, Member Fresh sig
, Member (Reader (FrameId User)) sig
, Member (State (Heap User Value)) sig
)
=> File (Term Core.Core User)
@ -80,7 +79,6 @@ runFile file = traverse run file
scopeGraphAnalysis
:: ( Alternative m
, Carrier sig m
, Member (Reader (FrameId User)) sig
, Member (Reader Loc) sig
, Member (State (Heap User Value)) sig
, MonadFail m
@ -94,9 +92,8 @@ scopeGraphAnalysis = Analysis{..}
assign addr ty = modify (Map.insertWith (<>) addr (Set.singleton ty))
abstract _ name body = do
loc <- ask
FrameId parentAddr <- ask
pure (Value (Closure loc name body parentAddr) mempty)
apply eval (Value (Closure loc name body _) _) a = local (const loc) $ do
pure (Value (Closure loc name body) mempty)
apply eval (Value (Closure loc name body) _) a = local (const loc) $ do
addr <- alloc name
assign addr a
bind name addr (eval body)