1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 00:33:59 +03:00

objectMembers

Co-Authored-By: Rob Rix <rob.rix@github.com>
This commit is contained in:
joshvera 2018-11-26 13:06:01 -05:00
parent ce40ee2d37
commit 7ade83a367

View File

@ -15,6 +15,7 @@ module SpecHelpers
, LogQueue , LogQueue
, StatQueue , StatQueue
, lookupDeclaration , lookupDeclaration
, objectMembers
) where ) where
import Control.Abstract hiding (lookupDeclaration) import Control.Abstract hiding (lookupDeclaration)
@ -151,16 +152,22 @@ testEvaluating
type Val term = Value term Precise type Val term = Value term Precise
-- deNamespace :: Heap Precise Precise (Value term Precise) objectMembers :: Heap Precise Precise (Value term Precise)
-- -> Value term Precise -> ScopeGraph Precise
-- -> Maybe (Name, [Name]) -> Value term Precise
-- deNamespace heap ns@(Namespace name _ _) = (,) name . Env.allNames <$> namespaceScope heap ns -> Maybe [Name]
-- deNamespace _ _ = Nothing objectMembers heap scopeGraph (Object frame) = frameNames heap scopeGraph frame
objectMembers _ _ _ = Nothing
frameNames :: Heap Precise Precise (Value term Precise)
-> ScopeGraph Precise
-> Precise
-> Maybe [ Name ]
frameNames heap scopeGraph frame = do
scopeAddress <- Heap.scopeLookup frame heap
scope <- ScopeGraph.lookupScope scopeAddress scopeGraph
pure (unDeclaration <$> ScopeGraph.declarationNames scope scopeGraph)
-- namespaceScope :: Heap Precise Precise (Value term Precise)
-- -> Value term Precise
-- -> Maybe (Environment Precise)
-- namespaceScope heap ns@(Namespace _ _ _)
-- = either (const Nothing) (snd . snd) -- = either (const Nothing) (snd . snd)
-- . run -- . run
-- . runFresh -- . runFresh