mirror of
https://github.com/github/semantic.git
synced 2025-01-02 12:23:08 +03:00
Change scopedEnvironment to return the address of an Object
This commit is contained in:
parent
994fd861c5
commit
3de1cbce5b
@ -297,7 +297,7 @@ class AbstractIntro value => AbstractValue term address value carrier where
|
|||||||
-> Evaluator term address value carrier value
|
-> Evaluator term address value carrier value
|
||||||
|
|
||||||
-- | Extract the environment from any scoped object (e.g. classes, namespaces, etc).
|
-- | Extract the environment from any scoped object (e.g. classes, namespaces, etc).
|
||||||
scopedEnvironment :: address -> Evaluator term address value carrier (Maybe (Environment address))
|
scopedEnvironment :: value -> Evaluator term address value carrier (Maybe address)
|
||||||
|
|
||||||
|
|
||||||
-- TODO rethink whether this function is necessary.
|
-- TODO rethink whether this function is necessary.
|
||||||
|
@ -114,7 +114,7 @@ instance AbstractValue term address Abstract m where
|
|||||||
klass _ _ _ = pure Abstract
|
klass _ _ _ = pure Abstract
|
||||||
namespace _ _ _ = pure Abstract
|
namespace _ _ _ = pure Abstract
|
||||||
|
|
||||||
scopedEnvironment _ = pure lowerBound
|
scopedEnvironment _ = pure Nothing
|
||||||
|
|
||||||
asString _ = pure ""
|
asString _ = pure ""
|
||||||
asPair _ = pure (Abstract, Abstract)
|
asPair _ = pure (Abstract, Abstract)
|
||||||
|
@ -272,7 +272,9 @@ instance ( Member (Allocator address) sig
|
|||||||
-- | Namespace _ _ binds' <- v = pure binds'
|
-- | Namespace _ _ binds' <- v = pure binds'
|
||||||
-- | otherwise = throwValueError $ NamespaceError ("expected " <> show v <> " to be a namespace")
|
-- | otherwise = throwValueError $ NamespaceError ("expected " <> show v <> " to be a namespace")
|
||||||
|
|
||||||
-- scopedEnvironment = deref >=> materializeEnvironment
|
scopedEnvironment v
|
||||||
|
| Object address <- v = pure (Just address)
|
||||||
|
| otherwise = pure Nothing
|
||||||
|
|
||||||
asString v
|
asString v
|
||||||
| String n <- v = pure n
|
| String n <- v = pure n
|
||||||
|
@ -359,7 +359,7 @@ instance ( Member Fresh sig
|
|||||||
klass _ _ _ = pure Object
|
klass _ _ _ = pure Object
|
||||||
namespace _ _ _ = pure Unit
|
namespace _ _ _ = pure Unit
|
||||||
|
|
||||||
scopedEnvironment _ = pure (Just lowerBound)
|
scopedEnvironment _ = pure Nothing
|
||||||
|
|
||||||
asString t = unify t String $> ""
|
asString t = unify t String $> ""
|
||||||
asPair t = do
|
asPair t = do
|
||||||
|
Loading…
Reference in New Issue
Block a user