mirror of
https://github.com/github/semantic.git
synced 2024-11-28 01:47:01 +03:00
create new references in qualified import statements
This commit is contained in:
parent
a77bcc9133
commit
d78386f5a2
@ -236,7 +236,16 @@ instance ToScopeGraph Py.ImportFromStatement where
|
|||||||
scopeGraph (Py.ImportFromStatement _ [] (L1 (Py.DottedName _ names)) (Just (Py.WildcardImport _ _))) = do
|
scopeGraph (Py.ImportFromStatement _ [] (L1 (Py.DottedName _ names)) (Just (Py.WildcardImport _ _))) = do
|
||||||
let toName (Py.Identifier _ name) = Name.name name
|
let toName (Py.Identifier _ name) = Name.name name
|
||||||
complete <* insertEdge ScopeGraph.Import (toName <$> names)
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user