1
1
mirror of https://github.com/github/semantic.git synced 2024-12-11 08:45:48 +03:00

address returns a slot

This commit is contained in:
joshvera 2018-11-05 16:08:50 -05:00
parent 9a1fc0f063
commit cb0c4ac8f2

View File

@ -25,7 +25,7 @@ module Control.Abstract.Value
, runWhile , runWhile
, WhileC(..) , WhileC(..)
, makeNamespace , makeNamespace
-- , address , address
, value , value
, rvalBox , rvalBox
) where ) where
@ -105,6 +105,7 @@ instance Effect (Function term address value) where
handle state handler (Call fn self addrs k) = Call fn self addrs (handler . (<$ state) . k) handle state handler (Call fn self addrs k) = Call fn self addrs (handler . (<$ state) . k)
-- TODO: eval and runFunction should return a ValueRef instead of a value
runFunction :: Carrier (Function term address value :+: sig) (FunctionC term address value (Eff m)) runFunction :: Carrier (Function term address value :+: sig) (FunctionC term address value (Eff m))
=> (term -> Evaluator term address value (FunctionC term address value (Eff m)) value) => (term -> Evaluator term address value (FunctionC term address value (Eff m)) value)
-> Evaluator term address value (FunctionC term address value (Eff m)) a -> Evaluator term address value (FunctionC term address value (Eff m)) a
@ -359,18 +360,20 @@ value (LvalLocal name) = undefined
value (LvalMember slot) = undefined value (LvalMember slot) = undefined
-- | Returns the address of a value referenced by a 'ValueRef' -- | Returns the address of a value referenced by a 'ValueRef'
-- address :: ( AbstractValue term address value m address :: ( AbstractValue term address value m
-- , Carrier sig m , Carrier sig m
-- , Member (Env address) sig , Member (State (Heap address address value)) sig
-- , Member (Reader ModuleInfo) sig , Member (State (ScopeGraph address)) sig
-- , Member (Reader Span) sig , Member (Resumable (BaseError (ScopeError address))) sig
-- , Member (Resumable (BaseError (EnvironmentError address))) sig , Member (Resumable (BaseError (HeapError address))) sig
-- ) , Member (Reader ModuleInfo) sig
-- => ValueRef address , Member (Reader Span) sig
-- -> Evaluator term address value m address )
-- address (LvalLocal var) = variable var => ValueRef address value
-- address (LvalMember ptr prop) = evaluateInScopedEnv ptr (variable prop) -> Evaluator term address value m (Address address)
-- address (Rval addr) = pure addr address (LvalLocal name) = undefined
address (LvalMember slot) = pure slot
address (Rval value) = undefined
-- | Convenience function for boxing a raw value and wrapping it in an Rval -- | Convenience function for boxing a raw value and wrapping it in an Rval
rvalBox :: ( Member (Allocator address) sig rvalBox :: ( Member (Allocator address) sig