1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 00:12:29 +03:00

return a list of values from lookupDeclaration

Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
This commit is contained in:
joshvera 2018-11-08 12:56:08 -05:00
parent 22bdbdfafe
commit 20cf855423

View File

@ -72,6 +72,7 @@ import Test.LeanCheck as X
import qualified Data.ByteString as B import qualified Data.ByteString as B
import qualified Data.Set as Set import qualified Data.Set as Set
import Data.Set (Set)
import qualified Semantic.IO as IO import qualified Semantic.IO as IO
import Semantic.Config (Config) import Semantic.Config (Config)
import Semantic.Telemetry (LogQueue, StatQueue) import Semantic.Telemetry (LogQueue, StatQueue)
@ -168,12 +169,11 @@ type Val term = Value term Precise
-- namespaceScope _ _ = Nothing -- namespaceScope _ _ = Nothing
lookupDeclaration :: Name -> Heap Precise Precise (Value term Precise) -> ScopeGraph Precise -> Maybe (Value term Precise) lookupDeclaration :: Name -> Heap Precise Precise (Value term Precise) -> ScopeGraph Precise -> Maybe [ Value term Precise ]
lookupDeclaration name heap scopeGraph = do lookupDeclaration name heap scopeGraph = do
path <- ScopeGraph.lookupScopePath name scopeGraph path <- ScopeGraph.lookupScopePath name scopeGraph
frameAddress <- Heap.lookupFrameAddress path heap frameAddress <- Heap.lookupFrameAddress path heap
set <- Heap.getSlot (Address frameAddress (Heap.pathPosition path)) heap toList <$> Heap.getSlot (Address frameAddress (Heap.pathPosition path)) heap
fst <$> Set.minView set
newtype Verbatim = Verbatim ByteString newtype Verbatim = Verbatim ByteString
deriving (Eq) deriving (Eq)