1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Lookup scopes while adding import edges

otherwise create intermediate scopes
This commit is contained in:
joshvera 2020-02-05 19:49:32 -05:00
parent d023a5e007
commit c3c707cd6a

View File

@ -360,8 +360,13 @@ addImportEdge edge names currentAddress g = do
case names of
(x :| []) -> addImportHole x currentAddress g
(x :| xs) -> do
let scopeGraph' = newScope x mempty g
addImportEdge edge (NonEmpty.fromList xs) x scopeGraph'
case lookupScope x g of
Just _ -> addImportEdge edge (NonEmpty.fromList xs) x g
Nothing ->
let
scopeGraph' = insertEdge edge x currentAddress (newScope x mempty g)
in
addImportEdge edge (NonEmpty.fromList xs) x scopeGraph'
addImportHole :: Ord scopeAddress => scopeAddress -> scopeAddress -> ScopeGraph scopeAddress -> ScopeGraph scopeAddress