1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Simplify the ClassDefinition instance using gtags.

This commit is contained in:
Rob Rix 2019-10-03 00:46:47 -04:00
parent 1d84e7826e
commit 79602d42c5
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -72,18 +72,16 @@ instance ToTagsBy 'Custom Py.FunctionDefinition where
traverse_ tags extraChildren
instance ToTagsBy 'Custom Py.ClassDefinition where
tags' Py.ClassDefinition
tags' t@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)
Tags.yield (Tag name Class span (Tags.firstLine sliced) docs)
traverse_ tags superclasses
traverse_ tags extraChildren
gtags t
instance ToTagsBy 'Custom Py.Call where
tags' t@Py.Call