feat[classfile]: PrettySerialize instances
only a little bit broken formatting
This commit is contained in:
parent
b82ce2646b
commit
5e6736e8da
20 changed files with 108 additions and 45 deletions
|
@ -29,6 +29,7 @@ import Language.Java.Classfile.Fields (Fields)
|
|||
import Language.Java.Classfile.Methods (Methods)
|
||||
import Language.Java.Classfile.Attributes (Attributes)
|
||||
import Data.Word (Word16)
|
||||
import Pretty.Serialize (PrettySerialize)
|
||||
|
||||
|
||||
-- | 'Stage'-indexed classfile. It can represent a class, an interface or a module.
|
||||
|
@ -50,6 +51,7 @@ data Classfile stage = Classfile
|
|||
|
||||
deriving instance (Show (Magic stage), Show (ConstantPool stage), Show (ClassFlags stage), Show (Class stage)) => Show (Classfile stage)
|
||||
deriving via Generically (Classfile Parse) instance (Extractable (Classfile Parse))
|
||||
deriving via Generically (Classfile Parse) instance (PrettySerialize (Classfile Parse))
|
||||
|
||||
type ClassFlags :: Stage -> Type
|
||||
data family ClassFlags stage
|
||||
|
@ -57,6 +59,7 @@ data family ClassFlags stage
|
|||
newtype instance ClassFlags Parse = ClassFlags (Flags ClassFlag)
|
||||
deriving stock (Show, Generic)
|
||||
deriving Extractable via Generically (ClassFlags Parse)
|
||||
deriving PrettySerialize via Generically (ClassFlags Parse)
|
||||
|
||||
data ClassFlag
|
||||
= Public -- ^ may be accessed from outside the package
|
||||
|
@ -68,7 +71,8 @@ data ClassFlag
|
|||
| Annotation -- ^ is annotation interface
|
||||
| Enum -- ^ enumerated instances
|
||||
| Module -- ^ module, not a class
|
||||
deriving (Show, Eq, Ord, Enum, Bounded)
|
||||
deriving (Show, Eq, Ord, Enum, Bounded, Generic)
|
||||
deriving PrettySerialize via Generically ClassFlag
|
||||
|
||||
instance FlagMask ClassFlag where
|
||||
type FlagType ClassFlag = Word16
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue