1
1
mirror of https://github.com/github/semantic.git synced 2024-12-28 09:21:35 +03:00

Give class a custom Declarations1 instance

This commit is contained in:
Timothy Clem 2018-11-05 09:27:41 -08:00
parent fa60a394b4
commit 11c145589c

View File

@ -192,7 +192,7 @@ instance Show1 Variable where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Variable
data Class a = Class { classContext :: ![a], classIdentifier :: !a, classSuperclasses :: ![a], classBody :: !a }
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, FreeVariables1, Declarations1, ToJSONFields1, Named1, Message1, NFData1)
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, FreeVariables1, ToJSONFields1, Named1, Message1, NFData1)
instance Declarations a => Declarations (Class a) where
declaredName (Class _ name _ _) = declaredName name
@ -230,7 +230,8 @@ instance Evaluatable Class where
bind name addr
pure (Rval addr)
instance Declarations1 Class where
liftDeclaredName declaredName = declaredName . classIdentifier
-- | A decorator in Python
data Decorator a = Decorator { decoratorIdentifier :: !a, decoratorParamaters :: ![a], decoratorBody :: !a }