1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 13:02:37 +03:00

Add missing cases for new Module Syntax constructor

This commit is contained in:
Rick Winfrey 2016-10-03 17:37:50 -05:00
parent 11ee91c430
commit c6cf6fab4a
3 changed files with 4 additions and 0 deletions

View File

@ -180,6 +180,7 @@ toTermName source term = case unwrap term of
S.Method identifier _ _ -> toTermName' identifier
S.Comment a -> toCategoryName a
S.Commented _ _ -> termNameFromChildren term (toList $ unwrap term)
S.Module identifier _ -> toTermName' identifier
where toTermName' = toTermName source
termNameFromChildren term children = termNameFromRange (unionRangesFrom (range term) (range <$> children))
termNameFromSource term = termNameFromRange (range term)
@ -296,6 +297,7 @@ instance HasCategory Category where
C.If -> "if statement"
C.CommaOperator -> "comma operator"
C.Empty -> "empty statement"
C.Module -> "module statement"
instance HasField fields Category => HasCategory (SyntaxTerm leaf fields) where
toCategoryName = toCategoryName . category . extract

View File

@ -100,6 +100,7 @@ termFields info syntax = "range" .= characterRange info : "category" .= category
S.Array c -> childrenFields c
S.Class identifier superclass definitions -> [ "classIdentifier" .= identifier ] <> [ "superclass" .= superclass ] <> [ "definitions" .= definitions ]
S.Method identifier params definitions -> [ "methodIdentifier" .= identifier ] <> [ "params" .= params ] <> [ "definitions" .= definitions ]
S.Module identifier definitions-> [ "moduleIdentifier" .= identifier ] <> [ "definitions" .= definitions ]
where childrenFields c = [ "children" .= c ]
patchFields :: (KeyValue kv, HasField fields Category, HasField fields Range) => SplitPatch (SyntaxTerm leaf fields) -> [kv]

View File

@ -81,6 +81,7 @@ styleName category = "category-" <> case category of
C.Empty -> "empty_statement"
C.CommaOperator -> "comma_operator"
Other string -> string
C.Module -> "module_statement"
-- | Pick the class name for a split patch.
splitPatchToClassName :: SplitPatch a -> AttributeValue