mirror of
https://github.com/github/semantic.git
synced 2024-12-21 13:51:44 +03:00
Define a function selecting the annotations of nodes representing declarations.
This commit is contained in:
parent
fdcf96cd4c
commit
63482dc151
@ -7,6 +7,7 @@ module Renderer.TOC
|
||||
, isErrorSummary
|
||||
, Declaration(..)
|
||||
, DeclarationType(..)
|
||||
, declaration
|
||||
, Entry(..)
|
||||
, tableOfContentsBy
|
||||
) where
|
||||
@ -71,6 +72,12 @@ data Declaration = Declaration { declarationIdentifier :: Text, declarationType
|
||||
data DeclarationType = Method | Function | Class
|
||||
deriving (Eq, Show)
|
||||
|
||||
declaration :: HasField fields (Maybe Declaration) => TermF (Syntax Text) (Record fields) a -> Maybe (Record fields)
|
||||
declaration (annotation :< syntax) | S.Method{} <- syntax = Just annotation
|
||||
| S.Function{} <- syntax = Just annotation
|
||||
| otherwise = Nothing
|
||||
|
||||
|
||||
-- | An entry in a table of contents.
|
||||
data Entry a
|
||||
= Unchanged a -- ^ An entry for an unchanged portion of a diff (i.e. a diff node not containing any patches).
|
||||
|
Loading…
Reference in New Issue
Block a user