1
1
mirror of https://github.com/github/semantic.git synced 2024-11-25 11:04:00 +03:00

Flesh out the ToTagBy instance for Py.ClassDefinition.

This commit is contained in:
Rob Rix 2019-09-23 17:50:20 -04:00
parent ea8d5a8817
commit 61915b8152
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -79,7 +79,18 @@ instance ToTagBy 'Custom Py.FunctionDefinition where
traverse_ tag extraChildren
instance ToTagBy 'Custom Py.ClassDefinition where
tag' Py.ClassDefinition {} = pure ()
tag' Py.ClassDefinition
{ ann = Loc Range { start } span
, name = Py.Identifier { bytes = name }
, superclasses
, body = Py.Block { ann = Loc Range { start = end } _, extraChildren }
} = do
src <- ask @Source
let docs = listToMaybe extraChildren >>= docComment src
sliced = slice src (Range start end)
yield (Tag name Class span (Just (firstLine sliced)) docs)
traverse_ tag superclasses
traverse_ tag extraChildren
instance ToTagBy 'Custom Py.Call where
tag' Py.Call {} = pure ()