1
1
mirror of https://github.com/github/semantic.git synced 2024-12-15 01:51:39 +03:00

Construct an import edge and frame link from the current scope to the imported scope and frame

This commit is contained in:
joshvera 2018-11-16 18:03:00 -05:00
parent 007c710668
commit b583e0bf8d

View File

@ -67,10 +67,14 @@ instance Evaluatable QualifiedAliasedImport where
bindFrames heap
declare (Declaration alias) span (ScopeGraph.currentScope scopeGraph)
aliasSlot <- lookupDeclaration (Declaration alias)
case (ScopeGraph.currentScope scopeGraph, Heap.currentFrame heap) of
(Just scope, Just frame) -> do
importScope <- newScope (Map.singleton ScopeGraph.Import scope)
aliasFrame <- newFrame importScope (Map.singleton ScopeGraph.Import (Map.singleton scope frame))
insertImportEdge scope
let scopeMap = (Map.singleton scope frame)
insertFrameLink ScopeGraph.Import scopeMap
importScope <- newScope (Map.singleton ScopeGraph.Import [ scope ])
aliasFrame <- newFrame importScope (Map.singleton ScopeGraph.Import scopeMap)
assign aliasSlot =<< object aliasFrame
pure (LvalMember aliasSlot)
_ -> throwEvalError (QualifiedImportError importPath)