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

create new references in qualified import statements

This commit is contained in:
joshvera 2020-02-07 18:09:46 -05:00
parent a77bcc9133
commit d78386f5a2

View File

@ -236,7 +236,16 @@ instance ToScopeGraph Py.ImportFromStatement where
scopeGraph (Py.ImportFromStatement _ [] (L1 (Py.DottedName _ names)) (Just (Py.WildcardImport _ _))) = do
let toName (Py.Identifier _ name) = Name.name name
complete <* insertEdge ScopeGraph.Import (toName <$> names)
scopeGraph term = todo (show term)
scopeGraph (Py.ImportFromStatement _ [] (L1 (Py.DottedName _ names)) Nothing) = do
let toName (Py.Identifier _ name) = Name.name name
names' = toName <$> names
insertEdge ScopeGraph.Import names'
for_ names $ \(Py.Identifier ann name) -> do
let referenceProps = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (ann^.span_ :: Span)
newReference (Name.name name) referenceProps
complete