feat[classfile]: PrettySerialize instances

only a little bit broken formatting
This commit is contained in:
vegowotenks 2025-08-20 19:25:26 +02:00
parent b82ce2646b
commit 5e6736e8da
20 changed files with 108 additions and 45 deletions

View file

@ -14,12 +14,13 @@ import Language.Java.Classfile.Extractable (Extractable)
import GHC.Generics ( Generically, Generic, Generically(..) )
import Language.Java.Classfile.ConstantPool.References (Utf8Reference)
import Language.Java.Classfile.Attributes (Attributes)
import Pretty.Serialize (PrettySerialize)
-- | Alias for the methods structure from the constant-pool.
newtype Methods = Methods (Array Word16 Method)
deriving stock (Show)
deriving newtype Extractable
deriving newtype (Extractable, PrettySerialize)
-- | A single method record, contains attributes, name and access flags.
@ -30,7 +31,7 @@ data Method = Method
, attributes :: Attributes
}
deriving stock (Show, Generic)
deriving Extractable via Generically Method
deriving (Extractable, PrettySerialize) via Generically Method
-- | Flags for the method, such as abstract, public or static.
@ -47,7 +48,8 @@ data MethodFlag
| Abstract
| Strict
| Synthetic
deriving stock (Show, Eq, Ord, Enum, Bounded)
deriving stock (Show, Eq, Ord, Enum, Bounded, Generic)
deriving PrettySerialize via Generically MethodFlag
instance FlagMask MethodFlag where
type FlagType MethodFlag = Word16