mirror of
https://github.com/github/semantic.git
synced 2024-12-21 13:51:44 +03:00
Add ScopedTypeVariables to Syntax
This commit is contained in:
parent
e22b723b6a
commit
44bb5cfe5b
@ -1,4 +1,4 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE DeriveAnyClass, ScopedTypeVariables #-}
|
||||
module Syntax where
|
||||
|
||||
import Data.Aeson
|
||||
@ -109,26 +109,26 @@ data Syntax a f
|
||||
deriving (Eq, Foldable, Functor, Generic, Generic1, Mergeable, Ord, Show, Traversable, ToJSON, NFData)
|
||||
|
||||
|
||||
extractLeafValue :: forall b leaf. S.Syntax leaf b -> Maybe leaf
|
||||
extractLeafValue :: forall b leaf. Syntax leaf b -> Maybe leaf
|
||||
extractLeafValue syntax = case syntax of
|
||||
S.Leaf a -> Just a
|
||||
Leaf a -> Just a
|
||||
_ -> Nothing
|
||||
|
||||
maybeIdentifier :: forall leaf identifier. S.Syntax leaf identifier -> Maybe identifier
|
||||
maybeIdentifier :: forall leaf identifier. Syntax leaf identifier -> Maybe identifier
|
||||
maybeIdentifier syntax = case syntax of
|
||||
S.Assignment f _ -> Just f
|
||||
S.Class f _ _ -> Just f
|
||||
S.Export f _ -> f
|
||||
S.Function f _ _ _ -> Just f
|
||||
S.FunctionCall f _ -> Just f
|
||||
S.Import f _ -> Just f
|
||||
S.Method f _ _ _ _ -> Just f
|
||||
S.MethodCall _ f _ -> Just f
|
||||
S.Module f _ -> Just f
|
||||
S.OperatorAssignment f _ -> Just f
|
||||
S.SubscriptAccess f _ -> Just f
|
||||
S.TypeDecl f _ -> Just f
|
||||
S.VarAssignment f _ -> Just f
|
||||
Assignment f _ -> Just f
|
||||
Class f _ _ -> Just f
|
||||
Export f _ -> f
|
||||
Function f _ _ _ -> Just f
|
||||
FunctionCall f _ -> Just f
|
||||
Import f _ -> Just f
|
||||
Method f _ _ _ _ -> Just f
|
||||
MethodCall _ f _ -> Just f
|
||||
Module f _ -> Just f
|
||||
OperatorAssignment f _ -> Just f
|
||||
SubscriptAccess f _ -> Just f
|
||||
TypeDecl f _ -> Just f
|
||||
VarAssignment f _ -> Just f
|
||||
_ -> Nothing
|
||||
|
||||
-- Instances
|
||||
|
Loading…
Reference in New Issue
Block a user