1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 22:01:46 +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) deriving (Eq, Show)
declaration :: HasField fields (Maybe Declaration) => TermF (Syntax Text) (Record fields) a -> Maybe (Record fields) declaration :: HasField fields (Maybe Declaration) => TermF (Syntax Text) (Record fields) a -> Maybe (Record fields)
declaration (annotation :< syntax) | S.Method{} <- syntax = Just annotation declaration (annotation :< _) = annotation <$ (getField annotation :: Maybe Declaration)
| S.Function{} <- syntax = Just annotation
| otherwise = Nothing
-- | An entry in a table of contents. -- | An entry in a table of contents.