mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
objectMembers
Co-Authored-By: Rob Rix <rob.rix@github.com>
This commit is contained in:
parent
ce40ee2d37
commit
7ade83a367
@ -15,6 +15,7 @@ module SpecHelpers
|
||||
, LogQueue
|
||||
, StatQueue
|
||||
, lookupDeclaration
|
||||
, objectMembers
|
||||
) where
|
||||
|
||||
import Control.Abstract hiding (lookupDeclaration)
|
||||
@ -151,16 +152,22 @@ testEvaluating
|
||||
type Val term = Value term Precise
|
||||
|
||||
|
||||
-- deNamespace :: Heap Precise Precise (Value term Precise)
|
||||
-- -> Value term Precise
|
||||
-- -> Maybe (Name, [Name])
|
||||
-- deNamespace heap ns@(Namespace name _ _) = (,) name . Env.allNames <$> namespaceScope heap ns
|
||||
-- deNamespace _ _ = Nothing
|
||||
objectMembers :: Heap Precise Precise (Value term Precise)
|
||||
-> ScopeGraph Precise
|
||||
-> Value term Precise
|
||||
-> Maybe [Name]
|
||||
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)
|
||||
-- . run
|
||||
-- . runFresh
|
||||
|
Loading…
Reference in New Issue
Block a user