mirror of
https://github.com/github/semantic.git
synced 2024-12-21 13:51:44 +03:00
Add method definitions
This commit is contained in:
parent
eb3df7db6a
commit
d3df14cafd
@ -79,6 +79,8 @@ data Category
|
||||
| Return
|
||||
-- | A class declaration.
|
||||
| Class
|
||||
-- | A class method declaration.
|
||||
| Method
|
||||
-- | A non-standard category, which can be used for comparability.
|
||||
| Other Text
|
||||
deriving (Eq, Generic, Ord, Show)
|
||||
|
@ -101,6 +101,8 @@ termConstructor source sourceSpan info = cofree . construct
|
||||
withDefaultInfo $ S.While expr body
|
||||
construct children | DoWhile == (category info), [expr, body] <- children =
|
||||
withDefaultInfo $ S.DoWhile expr body
|
||||
construct children | Method == category info, [identifier, params, definitions] <- children =
|
||||
withDefaultInfo $ S.Method identifier params definitions
|
||||
construct children | Class == category info = case children of
|
||||
[identifier, superclass, classBody] | S.Indexed definitions <- unwrap classBody ->
|
||||
withDefaultInfo $ S.Class identifier (Just superclass) definitions
|
||||
|
@ -63,7 +63,7 @@ data Syntax
|
||||
-- | A class with an identifier, superclass, and a list of definitions.
|
||||
| Class f (Maybe f) [f]
|
||||
-- | A method definition with an identifier, params, and a list of expressions.
|
||||
| MethodDefinition f [f] [f]
|
||||
| Method f [f] [f]
|
||||
deriving (Eq, Foldable, Functor, Generic, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user