1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 13:51:44 +03:00

Simplify declaration to accept any node with a Declaration attached.

This commit is contained in:
Rob Rix 2017-05-10 12:00:13 -04:00
parent 63482dc151
commit 9eac08919f

View File

@ -73,9 +73,7 @@ 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
declaration (annotation :< _) = annotation <$ (getField annotation :: Maybe Declaration)
-- | An entry in a table of contents.