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

Return the currentScope' if pathDeclarationScope is a DPath

Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
This commit is contained in:
joshvera 2018-11-15 14:39:59 -05:00
parent 393da1897b
commit 78d543c60f

View File

@ -187,7 +187,10 @@ lookupDeclarationScope :: ( Member (Resumable (BaseError (ScopeError address)))
, Ord address
, Show address
) => Declaration -> Evaluator term address value m address
lookupDeclarationScope decl = maybeM (throwScopeError $ LookupDeclarationScopeError decl) . ScopeGraph.pathDeclarationScope =<< lookupScopePath decl
lookupDeclarationScope decl = do
path <- lookupScopePath decl
currentScope' <- currentScope
maybeM (throwScopeError $ LookupDeclarationScopeError decl) (ScopeGraph.pathDeclarationScope currentScope' path)
associatedScope :: (Ord address, Member (State (ScopeGraph address)) sig, Carrier sig m) => Declaration -> Evaluator term address value m (Maybe address)
associatedScope decl = ScopeGraph.associatedScope decl <$> get