{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StandaloneDeriving #-}
module Language.JVM.Attribute.Annotations
( RuntimeVisibleAnnotations(..)
, RuntimeInvisibleAnnotations(..)
, RuntimeVisibleParameterAnnotations(..)
, RuntimeInvisibleParameterAnnotations(..)
, Annotation(..)
, ElementValue(..)
, EnumValue(..)
, ValuePair(..)
, TypeAnnotation(..)
, TypePath
, TypePathItem(..)
, TypePathKind(..)
, RuntimeVisibleTypeAnnotations(..)
, RuntimeInvisibleTypeAnnotations(..)
, ClassTypeAnnotation(..)
, MethodTypeAnnotation(..)
, FieldTypeAnnotation(..)
, CodeTypeAnnotation(..)
, TypeParameterTarget
, SupertypeTarget
, isInExtendsClause
, TypeParameterBoundTarget(..)
, FormalParameterTarget
, ThrowsTarget
, LocalvarTarget
, LocalvarEntry(..)
, CatchTarget
, OffsetTarget
, TypeArgumentTarget(..)
, AnnotationDefault(..)
)
where
import Data.Char
import Numeric
import GHC.Generics
import Unsafe.Coerce
import qualified Data.Text as Text
import Control.DeepSeq
import Data.Binary
import qualified Data.Binary.Get as Get
import Language.JVM.Attribute.Base
import Language.JVM.Constant
import Language.JVM.Staged
import Language.JVM.ByteCode
import Language.JVM.Type
import Language.JVM.Utils
newtype RuntimeVisibleAnnotations r = RuntimeVisibleAnnotations
{ RuntimeVisibleAnnotations r -> SizedList16 (Annotation r)
asListOfRuntimeVisibleAnnotations
:: SizedList16 (Annotation r)
}
instance IsAttribute (RuntimeVisibleAnnotations Low) where
attrName :: Const Text (RuntimeVisibleAnnotations Low)
attrName = Text -> Const Text (RuntimeVisibleAnnotations Low)
forall k a (b :: k). a -> Const a b
Const Text
"RuntimeVisibleAnnotations"
instance Staged RuntimeVisibleAnnotations where
stage :: (forall (s' :: * -> *). Staged s' => s' r -> m (s' r'))
-> RuntimeVisibleAnnotations r -> m (RuntimeVisibleAnnotations r')
stage forall (s' :: * -> *). Staged s' => s' r -> m (s' r')
f (RuntimeVisibleAnnotations SizedList16 (Annotation r)
m) =
String
-> m (RuntimeVisibleAnnotations r')
-> m (RuntimeVisibleAnnotations r')
forall (m :: * -> *) a. LabelM m => String -> m a -> m a
label String
"RuntimeVisibleAnnotations" (m (RuntimeVisibleAnnotations r')
-> m (RuntimeVisibleAnnotations r'))
-> m (RuntimeVisibleAnnotations r')
-> m (RuntimeVisibleAnnotations r')
forall a b. (a -> b) -> a -> b
$ SizedList16 (Annotation r') -> RuntimeVisibleAnnotations r'
forall r. SizedList16 (Annotation r) -> RuntimeVisibleAnnotations r
RuntimeVisibleAnnotations (SizedList16 (Annotation r') -> RuntimeVisibleAnnotations r')
-> m (SizedList16 (Annotation r'))
-> m (RuntimeVisibleAnnotations r')
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Annotation r -> m (Annotation r'))
-> SizedList16 (Annotation r) -> m (SizedList16 (Annotation r'))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM Annotation r -> m (Annotation r')
forall (s' :: * -> *). Staged s' => s' r -> m (s' r')
f SizedList16 (Annotation r)
m
newtype RuntimeInvisibleAnnotations r = RuntimeInvisibleAnnotations
{ RuntimeInvisibleAnnotations r -> SizedList16 (Annotation r)
asListOfRuntimeInvisibleAnnotations :: SizedList16 (Annotation r)
}
instance IsAttribute (RuntimeInvisibleAnnotations Low) where
attrName :: Const Text (RuntimeInvisibleAnnotations Low)
attrName = Text -> Const Text (RuntimeInvisibleAnnotations Low)
forall k a (b :: k). a -> Const a b
Const Text
"RuntimeInvisibleAnnotations"
instance Staged RuntimeInvisibleAnnotations where
stage :: (forall (s' :: * -> *). Staged s' => s' r -> m (s' r'))
-> RuntimeInvisibleAnnotations r
-> m (RuntimeInvisibleAnnotations r')
stage forall (s' :: * -> *). Staged s' => s' r -> m (s' r')
f (RuntimeInvisibleAnnotations SizedList16 (Annotation r)
m) =
String
-> m (RuntimeInvisibleAnnotations r')
-> m (RuntimeInvisibleAnnotations r')
forall (m :: * -> *) a. LabelM m => String -> m a -> m a
label String
"RuntimeInvisibleAnnotations"
(m (RuntimeInvisibleAnnotations r')
-> m (RuntimeInvisibleAnnotations r'))
-> m (RuntimeInvisibleAnnotations r')
-> m (RuntimeInvisibleAnnotations r')
forall a b. (a -> b) -> a -> b
$ SizedList16 (Annotation r') -> RuntimeInvisibleAnnotations r'
forall r.
SizedList16 (Annotation r) -> RuntimeInvisibleAnnotations r
RuntimeInvisibleAnnotations
(SizedList16 (Annotation r') -> RuntimeInvisibleAnnotations r')
-> m (SizedList16 (Annotation r'))
-> m (RuntimeInvisibleAnnotations r')
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Annotation r -> m (Annotation r'))
-> SizedList16 (Annotation r) -> m (SizedList16 (Annotation r'))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM Annotation r -> m (Annotation r')
forall (s' :: * -> *). Staged s' => s' r -> m (s' r')
f SizedList16 (Annotation r)
m
newtype RuntimeVisibleParameterAnnotations r =
RuntimeVisibleParameterAnnotations
{ RuntimeVisibleParameterAnnotations r
-> SizedList8 (SizedList16 (Annotation r))
asListOfVisibleParameterAnnotations
:: SizedList8 (SizedList16 (Annotation r))
}
instance IsAttribute (RuntimeVisibleParameterAnnotations Low) where
attrName :: Const Text (RuntimeVisibleParameterAnnotations Low)
attrName = Text -> Const Text (RuntimeVisibleParameterAnnotations Low)
forall k a (b :: k). a -> Const a b
Const Text
"RuntimeVisibleParameterAnnotations"
instance Staged RuntimeVisibleParameterAnnotations where
stage :: (forall (s' :: * -> *). Staged s' => s' r -> m (s' r'))
-> RuntimeVisibleParameterAnnotations r
-> m (RuntimeVisibleParameterAnnotations r')
stage forall (s' :: * -> *). Staged s' => s' r -> m (s' r')
f (RuntimeVisibleParameterAnnotations SizedList8 (SizedList16 (Annotation r))
m) =
String
-> m (RuntimeVisibleParameterAnnotations r')
-> m (RuntimeVisibleParameterAnnotations r')
forall (m :: * -> *) a. LabelM m => String -> m a -> m a
label String
"RuntimeVisibleParameterAnnotations"
(m (RuntimeVisibleParameterAnnotations r')
-> m (RuntimeVisibleParameterAnnotations r'))
-> m (RuntimeVisibleParameterAnnotations r')
-> m (RuntimeVisibleParameterAnnotations r')
forall a b. (a -> b) -> a -> b
$ SizedList8 (SizedList16 (Annotation r'))
-> RuntimeVisibleParameterAnnotations r'
forall r.
SizedList8 (SizedList16 (Annotation r))
-> RuntimeVisibleParameterAnnotations r
RuntimeVisibleParameterAnnotations
(SizedList8 (SizedList16 (Annotation r'))
-> RuntimeVisibleParameterAnnotations r')
-> m (SizedList8 (SizedList16 (Annotation r')))
-> m (RuntimeVisibleParameterAnnotations r')
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (SizedList16 (Annotation r) -> m (SizedList16 (Annotation r')))
-> SizedList8 (SizedList16 (Annotation r))
-> m (SizedList8 (SizedList16 (Annotation r')))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((Annotation r -> m (Annotation r'))
-> SizedList16 (Annotation r) -> m (SizedList16 (Annotation r'))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM Annotation r -> m (Annotation r')
forall (s' :: * -> *). Staged s' => s' r -> m (s' r')
f) SizedList8 (SizedList16 (Annotation r))
m
newtype RuntimeInvisibleParameterAnnotations r =
RuntimeInvisibleParameterAnnotations
{ RuntimeInvisibleParameterAnnotations r
-> SizedList8 (SizedList16 (Annotation r))
asListOfInvisibleParameterAnnotations
:: SizedList8 (SizedList16 (Annotation r))
}
instance IsAttribute (RuntimeInvisibleParameterAnnotations Low) where
attrName :: Const Text (RuntimeInvisibleParameterAnnotations Low)
attrName = Text -> Const Text (RuntimeInvisibleParameterAnnotations Low)
forall k a (b :: k). a -> Const a b
Const Text
"RuntimeInvisibleParameterAnnotations"
instance Staged RuntimeInvisibleParameterAnnotations where
stage :: (forall (s' :: * -> *). Staged s' => s' r -> m (s' r'))
-> RuntimeInvisibleParameterAnnotations r
-> m (RuntimeInvisibleParameterAnnotations r')
stage forall (s' :: * -> *). Staged s' => s' r -> m (s' r')
f (RuntimeInvisibleParameterAnnotations SizedList8 (SizedList16 (Annotation r))
m) =
String
-> m (RuntimeInvisibleParameterAnnotations r')
-> m (RuntimeInvisibleParameterAnnotations r')
forall (m :: * -> *) a. LabelM m => String -> m a -> m a
label String
"RuntimeInvisibleParameterAnnotations"
(m (RuntimeInvisibleParameterAnnotations r')
-> m (RuntimeInvisibleParameterAnnotations r'))
-> m (RuntimeInvisibleParameterAnnotations r')
-> m (RuntimeInvisibleParameterAnnotations r')
forall a b. (a -> b) -> a -> b
$ SizedList8 (SizedList16 (Annotation r'))
-> RuntimeInvisibleParameterAnnotations r'
forall r.
SizedList8 (SizedList16 (Annotation r))
-> RuntimeInvisibleParameterAnnotations r
RuntimeInvisibleParameterAnnotations
(SizedList8 (SizedList16 (Annotation r'))
-> RuntimeInvisibleParameterAnnotations r')
-> m (SizedList8 (SizedList16 (Annotation r')))
-> m (RuntimeInvisibleParameterAnnotations r')
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (SizedList16 (Annotation r) -> m (SizedList16 (Annotation r')))
-> SizedList8 (SizedList16 (Annotation r))
-> m (SizedList8 (SizedList16 (Annotation r')))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((Annotation r -> m (Annotation r'))
-> SizedList16 (Annotation r) -> m (SizedList16 (Annotation r'))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM Annotation r -> m (Annotation r')
forall (s' :: * -> *). Staged s' => s' r -> m (s' r')
f) SizedList8 (SizedList16 (Annotation r))
m
data Annotation r = Annotation
{ Annotation r -> Ref FieldDescriptor r
annotationType :: !(Ref FieldDescriptor r)
, Annotation r -> SizedList16 (ValuePair r)
annotationValuePairs :: !(SizedList16 (ValuePair r))
}
instance Staged Annotation where
evolve :: Annotation Low -> m (Annotation High)
evolve (Annotation Ref FieldDescriptor Low
t SizedList16 (ValuePair Low)
b) = FieldDescriptor -> SizedList16 (ValuePair High) -> Annotation High
forall r.
Ref FieldDescriptor r -> SizedList16 (ValuePair r) -> Annotation r
Annotation (FieldDescriptor
-> SizedList16 (ValuePair High) -> Annotation High)
-> m FieldDescriptor
-> m (SizedList16 (ValuePair High) -> Annotation High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m FieldDescriptor
forall (m :: * -> *) r.
(EvolveM m, Referenceable r) =>
Index -> m r
link Index
Ref FieldDescriptor Low
t m (SizedList16 (ValuePair High) -> Annotation High)
-> m (SizedList16 (ValuePair High)) -> m (Annotation High)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (ValuePair Low -> m (ValuePair High))
-> SizedList16 (ValuePair Low) -> m (SizedList16 (ValuePair High))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ValuePair Low -> m (ValuePair High)
forall (s :: * -> *) (m :: * -> *).
(Staged s, EvolveM m) =>
s Low -> m (s High)
evolve SizedList16 (ValuePair Low)
b
devolve :: Annotation High -> m (Annotation Low)
devolve (Annotation Ref FieldDescriptor High
t SizedList16 (ValuePair High)
b) = Index -> SizedList16 (ValuePair Low) -> Annotation Low
forall r.
Ref FieldDescriptor r -> SizedList16 (ValuePair r) -> Annotation r
Annotation (Index -> SizedList16 (ValuePair Low) -> Annotation Low)
-> m Index -> m (SizedList16 (ValuePair Low) -> Annotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FieldDescriptor -> m Index
forall (m :: * -> *) r.
(DevolveM m, Referenceable r) =>
r -> m Index
unlink Ref FieldDescriptor High
FieldDescriptor
t m (SizedList16 (ValuePair Low) -> Annotation Low)
-> m (SizedList16 (ValuePair Low)) -> m (Annotation Low)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (ValuePair High -> m (ValuePair Low))
-> SizedList16 (ValuePair High) -> m (SizedList16 (ValuePair Low))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ValuePair High -> m (ValuePair Low)
forall (s :: * -> *) (m :: * -> *).
(Staged s, DevolveM m) =>
s High -> m (s Low)
devolve SizedList16 (ValuePair High)
b
data ValuePair r = ValuePair
{ ValuePair r -> Ref Text r
name :: !(Ref Text.Text r)
, ValuePair r -> ElementValue r
value :: !(ElementValue r)
}
instance Staged ValuePair where
evolve :: ValuePair Low -> m (ValuePair High)
evolve (ValuePair Ref Text Low
t ElementValue Low
b) = Text -> ElementValue High -> ValuePair High
forall r. Ref Text r -> ElementValue r -> ValuePair r
ValuePair (Text -> ElementValue High -> ValuePair High)
-> m Text -> m (ElementValue High -> ValuePair High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m Text
forall (m :: * -> *) r.
(EvolveM m, Referenceable r) =>
Index -> m r
link Index
Ref Text Low
t m (ElementValue High -> ValuePair High)
-> m (ElementValue High) -> m (ValuePair High)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ElementValue Low -> m (ElementValue High)
forall (s :: * -> *) (m :: * -> *).
(Staged s, EvolveM m) =>
s Low -> m (s High)
evolve ElementValue Low
b
devolve :: ValuePair High -> m (ValuePair Low)
devolve (ValuePair Ref Text High
t ElementValue High
b) = Index -> ElementValue Low -> ValuePair Low
forall r. Ref Text r -> ElementValue r -> ValuePair r
ValuePair (Index -> ElementValue Low -> ValuePair Low)
-> m Index -> m (ElementValue Low -> ValuePair Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text -> m Index
forall (m :: * -> *) r.
(DevolveM m, Referenceable r) =>
r -> m Index
unlink Text
Ref Text High
t m (ElementValue Low -> ValuePair Low)
-> m (ElementValue Low) -> m (ValuePair Low)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ElementValue High -> m (ElementValue Low)
forall (s :: * -> *) (m :: * -> *).
(Staged s, DevolveM m) =>
s High -> m (s Low)
devolve ElementValue High
b
data ElementValue r
= EByte !(Ref VInteger r)
| EChar !(Ref VInteger r)
| EDouble !(Ref VDouble r)
| EFloat !(Ref VFloat r)
| EInt !(Ref VInteger r)
| ELong !(Ref VLong r)
| EShort !(Ref VInteger r)
| EBoolean !(Ref VInteger r)
| EString !(Ref VString r)
| EEnum !(EnumValue r)
| EClass !(Ref ReturnDescriptor r)
| EAnnotationType !(Annotation r)
| EArrayType !(SizedList16 (ElementValue r))
instance Staged ElementValue where
evolve :: ElementValue Low -> m (ElementValue High)
evolve = \case
EByte Ref VInteger Low
s -> VInteger -> ElementValue High
forall r. Ref VInteger r -> ElementValue r
EByte (VInteger -> ElementValue High)
-> m VInteger -> m (ElementValue High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m VInteger
forall (m :: * -> *) r.
(EvolveM m, Referenceable r) =>
Index -> m r
link Index
Ref VInteger Low
s
EChar Ref VInteger Low
s -> VInteger -> ElementValue High
forall r. Ref VInteger r -> ElementValue r
EChar (VInteger -> ElementValue High)
-> m VInteger -> m (ElementValue High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m VInteger
forall (m :: * -> *) r.
(EvolveM m, Referenceable r) =>
Index -> m r
link Index
Ref VInteger Low
s
EDouble Ref VDouble Low
s -> VDouble -> ElementValue High
forall r. Ref VDouble r -> ElementValue r
EDouble (VDouble -> ElementValue High)
-> m VDouble -> m (ElementValue High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m VDouble
forall (m :: * -> *) r.
(EvolveM m, Referenceable r) =>
Index -> m r
link Index
Ref VDouble Low
s
EFloat Ref VFloat Low
s -> VFloat -> ElementValue High
forall r. Ref VFloat r -> ElementValue r
EFloat (VFloat -> ElementValue High) -> m VFloat -> m (ElementValue High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m VFloat
forall (m :: * -> *) r.
(EvolveM m, Referenceable r) =>
Index -> m r
link Index
Ref VFloat Low
s
EInt Ref VInteger Low
s -> VInteger -> ElementValue High
forall r. Ref VInteger r -> ElementValue r
EInt (VInteger -> ElementValue High)
-> m VInteger -> m (ElementValue High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m VInteger
forall (m :: * -> *) r.
(EvolveM m, Referenceable r) =>
Index -> m r
link Index
Ref VInteger Low
s
ELong Ref VLong Low
s -> VLong -> ElementValue High
forall r. Ref VLong r -> ElementValue r
ELong (VLong -> ElementValue High) -> m VLong -> m (ElementValue High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m VLong
forall (m :: * -> *) r.
(EvolveM m, Referenceable r) =>
Index -> m r
link Index
Ref VLong Low
s
EShort Ref VInteger Low
s -> VInteger -> ElementValue High
forall r. Ref VInteger r -> ElementValue r
EShort (VInteger -> ElementValue High)
-> m VInteger -> m (ElementValue High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m VInteger
forall (m :: * -> *) r.
(EvolveM m, Referenceable r) =>
Index -> m r
link Index
Ref VInteger Low
s
EBoolean Ref VInteger Low
s -> VInteger -> ElementValue High
forall r. Ref VInteger r -> ElementValue r
EBoolean (VInteger -> ElementValue High)
-> m VInteger -> m (ElementValue High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m VInteger
forall (m :: * -> *) r.
(EvolveM m, Referenceable r) =>
Index -> m r
link Index
Ref VInteger Low
s
EString Ref VString Low
s -> VString -> ElementValue High
forall r. Ref VString r -> ElementValue r
EString (VString -> ElementValue High)
-> m VString -> m (ElementValue High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m VString
forall (m :: * -> *) r.
(EvolveM m, Referenceable r) =>
Index -> m r
link Index
Ref VString Low
s
EEnum EnumValue Low
s -> EnumValue High -> ElementValue High
forall r. EnumValue r -> ElementValue r
EEnum (EnumValue High -> ElementValue High)
-> m (EnumValue High) -> m (ElementValue High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> EnumValue Low -> m (EnumValue High)
forall (s :: * -> *) (m :: * -> *).
(Staged s, EvolveM m) =>
s Low -> m (s High)
evolve EnumValue Low
s
EClass Ref ReturnDescriptor Low
s -> ReturnDescriptor -> ElementValue High
forall r. Ref ReturnDescriptor r -> ElementValue r
EClass (ReturnDescriptor -> ElementValue High)
-> m ReturnDescriptor -> m (ElementValue High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m ReturnDescriptor
forall (m :: * -> *) r.
(EvolveM m, Referenceable r) =>
Index -> m r
link Index
Ref ReturnDescriptor Low
s
EAnnotationType Annotation Low
s -> Annotation High -> ElementValue High
forall r. Annotation r -> ElementValue r
EAnnotationType (Annotation High -> ElementValue High)
-> m (Annotation High) -> m (ElementValue High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Annotation Low -> m (Annotation High)
forall (s :: * -> *) (m :: * -> *).
(Staged s, EvolveM m) =>
s Low -> m (s High)
evolve Annotation Low
s
EArrayType SizedList16 (ElementValue Low)
s -> SizedList16 (ElementValue High) -> ElementValue High
forall r. SizedList16 (ElementValue r) -> ElementValue r
EArrayType (SizedList16 (ElementValue High) -> ElementValue High)
-> m (SizedList16 (ElementValue High)) -> m (ElementValue High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ElementValue Low -> m (ElementValue High))
-> SizedList16 (ElementValue Low)
-> m (SizedList16 (ElementValue High))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ElementValue Low -> m (ElementValue High)
forall (s :: * -> *) (m :: * -> *).
(Staged s, EvolveM m) =>
s Low -> m (s High)
evolve SizedList16 (ElementValue Low)
s
devolve :: ElementValue High -> m (ElementValue Low)
devolve = \case
EByte Ref VInteger High
s -> Index -> ElementValue Low
forall r. Ref VInteger r -> ElementValue r
EByte (Index -> ElementValue Low) -> m Index -> m (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> VInteger -> m Index
forall (m :: * -> *) r.
(DevolveM m, Referenceable r) =>
r -> m Index
unlink VInteger
Ref VInteger High
s
EChar Ref VInteger High
s -> Index -> ElementValue Low
forall r. Ref VInteger r -> ElementValue r
EChar (Index -> ElementValue Low) -> m Index -> m (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> VInteger -> m Index
forall (m :: * -> *) r.
(DevolveM m, Referenceable r) =>
r -> m Index
unlink VInteger
Ref VInteger High
s
EDouble Ref VDouble High
s -> Index -> ElementValue Low
forall r. Ref VDouble r -> ElementValue r
EDouble (Index -> ElementValue Low) -> m Index -> m (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> VDouble -> m Index
forall (m :: * -> *) r.
(DevolveM m, Referenceable r) =>
r -> m Index
unlink VDouble
Ref VDouble High
s
EFloat Ref VFloat High
s -> Index -> ElementValue Low
forall r. Ref VFloat r -> ElementValue r
EFloat (Index -> ElementValue Low) -> m Index -> m (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> VFloat -> m Index
forall (m :: * -> *) r.
(DevolveM m, Referenceable r) =>
r -> m Index
unlink VFloat
Ref VFloat High
s
EInt Ref VInteger High
s -> Index -> ElementValue Low
forall r. Ref VInteger r -> ElementValue r
EInt (Index -> ElementValue Low) -> m Index -> m (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> VInteger -> m Index
forall (m :: * -> *) r.
(DevolveM m, Referenceable r) =>
r -> m Index
unlink VInteger
Ref VInteger High
s
ELong Ref VLong High
s -> Index -> ElementValue Low
forall r. Ref VLong r -> ElementValue r
ELong (Index -> ElementValue Low) -> m Index -> m (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> VLong -> m Index
forall (m :: * -> *) r.
(DevolveM m, Referenceable r) =>
r -> m Index
unlink VLong
Ref VLong High
s
EShort Ref VInteger High
s -> Index -> ElementValue Low
forall r. Ref VInteger r -> ElementValue r
EShort (Index -> ElementValue Low) -> m Index -> m (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> VInteger -> m Index
forall (m :: * -> *) r.
(DevolveM m, Referenceable r) =>
r -> m Index
unlink VInteger
Ref VInteger High
s
EEnum EnumValue High
s -> EnumValue Low -> ElementValue Low
forall r. EnumValue r -> ElementValue r
EEnum (EnumValue Low -> ElementValue Low)
-> m (EnumValue Low) -> m (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> EnumValue High -> m (EnumValue Low)
forall (s :: * -> *) (m :: * -> *).
(Staged s, DevolveM m) =>
s High -> m (s Low)
devolve EnumValue High
s
EBoolean Ref VInteger High
s -> Index -> ElementValue Low
forall r. Ref VInteger r -> ElementValue r
EBoolean (Index -> ElementValue Low) -> m Index -> m (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> VInteger -> m Index
forall (m :: * -> *) r.
(DevolveM m, Referenceable r) =>
r -> m Index
unlink VInteger
Ref VInteger High
s
EString Ref VString High
s -> Index -> ElementValue Low
forall r. Ref VString r -> ElementValue r
EString (Index -> ElementValue Low) -> m Index -> m (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> VString -> m Index
forall (m :: * -> *) r.
(DevolveM m, Referenceable r) =>
r -> m Index
unlink VString
Ref VString High
s
EClass Ref ReturnDescriptor High
s -> Index -> ElementValue Low
forall r. Ref ReturnDescriptor r -> ElementValue r
EClass (Index -> ElementValue Low) -> m Index -> m (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReturnDescriptor -> m Index
forall (m :: * -> *) r.
(DevolveM m, Referenceable r) =>
r -> m Index
unlink Ref ReturnDescriptor High
ReturnDescriptor
s
EAnnotationType Annotation High
s -> Annotation Low -> ElementValue Low
forall r. Annotation r -> ElementValue r
EAnnotationType (Annotation Low -> ElementValue Low)
-> m (Annotation Low) -> m (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Annotation High -> m (Annotation Low)
forall (s :: * -> *) (m :: * -> *).
(Staged s, DevolveM m) =>
s High -> m (s Low)
devolve Annotation High
s
EArrayType SizedList16 (ElementValue High)
s -> SizedList16 (ElementValue Low) -> ElementValue Low
forall r. SizedList16 (ElementValue r) -> ElementValue r
EArrayType (SizedList16 (ElementValue Low) -> ElementValue Low)
-> m (SizedList16 (ElementValue Low)) -> m (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ElementValue High -> m (ElementValue Low))
-> SizedList16 (ElementValue High)
-> m (SizedList16 (ElementValue Low))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ElementValue High -> m (ElementValue Low)
forall (s :: * -> *) (m :: * -> *).
(Staged s, DevolveM m) =>
s High -> m (s Low)
devolve SizedList16 (ElementValue High)
s
instance Binary (ElementValue Low) where
get :: Get (ElementValue Low)
get = String -> Get (ElementValue Low) -> Get (ElementValue Low)
forall a. String -> Get a -> Get a
Get.label String
"ElementValue" (Get (ElementValue Low) -> Get (ElementValue Low))
-> Get (ElementValue Low) -> Get (ElementValue Low)
forall a b. (a -> b) -> a -> b
$ Get Char
getChar8 Get Char
-> (Char -> Get (ElementValue Low)) -> Get (ElementValue Low)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Char
'B' -> Index -> ElementValue Low
forall r. Ref VInteger r -> ElementValue r
EByte (Index -> ElementValue Low) -> Get Index -> Get (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Index
forall t. Binary t => Get t
get
Char
'C' -> Index -> ElementValue Low
forall r. Ref VInteger r -> ElementValue r
EChar (Index -> ElementValue Low) -> Get Index -> Get (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Index
forall t. Binary t => Get t
get
Char
'D' -> Index -> ElementValue Low
forall r. Ref VDouble r -> ElementValue r
EDouble (Index -> ElementValue Low) -> Get Index -> Get (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Index
forall t. Binary t => Get t
get
Char
'F' -> Index -> ElementValue Low
forall r. Ref VFloat r -> ElementValue r
EFloat (Index -> ElementValue Low) -> Get Index -> Get (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Index
forall t. Binary t => Get t
get
Char
'I' -> Index -> ElementValue Low
forall r. Ref VInteger r -> ElementValue r
EInt (Index -> ElementValue Low) -> Get Index -> Get (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Index
forall t. Binary t => Get t
get
Char
'J' -> Index -> ElementValue Low
forall r. Ref VLong r -> ElementValue r
ELong (Index -> ElementValue Low) -> Get Index -> Get (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Index
forall t. Binary t => Get t
get
Char
'S' -> Index -> ElementValue Low
forall r. Ref VInteger r -> ElementValue r
EShort (Index -> ElementValue Low) -> Get Index -> Get (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Index
forall t. Binary t => Get t
get
Char
'Z' -> Index -> ElementValue Low
forall r. Ref VInteger r -> ElementValue r
EBoolean (Index -> ElementValue Low) -> Get Index -> Get (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Index
forall t. Binary t => Get t
get
Char
's' -> Index -> ElementValue Low
forall r. Ref VString r -> ElementValue r
EString (Index -> ElementValue Low) -> Get Index -> Get (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Index
forall t. Binary t => Get t
get
Char
'e' -> EnumValue Low -> ElementValue Low
forall r. EnumValue r -> ElementValue r
EEnum (EnumValue Low -> ElementValue Low)
-> Get (EnumValue Low) -> Get (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get (EnumValue Low)
forall t. Binary t => Get t
get
Char
'c' -> Index -> ElementValue Low
forall r. Ref ReturnDescriptor r -> ElementValue r
EClass (Index -> ElementValue Low) -> Get Index -> Get (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Index
forall t. Binary t => Get t
get
Char
'@' -> Annotation Low -> ElementValue Low
forall r. Annotation r -> ElementValue r
EAnnotationType (Annotation Low -> ElementValue Low)
-> Get (Annotation Low) -> Get (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get (Annotation Low)
forall t. Binary t => Get t
get
Char
'[' -> SizedList16 (ElementValue Low) -> ElementValue Low
forall r. SizedList16 (ElementValue r) -> ElementValue r
EArrayType (SizedList16 (ElementValue Low) -> ElementValue Low)
-> Get (SizedList16 (ElementValue Low)) -> Get (ElementValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get (SizedList16 (ElementValue Low))
forall t. Binary t => Get t
get
Char
c -> String -> Get (ElementValue Low)
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Get (ElementValue Low))
-> String -> Get (ElementValue Low)
forall a b. (a -> b) -> a -> b
$ String
"Does not know " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Char -> String
forall a. Show a => a -> String
show Char
c
where getChar8 :: Get Char
getChar8 = Int -> Char
chr (Int -> Char) -> (Word8 -> Int) -> Word8 -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Char) -> Get Word8 -> Get Char
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Word8
Get.getWord8
put :: ElementValue Low -> Put
put = \case
EByte Ref VInteger Low
a -> Char -> Put
putChar8 Char
'B' Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Index -> Put
forall t. Binary t => t -> Put
put Index
Ref VInteger Low
a
EChar Ref VInteger Low
a -> Char -> Put
putChar8 Char
'C' Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Index -> Put
forall t. Binary t => t -> Put
put Index
Ref VInteger Low
a
EDouble Ref VDouble Low
a -> Char -> Put
putChar8 Char
'D' Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Index -> Put
forall t. Binary t => t -> Put
put Index
Ref VDouble Low
a
EFloat Ref VFloat Low
a -> Char -> Put
putChar8 Char
'F' Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Index -> Put
forall t. Binary t => t -> Put
put Index
Ref VFloat Low
a
EInt Ref VInteger Low
a -> Char -> Put
putChar8 Char
'I' Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Index -> Put
forall t. Binary t => t -> Put
put Index
Ref VInteger Low
a
ELong Ref VLong Low
a -> Char -> Put
putChar8 Char
'J' Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Index -> Put
forall t. Binary t => t -> Put
put Index
Ref VLong Low
a
EShort Ref VInteger Low
a -> Char -> Put
putChar8 Char
'S' Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Index -> Put
forall t. Binary t => t -> Put
put Index
Ref VInteger Low
a
EBoolean Ref VInteger Low
a -> Char -> Put
putChar8 Char
'Z' Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Index -> Put
forall t. Binary t => t -> Put
put Index
Ref VInteger Low
a
EString Ref VString Low
a -> Char -> Put
putChar8 Char
's' Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Index -> Put
forall t. Binary t => t -> Put
put Index
Ref VString Low
a
EEnum EnumValue Low
a -> Char -> Put
putChar8 Char
'e' Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> EnumValue Low -> Put
forall t. Binary t => t -> Put
put EnumValue Low
a
EClass Ref ReturnDescriptor Low
a -> Char -> Put
putChar8 Char
'c' Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Index -> Put
forall t. Binary t => t -> Put
put Index
Ref ReturnDescriptor Low
a
EAnnotationType Annotation Low
a -> Char -> Put
putChar8 Char
'@' Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Annotation Low -> Put
forall t. Binary t => t -> Put
put Annotation Low
a
EArrayType SizedList16 (ElementValue Low)
a -> Char -> Put
putChar8 Char
'[' Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> SizedList16 (ElementValue Low) -> Put
forall t. Binary t => t -> Put
put SizedList16 (ElementValue Low)
a
where putChar8 :: Char -> Put
putChar8 = Word8 -> Put
putWord8 (Word8 -> Put) -> (Char -> Word8) -> Char -> Put
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word8) -> (Char -> Int) -> Char -> Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
ord
data EnumValue r = EnumValue
{ EnumValue r -> Ref FieldDescriptor r
enumTypeName :: !(Ref FieldDescriptor r)
, EnumValue r -> Ref Text r
enunConstName :: !(Ref Text.Text r)
}
instance Staged EnumValue where
evolve :: EnumValue Low -> m (EnumValue High)
evolve (EnumValue Ref FieldDescriptor Low
n Ref Text Low
c) = FieldDescriptor -> Text -> EnumValue High
forall r. Ref FieldDescriptor r -> Ref Text r -> EnumValue r
EnumValue (FieldDescriptor -> Text -> EnumValue High)
-> m FieldDescriptor -> m (Text -> EnumValue High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m FieldDescriptor
forall (m :: * -> *) r.
(EvolveM m, Referenceable r) =>
Index -> m r
link Index
Ref FieldDescriptor Low
n m (Text -> EnumValue High) -> m Text -> m (EnumValue High)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Index -> m Text
forall (m :: * -> *) r.
(EvolveM m, Referenceable r) =>
Index -> m r
link Index
Ref Text Low
c
devolve :: EnumValue High -> m (EnumValue Low)
devolve (EnumValue Ref FieldDescriptor High
n Ref Text High
c) = Index -> Index -> EnumValue Low
forall r. Ref FieldDescriptor r -> Ref Text r -> EnumValue r
EnumValue (Index -> Index -> EnumValue Low)
-> m Index -> m (Index -> EnumValue Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FieldDescriptor -> m Index
forall (m :: * -> *) r.
(DevolveM m, Referenceable r) =>
r -> m Index
unlink Ref FieldDescriptor High
FieldDescriptor
n m (Index -> EnumValue Low) -> m Index -> m (EnumValue Low)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text -> m Index
forall (m :: * -> *) r.
(DevolveM m, Referenceable r) =>
r -> m Index
unlink Text
Ref Text High
c
data TypeAnnotation m r = TypeAnnotation
{ TypeAnnotation m r -> m r
typeAnnotationTarget :: !(m r)
, TypeAnnotation m r -> TypePath
typeAnnotationPath :: !TypePath
, TypeAnnotation m r -> Ref FieldDescriptor r
typeAnnotationType :: !(Ref FieldDescriptor r)
, TypeAnnotation m r -> SizedList16 (ValuePair r)
typeAnnotationValuePairs :: SizedList16 (ValuePair r)
}
instance Binary (m Low) => Binary (TypeAnnotation m Low) where
get :: Get (TypeAnnotation m Low)
get = m Low
-> TypePath
-> Index
-> SizedList16 (ValuePair Low)
-> TypeAnnotation m Low
forall (m :: * -> *) r.
m r
-> TypePath
-> Ref FieldDescriptor r
-> SizedList16 (ValuePair r)
-> TypeAnnotation m r
TypeAnnotation (m Low
-> TypePath
-> Index
-> SizedList16 (ValuePair Low)
-> TypeAnnotation m Low)
-> Get (m Low)
-> Get
(TypePath
-> Index -> SizedList16 (ValuePair Low) -> TypeAnnotation m Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get (m Low)
forall t. Binary t => Get t
get Get
(TypePath
-> Index -> SizedList16 (ValuePair Low) -> TypeAnnotation m Low)
-> Get TypePath
-> Get
(Index -> SizedList16 (ValuePair Low) -> TypeAnnotation m Low)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Get TypePath
forall t. Binary t => Get t
get Get (Index -> SizedList16 (ValuePair Low) -> TypeAnnotation m Low)
-> Get Index
-> Get (SizedList16 (ValuePair Low) -> TypeAnnotation m Low)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Get Index
forall t. Binary t => Get t
get Get (SizedList16 (ValuePair Low) -> TypeAnnotation m Low)
-> Get (SizedList16 (ValuePair Low)) -> Get (TypeAnnotation m Low)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Get (SizedList16 (ValuePair Low))
forall t. Binary t => Get t
get
put :: TypeAnnotation m Low -> Put
put TypeAnnotation {m Low
Ref FieldDescriptor Low
TypePath
SizedList16 (ValuePair Low)
typeAnnotationValuePairs :: SizedList16 (ValuePair Low)
typeAnnotationType :: Ref FieldDescriptor Low
typeAnnotationPath :: TypePath
typeAnnotationTarget :: m Low
typeAnnotationValuePairs :: forall (m :: * -> *) r.
TypeAnnotation m r -> SizedList16 (ValuePair r)
typeAnnotationType :: forall (m :: * -> *) r. TypeAnnotation m r -> Ref FieldDescriptor r
typeAnnotationPath :: forall (m :: * -> *) r. TypeAnnotation m r -> TypePath
typeAnnotationTarget :: forall (m :: * -> *) r. TypeAnnotation m r -> m r
..} =
m Low -> Put
forall t. Binary t => t -> Put
put m Low
typeAnnotationTarget
Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TypePath -> Put
forall t. Binary t => t -> Put
put TypePath
typeAnnotationPath
Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Index -> Put
forall t. Binary t => t -> Put
put Index
Ref FieldDescriptor Low
typeAnnotationType
Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> SizedList16 (ValuePair Low) -> Put
forall t. Binary t => t -> Put
put SizedList16 (ValuePair Low)
typeAnnotationValuePairs
instance Staged m => Staged (TypeAnnotation m) where
evolve :: TypeAnnotation m Low -> m (TypeAnnotation m High)
evolve TypeAnnotation {m Low
Ref FieldDescriptor Low
TypePath
SizedList16 (ValuePair Low)
typeAnnotationValuePairs :: SizedList16 (ValuePair Low)
typeAnnotationType :: Ref FieldDescriptor Low
typeAnnotationPath :: TypePath
typeAnnotationTarget :: m Low
typeAnnotationValuePairs :: forall (m :: * -> *) r.
TypeAnnotation m r -> SizedList16 (ValuePair r)
typeAnnotationType :: forall (m :: * -> *) r. TypeAnnotation m r -> Ref FieldDescriptor r
typeAnnotationPath :: forall (m :: * -> *) r. TypeAnnotation m r -> TypePath
typeAnnotationTarget :: forall (m :: * -> *) r. TypeAnnotation m r -> m r
..} =
m High
-> TypePath
-> FieldDescriptor
-> SizedList16 (ValuePair High)
-> TypeAnnotation m High
forall (m :: * -> *) r.
m r
-> TypePath
-> Ref FieldDescriptor r
-> SizedList16 (ValuePair r)
-> TypeAnnotation m r
TypeAnnotation
(m High
-> TypePath
-> FieldDescriptor
-> SizedList16 (ValuePair High)
-> TypeAnnotation m High)
-> m (m High)
-> m (TypePath
-> FieldDescriptor
-> SizedList16 (ValuePair High)
-> TypeAnnotation m High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Low -> m (m High)
forall (s :: * -> *) (m :: * -> *).
(Staged s, EvolveM m) =>
s Low -> m (s High)
evolve m Low
typeAnnotationTarget
m (TypePath
-> FieldDescriptor
-> SizedList16 (ValuePair High)
-> TypeAnnotation m High)
-> m TypePath
-> m (FieldDescriptor
-> SizedList16 (ValuePair High) -> TypeAnnotation m High)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> TypePath -> m TypePath
forall (f :: * -> *) a. Applicative f => a -> f a
pure TypePath
typeAnnotationPath
m (FieldDescriptor
-> SizedList16 (ValuePair High) -> TypeAnnotation m High)
-> m FieldDescriptor
-> m (SizedList16 (ValuePair High) -> TypeAnnotation m High)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Index -> m FieldDescriptor
forall (m :: * -> *) r.
(EvolveM m, Referenceable r) =>
Index -> m r
link Index
Ref FieldDescriptor Low
typeAnnotationType
m (SizedList16 (ValuePair High) -> TypeAnnotation m High)
-> m (SizedList16 (ValuePair High)) -> m (TypeAnnotation m High)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (ValuePair Low -> m (ValuePair High))
-> SizedList16 (ValuePair Low) -> m (SizedList16 (ValuePair High))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ValuePair Low -> m (ValuePair High)
forall (s :: * -> *) (m :: * -> *).
(Staged s, EvolveM m) =>
s Low -> m (s High)
evolve SizedList16 (ValuePair Low)
typeAnnotationValuePairs
devolve :: TypeAnnotation m High -> m (TypeAnnotation m Low)
devolve TypeAnnotation {m High
Ref FieldDescriptor High
TypePath
SizedList16 (ValuePair High)
typeAnnotationValuePairs :: SizedList16 (ValuePair High)
typeAnnotationType :: Ref FieldDescriptor High
typeAnnotationPath :: TypePath
typeAnnotationTarget :: m High
typeAnnotationValuePairs :: forall (m :: * -> *) r.
TypeAnnotation m r -> SizedList16 (ValuePair r)
typeAnnotationType :: forall (m :: * -> *) r. TypeAnnotation m r -> Ref FieldDescriptor r
typeAnnotationPath :: forall (m :: * -> *) r. TypeAnnotation m r -> TypePath
typeAnnotationTarget :: forall (m :: * -> *) r. TypeAnnotation m r -> m r
..} =
m Low
-> TypePath
-> Index
-> SizedList16 (ValuePair Low)
-> TypeAnnotation m Low
forall (m :: * -> *) r.
m r
-> TypePath
-> Ref FieldDescriptor r
-> SizedList16 (ValuePair r)
-> TypeAnnotation m r
TypeAnnotation
(m Low
-> TypePath
-> Index
-> SizedList16 (ValuePair Low)
-> TypeAnnotation m Low)
-> m (m Low)
-> m (TypePath
-> Index -> SizedList16 (ValuePair Low) -> TypeAnnotation m Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m High -> m (m Low)
forall (s :: * -> *) (m :: * -> *).
(Staged s, DevolveM m) =>
s High -> m (s Low)
devolve m High
typeAnnotationTarget
m (TypePath
-> Index -> SizedList16 (ValuePair Low) -> TypeAnnotation m Low)
-> m TypePath
-> m (Index -> SizedList16 (ValuePair Low) -> TypeAnnotation m Low)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> TypePath -> m TypePath
forall (f :: * -> *) a. Applicative f => a -> f a
pure TypePath
typeAnnotationPath
m (Index -> SizedList16 (ValuePair Low) -> TypeAnnotation m Low)
-> m Index
-> m (SizedList16 (ValuePair Low) -> TypeAnnotation m Low)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FieldDescriptor -> m Index
forall (m :: * -> *) r.
(DevolveM m, Referenceable r) =>
r -> m Index
unlink Ref FieldDescriptor High
FieldDescriptor
typeAnnotationType
m (SizedList16 (ValuePair Low) -> TypeAnnotation m Low)
-> m (SizedList16 (ValuePair Low)) -> m (TypeAnnotation m Low)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (ValuePair High -> m (ValuePair Low))
-> SizedList16 (ValuePair High) -> m (SizedList16 (ValuePair Low))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ValuePair High -> m (ValuePair Low)
forall (s :: * -> *) (m :: * -> *).
(Staged s, DevolveM m) =>
s High -> m (s Low)
devolve SizedList16 (ValuePair High)
typeAnnotationValuePairs
instance ByteCodeStaged m => ByteCodeStaged (TypeAnnotation m) where
evolveBC :: (Index -> m Int)
-> TypeAnnotation m Low -> m (TypeAnnotation m High)
evolveBC Index -> m Int
f TypeAnnotation {m Low
Ref FieldDescriptor Low
TypePath
SizedList16 (ValuePair Low)
typeAnnotationValuePairs :: SizedList16 (ValuePair Low)
typeAnnotationType :: Ref FieldDescriptor Low
typeAnnotationPath :: TypePath
typeAnnotationTarget :: m Low
typeAnnotationValuePairs :: forall (m :: * -> *) r.
TypeAnnotation m r -> SizedList16 (ValuePair r)
typeAnnotationType :: forall (m :: * -> *) r. TypeAnnotation m r -> Ref FieldDescriptor r
typeAnnotationPath :: forall (m :: * -> *) r. TypeAnnotation m r -> TypePath
typeAnnotationTarget :: forall (m :: * -> *) r. TypeAnnotation m r -> m r
..} =
m High
-> TypePath
-> FieldDescriptor
-> SizedList16 (ValuePair High)
-> TypeAnnotation m High
forall (m :: * -> *) r.
m r
-> TypePath
-> Ref FieldDescriptor r
-> SizedList16 (ValuePair r)
-> TypeAnnotation m r
TypeAnnotation
(m High
-> TypePath
-> FieldDescriptor
-> SizedList16 (ValuePair High)
-> TypeAnnotation m High)
-> m (m High)
-> m (TypePath
-> FieldDescriptor
-> SizedList16 (ValuePair High)
-> TypeAnnotation m High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Index -> m Int) -> m Low -> m (m High)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, EvolveM m) =>
(Index -> m Int) -> s Low -> m (s High)
evolveBC Index -> m Int
f m Low
typeAnnotationTarget
m (TypePath
-> FieldDescriptor
-> SizedList16 (ValuePair High)
-> TypeAnnotation m High)
-> m TypePath
-> m (FieldDescriptor
-> SizedList16 (ValuePair High) -> TypeAnnotation m High)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> TypePath -> m TypePath
forall (f :: * -> *) a. Applicative f => a -> f a
pure TypePath
typeAnnotationPath
m (FieldDescriptor
-> SizedList16 (ValuePair High) -> TypeAnnotation m High)
-> m FieldDescriptor
-> m (SizedList16 (ValuePair High) -> TypeAnnotation m High)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Index -> m FieldDescriptor
forall (m :: * -> *) r.
(EvolveM m, Referenceable r) =>
Index -> m r
link Index
Ref FieldDescriptor Low
typeAnnotationType
m (SizedList16 (ValuePair High) -> TypeAnnotation m High)
-> m (SizedList16 (ValuePair High)) -> m (TypeAnnotation m High)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (ValuePair Low -> m (ValuePair High))
-> SizedList16 (ValuePair Low) -> m (SizedList16 (ValuePair High))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ValuePair Low -> m (ValuePair High)
forall (s :: * -> *) (m :: * -> *).
(Staged s, EvolveM m) =>
s Low -> m (s High)
evolve SizedList16 (ValuePair Low)
typeAnnotationValuePairs
devolveBC :: (Int -> m Index)
-> TypeAnnotation m High -> m (TypeAnnotation m Low)
devolveBC Int -> m Index
f TypeAnnotation {m High
Ref FieldDescriptor High
TypePath
SizedList16 (ValuePair High)
typeAnnotationValuePairs :: SizedList16 (ValuePair High)
typeAnnotationType :: Ref FieldDescriptor High
typeAnnotationPath :: TypePath
typeAnnotationTarget :: m High
typeAnnotationValuePairs :: forall (m :: * -> *) r.
TypeAnnotation m r -> SizedList16 (ValuePair r)
typeAnnotationType :: forall (m :: * -> *) r. TypeAnnotation m r -> Ref FieldDescriptor r
typeAnnotationPath :: forall (m :: * -> *) r. TypeAnnotation m r -> TypePath
typeAnnotationTarget :: forall (m :: * -> *) r. TypeAnnotation m r -> m r
..} =
m Low
-> TypePath
-> Index
-> SizedList16 (ValuePair Low)
-> TypeAnnotation m Low
forall (m :: * -> *) r.
m r
-> TypePath
-> Ref FieldDescriptor r
-> SizedList16 (ValuePair r)
-> TypeAnnotation m r
TypeAnnotation
(m Low
-> TypePath
-> Index
-> SizedList16 (ValuePair Low)
-> TypeAnnotation m Low)
-> m (m Low)
-> m (TypePath
-> Index -> SizedList16 (ValuePair Low) -> TypeAnnotation m Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> m Index) -> m High -> m (m Low)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, DevolveM m) =>
(Int -> m Index) -> s High -> m (s Low)
devolveBC Int -> m Index
f m High
typeAnnotationTarget
m (TypePath
-> Index -> SizedList16 (ValuePair Low) -> TypeAnnotation m Low)
-> m TypePath
-> m (Index -> SizedList16 (ValuePair Low) -> TypeAnnotation m Low)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> TypePath -> m TypePath
forall (f :: * -> *) a. Applicative f => a -> f a
pure TypePath
typeAnnotationPath
m (Index -> SizedList16 (ValuePair Low) -> TypeAnnotation m Low)
-> m Index
-> m (SizedList16 (ValuePair Low) -> TypeAnnotation m Low)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FieldDescriptor -> m Index
forall (m :: * -> *) r.
(DevolveM m, Referenceable r) =>
r -> m Index
unlink Ref FieldDescriptor High
FieldDescriptor
typeAnnotationType
m (SizedList16 (ValuePair Low) -> TypeAnnotation m Low)
-> m (SizedList16 (ValuePair Low)) -> m (TypeAnnotation m Low)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (ValuePair High -> m (ValuePair Low))
-> SizedList16 (ValuePair High) -> m (SizedList16 (ValuePair Low))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ValuePair High -> m (ValuePair Low)
forall (s :: * -> *) (m :: * -> *).
(Staged s, DevolveM m) =>
s High -> m (s Low)
devolve SizedList16 (ValuePair High)
typeAnnotationValuePairs
deriving instance Show (m High) => Show (TypeAnnotation m High)
deriving instance Eq (m High) => Eq (TypeAnnotation m High)
deriving instance Generic (m High) => Generic (TypeAnnotation m High)
deriving instance (Generic (m High), NFData (m High)) => NFData (TypeAnnotation m High)
deriving instance Show (m Low) => Show (TypeAnnotation m Low)
deriving instance Eq (m Low) => Eq (TypeAnnotation m Low)
deriving instance Ord (m Low) => Ord (TypeAnnotation m Low)
deriving instance Generic (m Low) => Generic (TypeAnnotation m Low)
deriving instance (Generic (m Low), NFData (m Low)) => NFData (TypeAnnotation m Low)
type TypePath = SizedList8 TypePathItem
data TypePathItem = TypePathItem
{ TypePathItem -> TypePathKind
typePathKind :: !TypePathKind
, TypePathItem -> Word8
typePathIndex :: !Word8
} deriving (Int -> TypePathItem -> String -> String
[TypePathItem] -> String -> String
TypePathItem -> String
(Int -> TypePathItem -> String -> String)
-> (TypePathItem -> String)
-> ([TypePathItem] -> String -> String)
-> Show TypePathItem
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [TypePathItem] -> String -> String
$cshowList :: [TypePathItem] -> String -> String
show :: TypePathItem -> String
$cshow :: TypePathItem -> String
showsPrec :: Int -> TypePathItem -> String -> String
$cshowsPrec :: Int -> TypePathItem -> String -> String
Show, TypePathItem -> TypePathItem -> Bool
(TypePathItem -> TypePathItem -> Bool)
-> (TypePathItem -> TypePathItem -> Bool) -> Eq TypePathItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypePathItem -> TypePathItem -> Bool
$c/= :: TypePathItem -> TypePathItem -> Bool
== :: TypePathItem -> TypePathItem -> Bool
$c== :: TypePathItem -> TypePathItem -> Bool
Eq, Eq TypePathItem
Eq TypePathItem
-> (TypePathItem -> TypePathItem -> Ordering)
-> (TypePathItem -> TypePathItem -> Bool)
-> (TypePathItem -> TypePathItem -> Bool)
-> (TypePathItem -> TypePathItem -> Bool)
-> (TypePathItem -> TypePathItem -> Bool)
-> (TypePathItem -> TypePathItem -> TypePathItem)
-> (TypePathItem -> TypePathItem -> TypePathItem)
-> Ord TypePathItem
TypePathItem -> TypePathItem -> Bool
TypePathItem -> TypePathItem -> Ordering
TypePathItem -> TypePathItem -> TypePathItem
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: TypePathItem -> TypePathItem -> TypePathItem
$cmin :: TypePathItem -> TypePathItem -> TypePathItem
max :: TypePathItem -> TypePathItem -> TypePathItem
$cmax :: TypePathItem -> TypePathItem -> TypePathItem
>= :: TypePathItem -> TypePathItem -> Bool
$c>= :: TypePathItem -> TypePathItem -> Bool
> :: TypePathItem -> TypePathItem -> Bool
$c> :: TypePathItem -> TypePathItem -> Bool
<= :: TypePathItem -> TypePathItem -> Bool
$c<= :: TypePathItem -> TypePathItem -> Bool
< :: TypePathItem -> TypePathItem -> Bool
$c< :: TypePathItem -> TypePathItem -> Bool
compare :: TypePathItem -> TypePathItem -> Ordering
$ccompare :: TypePathItem -> TypePathItem -> Ordering
$cp1Ord :: Eq TypePathItem
Ord, (forall x. TypePathItem -> Rep TypePathItem x)
-> (forall x. Rep TypePathItem x -> TypePathItem)
-> Generic TypePathItem
forall x. Rep TypePathItem x -> TypePathItem
forall x. TypePathItem -> Rep TypePathItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TypePathItem x -> TypePathItem
$cfrom :: forall x. TypePathItem -> Rep TypePathItem x
Generic, TypePathItem -> ()
(TypePathItem -> ()) -> NFData TypePathItem
forall a. (a -> ()) -> NFData a
rnf :: TypePathItem -> ()
$crnf :: TypePathItem -> ()
NFData)
data TypePathKind
= TPathInArray
| TPathInNested
| TPathWildcard
| TPathTypeArgument
deriving (Int -> TypePathKind -> String -> String
[TypePathKind] -> String -> String
TypePathKind -> String
(Int -> TypePathKind -> String -> String)
-> (TypePathKind -> String)
-> ([TypePathKind] -> String -> String)
-> Show TypePathKind
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [TypePathKind] -> String -> String
$cshowList :: [TypePathKind] -> String -> String
show :: TypePathKind -> String
$cshow :: TypePathKind -> String
showsPrec :: Int -> TypePathKind -> String -> String
$cshowsPrec :: Int -> TypePathKind -> String -> String
Show, TypePathKind -> TypePathKind -> Bool
(TypePathKind -> TypePathKind -> Bool)
-> (TypePathKind -> TypePathKind -> Bool) -> Eq TypePathKind
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypePathKind -> TypePathKind -> Bool
$c/= :: TypePathKind -> TypePathKind -> Bool
== :: TypePathKind -> TypePathKind -> Bool
$c== :: TypePathKind -> TypePathKind -> Bool
Eq, Eq TypePathKind
Eq TypePathKind
-> (TypePathKind -> TypePathKind -> Ordering)
-> (TypePathKind -> TypePathKind -> Bool)
-> (TypePathKind -> TypePathKind -> Bool)
-> (TypePathKind -> TypePathKind -> Bool)
-> (TypePathKind -> TypePathKind -> Bool)
-> (TypePathKind -> TypePathKind -> TypePathKind)
-> (TypePathKind -> TypePathKind -> TypePathKind)
-> Ord TypePathKind
TypePathKind -> TypePathKind -> Bool
TypePathKind -> TypePathKind -> Ordering
TypePathKind -> TypePathKind -> TypePathKind
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: TypePathKind -> TypePathKind -> TypePathKind
$cmin :: TypePathKind -> TypePathKind -> TypePathKind
max :: TypePathKind -> TypePathKind -> TypePathKind
$cmax :: TypePathKind -> TypePathKind -> TypePathKind
>= :: TypePathKind -> TypePathKind -> Bool
$c>= :: TypePathKind -> TypePathKind -> Bool
> :: TypePathKind -> TypePathKind -> Bool
$c> :: TypePathKind -> TypePathKind -> Bool
<= :: TypePathKind -> TypePathKind -> Bool
$c<= :: TypePathKind -> TypePathKind -> Bool
< :: TypePathKind -> TypePathKind -> Bool
$c< :: TypePathKind -> TypePathKind -> Bool
compare :: TypePathKind -> TypePathKind -> Ordering
$ccompare :: TypePathKind -> TypePathKind -> Ordering
$cp1Ord :: Eq TypePathKind
Ord, (forall x. TypePathKind -> Rep TypePathKind x)
-> (forall x. Rep TypePathKind x -> TypePathKind)
-> Generic TypePathKind
forall x. Rep TypePathKind x -> TypePathKind
forall x. TypePathKind -> Rep TypePathKind x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TypePathKind x -> TypePathKind
$cfrom :: forall x. TypePathKind -> Rep TypePathKind x
Generic, TypePathKind -> ()
(TypePathKind -> ()) -> NFData TypePathKind
forall a. (a -> ()) -> NFData a
rnf :: TypePathKind -> ()
$crnf :: TypePathKind -> ()
NFData)
instance Binary TypePathItem where
get :: Get TypePathItem
get = do
TypePathKind
typePathKind <- Get Word8
getWord8 Get Word8 -> (Word8 -> Get TypePathKind) -> Get TypePathKind
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> TypePathKind -> Get TypePathKind
forall (f :: * -> *) a. Applicative f => a -> f a
pure TypePathKind
TPathInArray
Word8
1 -> TypePathKind -> Get TypePathKind
forall (f :: * -> *) a. Applicative f => a -> f a
pure TypePathKind
TPathInNested
Word8
2 -> TypePathKind -> Get TypePathKind
forall (f :: * -> *) a. Applicative f => a -> f a
pure TypePathKind
TPathWildcard
Word8
3 -> TypePathKind -> Get TypePathKind
forall (f :: * -> *) a. Applicative f => a -> f a
pure TypePathKind
TPathTypeArgument
Word8
a -> String -> Get TypePathKind
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Get TypePathKind) -> String -> Get TypePathKind
forall a b. (a -> b) -> a -> b
$ String
"Expected unsigned byte in range [0:3] got: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Word8 -> String
forall a. Show a => a -> String
show Word8
a
Word8
typePathIndex <- Get Word8
getWord8
TypePathItem -> Get TypePathItem
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TypePathItem -> Get TypePathItem)
-> TypePathItem -> Get TypePathItem
forall a b. (a -> b) -> a -> b
$ TypePathItem :: TypePathKind -> Word8 -> TypePathItem
TypePathItem { Word8
TypePathKind
typePathIndex :: Word8
typePathKind :: TypePathKind
typePathIndex :: Word8
typePathKind :: TypePathKind
.. }
put :: TypePathItem -> Put
put TypePathItem {Word8
TypePathKind
typePathIndex :: Word8
typePathKind :: TypePathKind
typePathIndex :: TypePathItem -> Word8
typePathKind :: TypePathItem -> TypePathKind
..} = do
Word8 -> Put
putWord8 (Word8 -> Put) -> Word8 -> Put
forall a b. (a -> b) -> a -> b
$ case TypePathKind
typePathKind of
TypePathKind
TPathInArray -> Word8
0
TypePathKind
TPathInNested -> Word8
1
TypePathKind
TPathWildcard -> Word8
2
TypePathKind
TPathTypeArgument -> Word8
3
Word8 -> Put
putWord8 Word8
typePathIndex
data ClassTypeAnnotation r
= ClassTypeParameterDeclaration !TypeParameterTarget
| ClassSuperType !SupertypeTarget
| ClassBoundTypeParameterDeclaration !TypeParameterBoundTarget
instance Binary (ClassTypeAnnotation Low) where
get :: Get (ClassTypeAnnotation Low)
get = Get Word8
getWord8 Get Word8
-> (Word8 -> Get (ClassTypeAnnotation Low))
-> Get (ClassTypeAnnotation Low)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0x00 -> Word8 -> ClassTypeAnnotation Low
forall r. Word8 -> ClassTypeAnnotation r
ClassTypeParameterDeclaration (Word8 -> ClassTypeAnnotation Low)
-> Get Word8 -> Get (ClassTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Word8
forall t. Binary t => Get t
get
Word8
0x10 -> Index -> ClassTypeAnnotation Low
forall r. Index -> ClassTypeAnnotation r
ClassSuperType (Index -> ClassTypeAnnotation Low)
-> Get Index -> Get (ClassTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Index
forall t. Binary t => Get t
get
Word8
0x11 -> TypeParameterBoundTarget -> ClassTypeAnnotation Low
forall r. TypeParameterBoundTarget -> ClassTypeAnnotation r
ClassBoundTypeParameterDeclaration (TypeParameterBoundTarget -> ClassTypeAnnotation Low)
-> Get TypeParameterBoundTarget -> Get (ClassTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get TypeParameterBoundTarget
forall t. Binary t => Get t
get
Word8
a ->
String -> Get (ClassTypeAnnotation Low)
forall (m :: * -> *) a. MonadFail m => String -> m a
fail
(String -> Get (ClassTypeAnnotation Low))
-> String -> Get (ClassTypeAnnotation Low)
forall a b. (a -> b) -> a -> b
$ String
"Unexpected target type "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Word8 -> String -> String
forall a. (Integral a, Show a) => a -> String -> String
showHex Word8
a String
""
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" in class type annotation"
put :: ClassTypeAnnotation Low -> Put
put = \case
ClassTypeParameterDeclaration Word8
a -> Word8 -> Put
putWord8 Word8
0x00 Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Word8 -> Put
forall t. Binary t => t -> Put
put Word8
a
ClassSuperType Index
a -> Word8 -> Put
putWord8 Word8
0x10 Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Index -> Put
forall t. Binary t => t -> Put
put Index
a
ClassBoundTypeParameterDeclaration TypeParameterBoundTarget
a -> Word8 -> Put
putWord8 Word8
0x11 Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TypeParameterBoundTarget -> Put
forall t. Binary t => t -> Put
put TypeParameterBoundTarget
a
instance Staged ClassTypeAnnotation where
stage :: (forall (s' :: * -> *). Staged s' => s' r -> m (s' r'))
-> ClassTypeAnnotation r -> m (ClassTypeAnnotation r')
stage forall (s' :: * -> *). Staged s' => s' r -> m (s' r')
_ = ClassTypeAnnotation r' -> m (ClassTypeAnnotation r')
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ClassTypeAnnotation r' -> m (ClassTypeAnnotation r'))
-> (ClassTypeAnnotation r -> ClassTypeAnnotation r')
-> ClassTypeAnnotation r
-> m (ClassTypeAnnotation r')
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ClassTypeAnnotation r -> ClassTypeAnnotation r'
forall a b. a -> b
unsafeCoerce
data MethodTypeAnnotation r
= MethodTypeParameterDeclaration !TypeParameterTarget
| MethodBoundTypeParameterDeclaration !TypeParameterBoundTarget
| MethodReturnType
| MethodReceiverType
| MethodFormalParameter !FormalParameterTarget
| MethodThrowsClause !ThrowsTarget
instance Binary (MethodTypeAnnotation Low) where
get :: Get (MethodTypeAnnotation Low)
get = Get Word8
getWord8 Get Word8
-> (Word8 -> Get (MethodTypeAnnotation Low))
-> Get (MethodTypeAnnotation Low)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0x01 -> Word8 -> MethodTypeAnnotation Low
forall r. Word8 -> MethodTypeAnnotation r
MethodTypeParameterDeclaration (Word8 -> MethodTypeAnnotation Low)
-> Get Word8 -> Get (MethodTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Word8
forall t. Binary t => Get t
get
Word8
0x12 -> TypeParameterBoundTarget -> MethodTypeAnnotation Low
forall r. TypeParameterBoundTarget -> MethodTypeAnnotation r
MethodBoundTypeParameterDeclaration (TypeParameterBoundTarget -> MethodTypeAnnotation Low)
-> Get TypeParameterBoundTarget -> Get (MethodTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get TypeParameterBoundTarget
forall t. Binary t => Get t
get
Word8
0x14 -> MethodTypeAnnotation Low -> Get (MethodTypeAnnotation Low)
forall (f :: * -> *) a. Applicative f => a -> f a
pure MethodTypeAnnotation Low
forall r. MethodTypeAnnotation r
MethodReturnType
Word8
0x15 -> MethodTypeAnnotation Low -> Get (MethodTypeAnnotation Low)
forall (f :: * -> *) a. Applicative f => a -> f a
pure MethodTypeAnnotation Low
forall r. MethodTypeAnnotation r
MethodReceiverType
Word8
0x16 -> Word8 -> MethodTypeAnnotation Low
forall r. Word8 -> MethodTypeAnnotation r
MethodFormalParameter (Word8 -> MethodTypeAnnotation Low)
-> Get Word8 -> Get (MethodTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Word8
forall t. Binary t => Get t
get
Word8
0x17 -> Index -> MethodTypeAnnotation Low
forall r. Index -> MethodTypeAnnotation r
MethodThrowsClause (Index -> MethodTypeAnnotation Low)
-> Get Index -> Get (MethodTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Index
forall t. Binary t => Get t
get
Word8
a ->
String -> Get (MethodTypeAnnotation Low)
forall (m :: * -> *) a. MonadFail m => String -> m a
fail
(String -> Get (MethodTypeAnnotation Low))
-> String -> Get (MethodTypeAnnotation Low)
forall a b. (a -> b) -> a -> b
$ String
"Unexpected target type "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Word8 -> String -> String
forall a. (Integral a, Show a) => a -> String -> String
showHex Word8
a String
""
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" in method type annotation"
put :: MethodTypeAnnotation Low -> Put
put = \case
MethodTypeParameterDeclaration Word8
a -> Word8 -> Put
putWord8 Word8
0x01 Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Word8 -> Put
forall t. Binary t => t -> Put
put Word8
a
MethodBoundTypeParameterDeclaration TypeParameterBoundTarget
a -> Word8 -> Put
putWord8 Word8
0x12 Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TypeParameterBoundTarget -> Put
forall t. Binary t => t -> Put
put TypeParameterBoundTarget
a
MethodTypeAnnotation Low
MethodReturnType -> Word8 -> Put
putWord8 Word8
0x14
MethodTypeAnnotation Low
MethodReceiverType -> Word8 -> Put
putWord8 Word8
0x15
MethodFormalParameter Word8
a -> Word8 -> Put
putWord8 Word8
0x16 Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Word8 -> Put
forall t. Binary t => t -> Put
put Word8
a
MethodThrowsClause Index
a -> Word8 -> Put
putWord8 Word8
0x17 Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Index -> Put
forall t. Binary t => t -> Put
put Index
a
instance Staged MethodTypeAnnotation where
stage :: (forall (s' :: * -> *). Staged s' => s' r -> m (s' r'))
-> MethodTypeAnnotation r -> m (MethodTypeAnnotation r')
stage forall (s' :: * -> *). Staged s' => s' r -> m (s' r')
_ = MethodTypeAnnotation r' -> m (MethodTypeAnnotation r')
forall (f :: * -> *) a. Applicative f => a -> f a
pure (MethodTypeAnnotation r' -> m (MethodTypeAnnotation r'))
-> (MethodTypeAnnotation r -> MethodTypeAnnotation r')
-> MethodTypeAnnotation r
-> m (MethodTypeAnnotation r')
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MethodTypeAnnotation r -> MethodTypeAnnotation r'
forall a b. a -> b
unsafeCoerce
data FieldTypeAnnotation r =
FieldTypeAnnotation
instance Staged FieldTypeAnnotation where
stage :: (forall (s' :: * -> *). Staged s' => s' r -> m (s' r'))
-> FieldTypeAnnotation r -> m (FieldTypeAnnotation r')
stage forall (s' :: * -> *). Staged s' => s' r -> m (s' r')
_ = FieldTypeAnnotation r' -> m (FieldTypeAnnotation r')
forall (f :: * -> *) a. Applicative f => a -> f a
pure (FieldTypeAnnotation r' -> m (FieldTypeAnnotation r'))
-> (FieldTypeAnnotation r -> FieldTypeAnnotation r')
-> FieldTypeAnnotation r
-> m (FieldTypeAnnotation r')
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FieldTypeAnnotation r -> FieldTypeAnnotation r'
forall a b. a -> b
unsafeCoerce
instance Binary (FieldTypeAnnotation Low) where
get :: Get (FieldTypeAnnotation Low)
get = Get Word8
getWord8 Get Word8
-> (Word8 -> Get (FieldTypeAnnotation Low))
-> Get (FieldTypeAnnotation Low)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0x13 -> FieldTypeAnnotation Low -> Get (FieldTypeAnnotation Low)
forall (f :: * -> *) a. Applicative f => a -> f a
pure FieldTypeAnnotation Low
forall r. FieldTypeAnnotation r
FieldTypeAnnotation
Word8
a ->
String -> Get (FieldTypeAnnotation Low)
forall (m :: * -> *) a. MonadFail m => String -> m a
fail
(String -> Get (FieldTypeAnnotation Low))
-> String -> Get (FieldTypeAnnotation Low)
forall a b. (a -> b) -> a -> b
$ String
"Unexpected target type "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Word8 -> String -> String
forall a. (Integral a, Show a) => a -> String -> String
showHex Word8
a String
""
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" in field type annotation"
put :: FieldTypeAnnotation Low -> Put
put FieldTypeAnnotation Low
_ = Word8 -> Put
putWord8 Word8
0x13
data CodeTypeAnnotation r
= LocalVariableDeclaration !(LocalvarTarget r)
| ResourceVariableDeclaration !(LocalvarTarget r)
| ExceptionParameterDeclaration !CatchTarget
| InstanceOfExpression !(OffsetTarget r)
| NewExpression !(OffsetTarget r)
| NewMethodReferenceExpression !(OffsetTarget r)
| IdentifierMethodReferenceExpression !(OffsetTarget r)
| CastExpression !(TypeArgumentTarget r)
| ConstructorExpression !(TypeArgumentTarget r)
| MethodIncovationExpression !(TypeArgumentTarget r)
| GenericNewMethodReferenceExpression !(TypeArgumentTarget r)
| GenericIdentifierwMethodReferenceExpression !(TypeArgumentTarget r)
instance Binary (CodeTypeAnnotation Low) where
get :: Get (CodeTypeAnnotation Low)
get = Get Word8
getWord8 Get Word8
-> (Word8 -> Get (CodeTypeAnnotation Low))
-> Get (CodeTypeAnnotation Low)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0x40 -> LocalvarTarget Low -> CodeTypeAnnotation Low
forall r. LocalvarTarget r -> CodeTypeAnnotation r
LocalVariableDeclaration (LocalvarTarget Low -> CodeTypeAnnotation Low)
-> Get (LocalvarTarget Low) -> Get (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get (LocalvarTarget Low)
forall t. Binary t => Get t
get
Word8
0x41 -> LocalvarTarget Low -> CodeTypeAnnotation Low
forall r. LocalvarTarget r -> CodeTypeAnnotation r
ResourceVariableDeclaration (LocalvarTarget Low -> CodeTypeAnnotation Low)
-> Get (LocalvarTarget Low) -> Get (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get (LocalvarTarget Low)
forall t. Binary t => Get t
get
Word8
0x42 -> Index -> CodeTypeAnnotation Low
forall r. Index -> CodeTypeAnnotation r
ExceptionParameterDeclaration (Index -> CodeTypeAnnotation Low)
-> Get Index -> Get (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Index
forall t. Binary t => Get t
get
Word8
0x43 -> Index -> CodeTypeAnnotation Low
forall r. OffsetTarget r -> CodeTypeAnnotation r
InstanceOfExpression (Index -> CodeTypeAnnotation Low)
-> Get Index -> Get (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Index
forall t. Binary t => Get t
get
Word8
0x44 -> Index -> CodeTypeAnnotation Low
forall r. OffsetTarget r -> CodeTypeAnnotation r
NewExpression (Index -> CodeTypeAnnotation Low)
-> Get Index -> Get (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Index
forall t. Binary t => Get t
get
Word8
0x45 -> Index -> CodeTypeAnnotation Low
forall r. OffsetTarget r -> CodeTypeAnnotation r
NewMethodReferenceExpression (Index -> CodeTypeAnnotation Low)
-> Get Index -> Get (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Index
forall t. Binary t => Get t
get
Word8
0x46 -> Index -> CodeTypeAnnotation Low
forall r. OffsetTarget r -> CodeTypeAnnotation r
IdentifierMethodReferenceExpression (Index -> CodeTypeAnnotation Low)
-> Get Index -> Get (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Index
forall t. Binary t => Get t
get
Word8
0x47 -> TypeArgumentTarget Low -> CodeTypeAnnotation Low
forall r. TypeArgumentTarget r -> CodeTypeAnnotation r
CastExpression (TypeArgumentTarget Low -> CodeTypeAnnotation Low)
-> Get (TypeArgumentTarget Low) -> Get (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get (TypeArgumentTarget Low)
forall t. Binary t => Get t
get
Word8
0x48 -> TypeArgumentTarget Low -> CodeTypeAnnotation Low
forall r. TypeArgumentTarget r -> CodeTypeAnnotation r
ConstructorExpression (TypeArgumentTarget Low -> CodeTypeAnnotation Low)
-> Get (TypeArgumentTarget Low) -> Get (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get (TypeArgumentTarget Low)
forall t. Binary t => Get t
get
Word8
0x49 -> TypeArgumentTarget Low -> CodeTypeAnnotation Low
forall r. TypeArgumentTarget r -> CodeTypeAnnotation r
MethodIncovationExpression (TypeArgumentTarget Low -> CodeTypeAnnotation Low)
-> Get (TypeArgumentTarget Low) -> Get (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get (TypeArgumentTarget Low)
forall t. Binary t => Get t
get
Word8
0x4A -> TypeArgumentTarget Low -> CodeTypeAnnotation Low
forall r. TypeArgumentTarget r -> CodeTypeAnnotation r
GenericNewMethodReferenceExpression (TypeArgumentTarget Low -> CodeTypeAnnotation Low)
-> Get (TypeArgumentTarget Low) -> Get (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get (TypeArgumentTarget Low)
forall t. Binary t => Get t
get
Word8
0x4B -> TypeArgumentTarget Low -> CodeTypeAnnotation Low
forall r. TypeArgumentTarget r -> CodeTypeAnnotation r
GenericIdentifierwMethodReferenceExpression (TypeArgumentTarget Low -> CodeTypeAnnotation Low)
-> Get (TypeArgumentTarget Low) -> Get (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get (TypeArgumentTarget Low)
forall t. Binary t => Get t
get
Word8
a ->
String -> Get (CodeTypeAnnotation Low)
forall (m :: * -> *) a. MonadFail m => String -> m a
fail
(String -> Get (CodeTypeAnnotation Low))
-> String -> Get (CodeTypeAnnotation Low)
forall a b. (a -> b) -> a -> b
$ String
"Unexpected target type "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Word8 -> String -> String
forall a. (Integral a, Show a) => a -> String -> String
showHex Word8
a String
""
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" in code type annotation"
put :: CodeTypeAnnotation Low -> Put
put = \case
LocalVariableDeclaration LocalvarTarget Low
a -> Word8 -> Put
putWord8 Word8
0x40 Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> LocalvarTarget Low -> Put
forall t. Binary t => t -> Put
put LocalvarTarget Low
a
ResourceVariableDeclaration LocalvarTarget Low
a -> Word8 -> Put
putWord8 Word8
0x41 Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> LocalvarTarget Low -> Put
forall t. Binary t => t -> Put
put LocalvarTarget Low
a
ExceptionParameterDeclaration Index
a -> Word8 -> Put
putWord8 Word8
0x42 Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Index -> Put
forall t. Binary t => t -> Put
put Index
a
InstanceOfExpression OffsetTarget Low
a -> Word8 -> Put
putWord8 Word8
0x43 Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Index -> Put
forall t. Binary t => t -> Put
put Index
OffsetTarget Low
a
NewExpression OffsetTarget Low
a -> Word8 -> Put
putWord8 Word8
0x44 Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Index -> Put
forall t. Binary t => t -> Put
put Index
OffsetTarget Low
a
NewMethodReferenceExpression OffsetTarget Low
a -> Word8 -> Put
putWord8 Word8
0x45 Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Index -> Put
forall t. Binary t => t -> Put
put Index
OffsetTarget Low
a
IdentifierMethodReferenceExpression OffsetTarget Low
a -> Word8 -> Put
putWord8 Word8
0x46 Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Index -> Put
forall t. Binary t => t -> Put
put Index
OffsetTarget Low
a
CastExpression TypeArgumentTarget Low
a -> Word8 -> Put
putWord8 Word8
0x47 Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TypeArgumentTarget Low -> Put
forall t. Binary t => t -> Put
put TypeArgumentTarget Low
a
ConstructorExpression TypeArgumentTarget Low
a -> Word8 -> Put
putWord8 Word8
0x48 Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TypeArgumentTarget Low -> Put
forall t. Binary t => t -> Put
put TypeArgumentTarget Low
a
MethodIncovationExpression TypeArgumentTarget Low
a -> Word8 -> Put
putWord8 Word8
0x49 Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TypeArgumentTarget Low -> Put
forall t. Binary t => t -> Put
put TypeArgumentTarget Low
a
GenericNewMethodReferenceExpression TypeArgumentTarget Low
a -> Word8 -> Put
putWord8 Word8
0x4A Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TypeArgumentTarget Low -> Put
forall t. Binary t => t -> Put
put TypeArgumentTarget Low
a
GenericIdentifierwMethodReferenceExpression TypeArgumentTarget Low
a -> Word8 -> Put
putWord8 Word8
0x4B Put -> Put -> Put
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TypeArgumentTarget Low -> Put
forall t. Binary t => t -> Put
put TypeArgumentTarget Low
a
instance ByteCodeStaged CodeTypeAnnotation where
evolveBC :: (Index -> m Int)
-> CodeTypeAnnotation Low -> m (CodeTypeAnnotation High)
evolveBC Index -> m Int
ev = \case
LocalVariableDeclaration LocalvarTarget Low
a ->
LocalvarTarget High -> CodeTypeAnnotation High
forall r. LocalvarTarget r -> CodeTypeAnnotation r
LocalVariableDeclaration (LocalvarTarget High -> CodeTypeAnnotation High)
-> m (LocalvarTarget High) -> m (CodeTypeAnnotation High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (LocalvarEntry Low -> m (LocalvarEntry High))
-> LocalvarTarget Low -> m (LocalvarTarget High)
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((Index -> m Int) -> LocalvarEntry Low -> m (LocalvarEntry High)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, EvolveM m) =>
(Index -> m Int) -> s Low -> m (s High)
evolveBC Index -> m Int
ev) LocalvarTarget Low
a
ResourceVariableDeclaration LocalvarTarget Low
a ->
LocalvarTarget High -> CodeTypeAnnotation High
forall r. LocalvarTarget r -> CodeTypeAnnotation r
ResourceVariableDeclaration (LocalvarTarget High -> CodeTypeAnnotation High)
-> m (LocalvarTarget High) -> m (CodeTypeAnnotation High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (LocalvarEntry Low -> m (LocalvarEntry High))
-> LocalvarTarget Low -> m (LocalvarTarget High)
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((Index -> m Int) -> LocalvarEntry Low -> m (LocalvarEntry High)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, EvolveM m) =>
(Index -> m Int) -> s Low -> m (s High)
evolveBC Index -> m Int
ev) LocalvarTarget Low
a
ExceptionParameterDeclaration Index
a -> CodeTypeAnnotation High -> m (CodeTypeAnnotation High)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (CodeTypeAnnotation High -> m (CodeTypeAnnotation High))
-> CodeTypeAnnotation High -> m (CodeTypeAnnotation High)
forall a b. (a -> b) -> a -> b
$ Index -> CodeTypeAnnotation High
forall r. Index -> CodeTypeAnnotation r
ExceptionParameterDeclaration Index
a
InstanceOfExpression OffsetTarget Low
a -> Int -> CodeTypeAnnotation High
forall r. OffsetTarget r -> CodeTypeAnnotation r
InstanceOfExpression (Int -> CodeTypeAnnotation High)
-> m Int -> m (CodeTypeAnnotation High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m Int
ev Index
OffsetTarget Low
a
NewExpression OffsetTarget Low
a -> Int -> CodeTypeAnnotation High
forall r. OffsetTarget r -> CodeTypeAnnotation r
NewExpression (Int -> CodeTypeAnnotation High)
-> m Int -> m (CodeTypeAnnotation High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m Int
ev Index
OffsetTarget Low
a
NewMethodReferenceExpression OffsetTarget Low
a -> Int -> CodeTypeAnnotation High
forall r. OffsetTarget r -> CodeTypeAnnotation r
NewMethodReferenceExpression (Int -> CodeTypeAnnotation High)
-> m Int -> m (CodeTypeAnnotation High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m Int
ev Index
OffsetTarget Low
a
IdentifierMethodReferenceExpression OffsetTarget Low
a ->
Int -> CodeTypeAnnotation High
forall r. OffsetTarget r -> CodeTypeAnnotation r
IdentifierMethodReferenceExpression (Int -> CodeTypeAnnotation High)
-> m Int -> m (CodeTypeAnnotation High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m Int
ev Index
OffsetTarget Low
a
CastExpression TypeArgumentTarget Low
a -> TypeArgumentTarget High -> CodeTypeAnnotation High
forall r. TypeArgumentTarget r -> CodeTypeAnnotation r
CastExpression (TypeArgumentTarget High -> CodeTypeAnnotation High)
-> m (TypeArgumentTarget High) -> m (CodeTypeAnnotation High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Index -> m Int)
-> TypeArgumentTarget Low -> m (TypeArgumentTarget High)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, EvolveM m) =>
(Index -> m Int) -> s Low -> m (s High)
evolveBC Index -> m Int
ev TypeArgumentTarget Low
a
ConstructorExpression TypeArgumentTarget Low
a -> TypeArgumentTarget High -> CodeTypeAnnotation High
forall r. TypeArgumentTarget r -> CodeTypeAnnotation r
ConstructorExpression (TypeArgumentTarget High -> CodeTypeAnnotation High)
-> m (TypeArgumentTarget High) -> m (CodeTypeAnnotation High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Index -> m Int)
-> TypeArgumentTarget Low -> m (TypeArgumentTarget High)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, EvolveM m) =>
(Index -> m Int) -> s Low -> m (s High)
evolveBC Index -> m Int
ev TypeArgumentTarget Low
a
MethodIncovationExpression TypeArgumentTarget Low
a ->
TypeArgumentTarget High -> CodeTypeAnnotation High
forall r. TypeArgumentTarget r -> CodeTypeAnnotation r
MethodIncovationExpression (TypeArgumentTarget High -> CodeTypeAnnotation High)
-> m (TypeArgumentTarget High) -> m (CodeTypeAnnotation High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Index -> m Int)
-> TypeArgumentTarget Low -> m (TypeArgumentTarget High)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, EvolveM m) =>
(Index -> m Int) -> s Low -> m (s High)
evolveBC Index -> m Int
ev TypeArgumentTarget Low
a
GenericNewMethodReferenceExpression TypeArgumentTarget Low
a ->
TypeArgumentTarget High -> CodeTypeAnnotation High
forall r. TypeArgumentTarget r -> CodeTypeAnnotation r
GenericNewMethodReferenceExpression (TypeArgumentTarget High -> CodeTypeAnnotation High)
-> m (TypeArgumentTarget High) -> m (CodeTypeAnnotation High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Index -> m Int)
-> TypeArgumentTarget Low -> m (TypeArgumentTarget High)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, EvolveM m) =>
(Index -> m Int) -> s Low -> m (s High)
evolveBC Index -> m Int
ev TypeArgumentTarget Low
a
GenericIdentifierwMethodReferenceExpression TypeArgumentTarget Low
a ->
TypeArgumentTarget High -> CodeTypeAnnotation High
forall r. TypeArgumentTarget r -> CodeTypeAnnotation r
GenericIdentifierwMethodReferenceExpression (TypeArgumentTarget High -> CodeTypeAnnotation High)
-> m (TypeArgumentTarget High) -> m (CodeTypeAnnotation High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Index -> m Int)
-> TypeArgumentTarget Low -> m (TypeArgumentTarget High)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, EvolveM m) =>
(Index -> m Int) -> s Low -> m (s High)
evolveBC Index -> m Int
ev TypeArgumentTarget Low
a
devolveBC :: (Int -> m Index)
-> CodeTypeAnnotation High -> m (CodeTypeAnnotation Low)
devolveBC Int -> m Index
dev = \case
LocalVariableDeclaration LocalvarTarget High
a ->
LocalvarTarget Low -> CodeTypeAnnotation Low
forall r. LocalvarTarget r -> CodeTypeAnnotation r
LocalVariableDeclaration (LocalvarTarget Low -> CodeTypeAnnotation Low)
-> m (LocalvarTarget Low) -> m (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (LocalvarEntry High -> m (LocalvarEntry Low))
-> LocalvarTarget High -> m (LocalvarTarget Low)
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((Int -> m Index) -> LocalvarEntry High -> m (LocalvarEntry Low)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, DevolveM m) =>
(Int -> m Index) -> s High -> m (s Low)
devolveBC Int -> m Index
dev) LocalvarTarget High
a
ResourceVariableDeclaration LocalvarTarget High
a ->
LocalvarTarget Low -> CodeTypeAnnotation Low
forall r. LocalvarTarget r -> CodeTypeAnnotation r
ResourceVariableDeclaration (LocalvarTarget Low -> CodeTypeAnnotation Low)
-> m (LocalvarTarget Low) -> m (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (LocalvarEntry High -> m (LocalvarEntry Low))
-> LocalvarTarget High -> m (LocalvarTarget Low)
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((Int -> m Index) -> LocalvarEntry High -> m (LocalvarEntry Low)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, DevolveM m) =>
(Int -> m Index) -> s High -> m (s Low)
devolveBC Int -> m Index
dev) LocalvarTarget High
a
ExceptionParameterDeclaration Index
a -> CodeTypeAnnotation Low -> m (CodeTypeAnnotation Low)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (CodeTypeAnnotation Low -> m (CodeTypeAnnotation Low))
-> CodeTypeAnnotation Low -> m (CodeTypeAnnotation Low)
forall a b. (a -> b) -> a -> b
$ Index -> CodeTypeAnnotation Low
forall r. Index -> CodeTypeAnnotation r
ExceptionParameterDeclaration Index
a
InstanceOfExpression OffsetTarget High
a -> Index -> CodeTypeAnnotation Low
forall r. OffsetTarget r -> CodeTypeAnnotation r
InstanceOfExpression (Index -> CodeTypeAnnotation Low)
-> m Index -> m (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> m Index
dev Int
OffsetTarget High
a
NewExpression OffsetTarget High
a -> Index -> CodeTypeAnnotation Low
forall r. OffsetTarget r -> CodeTypeAnnotation r
NewExpression (Index -> CodeTypeAnnotation Low)
-> m Index -> m (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> m Index
dev Int
OffsetTarget High
a
NewMethodReferenceExpression OffsetTarget High
a -> Index -> CodeTypeAnnotation Low
forall r. OffsetTarget r -> CodeTypeAnnotation r
NewMethodReferenceExpression (Index -> CodeTypeAnnotation Low)
-> m Index -> m (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> m Index
dev Int
OffsetTarget High
a
IdentifierMethodReferenceExpression OffsetTarget High
a ->
Index -> CodeTypeAnnotation Low
forall r. OffsetTarget r -> CodeTypeAnnotation r
IdentifierMethodReferenceExpression (Index -> CodeTypeAnnotation Low)
-> m Index -> m (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> m Index
dev Int
OffsetTarget High
a
CastExpression TypeArgumentTarget High
a -> TypeArgumentTarget Low -> CodeTypeAnnotation Low
forall r. TypeArgumentTarget r -> CodeTypeAnnotation r
CastExpression (TypeArgumentTarget Low -> CodeTypeAnnotation Low)
-> m (TypeArgumentTarget Low) -> m (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> m Index)
-> TypeArgumentTarget High -> m (TypeArgumentTarget Low)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, DevolveM m) =>
(Int -> m Index) -> s High -> m (s Low)
devolveBC Int -> m Index
dev TypeArgumentTarget High
a
ConstructorExpression TypeArgumentTarget High
a -> TypeArgumentTarget Low -> CodeTypeAnnotation Low
forall r. TypeArgumentTarget r -> CodeTypeAnnotation r
ConstructorExpression (TypeArgumentTarget Low -> CodeTypeAnnotation Low)
-> m (TypeArgumentTarget Low) -> m (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> m Index)
-> TypeArgumentTarget High -> m (TypeArgumentTarget Low)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, DevolveM m) =>
(Int -> m Index) -> s High -> m (s Low)
devolveBC Int -> m Index
dev TypeArgumentTarget High
a
MethodIncovationExpression TypeArgumentTarget High
a ->
TypeArgumentTarget Low -> CodeTypeAnnotation Low
forall r. TypeArgumentTarget r -> CodeTypeAnnotation r
MethodIncovationExpression (TypeArgumentTarget Low -> CodeTypeAnnotation Low)
-> m (TypeArgumentTarget Low) -> m (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> m Index)
-> TypeArgumentTarget High -> m (TypeArgumentTarget Low)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, DevolveM m) =>
(Int -> m Index) -> s High -> m (s Low)
devolveBC Int -> m Index
dev TypeArgumentTarget High
a
GenericNewMethodReferenceExpression TypeArgumentTarget High
a ->
TypeArgumentTarget Low -> CodeTypeAnnotation Low
forall r. TypeArgumentTarget r -> CodeTypeAnnotation r
GenericNewMethodReferenceExpression (TypeArgumentTarget Low -> CodeTypeAnnotation Low)
-> m (TypeArgumentTarget Low) -> m (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> m Index)
-> TypeArgumentTarget High -> m (TypeArgumentTarget Low)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, DevolveM m) =>
(Int -> m Index) -> s High -> m (s Low)
devolveBC Int -> m Index
dev TypeArgumentTarget High
a
GenericIdentifierwMethodReferenceExpression TypeArgumentTarget High
a ->
TypeArgumentTarget Low -> CodeTypeAnnotation Low
forall r. TypeArgumentTarget r -> CodeTypeAnnotation r
GenericIdentifierwMethodReferenceExpression (TypeArgumentTarget Low -> CodeTypeAnnotation Low)
-> m (TypeArgumentTarget Low) -> m (CodeTypeAnnotation Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> m Index)
-> TypeArgumentTarget High -> m (TypeArgumentTarget Low)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, DevolveM m) =>
(Int -> m Index) -> s High -> m (s Low)
devolveBC Int -> m Index
dev TypeArgumentTarget High
a
type TypeParameterTarget = Word8
type SupertypeTarget = Word16
isInExtendsClause :: SupertypeTarget -> Bool
isInExtendsClause :: Index -> Bool
isInExtendsClause Index
st = Index
st Index -> Index -> Bool
forall a. Eq a => a -> a -> Bool
== Index
0xFFFF
data TypeParameterBoundTarget = TypeParameterBoundTarget
{ TypeParameterBoundTarget -> Word8
typeParameter :: !TypeParameterTarget
, TypeParameterBoundTarget -> Word8
typeBound :: !Word8
} deriving (TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool
(TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool)
-> (TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool)
-> Eq TypeParameterBoundTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool
$c/= :: TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool
== :: TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool
$c== :: TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool
Eq, Int -> TypeParameterBoundTarget -> String -> String
[TypeParameterBoundTarget] -> String -> String
TypeParameterBoundTarget -> String
(Int -> TypeParameterBoundTarget -> String -> String)
-> (TypeParameterBoundTarget -> String)
-> ([TypeParameterBoundTarget] -> String -> String)
-> Show TypeParameterBoundTarget
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [TypeParameterBoundTarget] -> String -> String
$cshowList :: [TypeParameterBoundTarget] -> String -> String
show :: TypeParameterBoundTarget -> String
$cshow :: TypeParameterBoundTarget -> String
showsPrec :: Int -> TypeParameterBoundTarget -> String -> String
$cshowsPrec :: Int -> TypeParameterBoundTarget -> String -> String
Show, Eq TypeParameterBoundTarget
Eq TypeParameterBoundTarget
-> (TypeParameterBoundTarget
-> TypeParameterBoundTarget -> Ordering)
-> (TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool)
-> (TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool)
-> (TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool)
-> (TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool)
-> (TypeParameterBoundTarget
-> TypeParameterBoundTarget -> TypeParameterBoundTarget)
-> (TypeParameterBoundTarget
-> TypeParameterBoundTarget -> TypeParameterBoundTarget)
-> Ord TypeParameterBoundTarget
TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool
TypeParameterBoundTarget -> TypeParameterBoundTarget -> Ordering
TypeParameterBoundTarget
-> TypeParameterBoundTarget -> TypeParameterBoundTarget
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: TypeParameterBoundTarget
-> TypeParameterBoundTarget -> TypeParameterBoundTarget
$cmin :: TypeParameterBoundTarget
-> TypeParameterBoundTarget -> TypeParameterBoundTarget
max :: TypeParameterBoundTarget
-> TypeParameterBoundTarget -> TypeParameterBoundTarget
$cmax :: TypeParameterBoundTarget
-> TypeParameterBoundTarget -> TypeParameterBoundTarget
>= :: TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool
$c>= :: TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool
> :: TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool
$c> :: TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool
<= :: TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool
$c<= :: TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool
< :: TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool
$c< :: TypeParameterBoundTarget -> TypeParameterBoundTarget -> Bool
compare :: TypeParameterBoundTarget -> TypeParameterBoundTarget -> Ordering
$ccompare :: TypeParameterBoundTarget -> TypeParameterBoundTarget -> Ordering
$cp1Ord :: Eq TypeParameterBoundTarget
Ord, (forall x.
TypeParameterBoundTarget -> Rep TypeParameterBoundTarget x)
-> (forall x.
Rep TypeParameterBoundTarget x -> TypeParameterBoundTarget)
-> Generic TypeParameterBoundTarget
forall x.
Rep TypeParameterBoundTarget x -> TypeParameterBoundTarget
forall x.
TypeParameterBoundTarget -> Rep TypeParameterBoundTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TypeParameterBoundTarget x -> TypeParameterBoundTarget
$cfrom :: forall x.
TypeParameterBoundTarget -> Rep TypeParameterBoundTarget x
Generic, TypeParameterBoundTarget -> ()
(TypeParameterBoundTarget -> ()) -> NFData TypeParameterBoundTarget
forall a. (a -> ()) -> NFData a
rnf :: TypeParameterBoundTarget -> ()
$crnf :: TypeParameterBoundTarget -> ()
NFData)
instance Binary TypeParameterBoundTarget
type FormalParameterTarget = Word8
type ThrowsTarget = Word16
type LocalvarTarget r = SizedList16 (LocalvarEntry r)
data LocalvarEntry r = LocalvarEntry
{ LocalvarEntry r -> ByteCodeRef r
lvStartPc :: !(ByteCodeRef r)
, LocalvarEntry r -> Index
lvLength :: !Word16
, LocalvarEntry r -> Index
lvLocalVarIndex :: !Word16
}
instance ByteCodeStaged LocalvarEntry where
evolveBC :: (Index -> m Int) -> LocalvarEntry Low -> m (LocalvarEntry High)
evolveBC Index -> m Int
ev LocalvarEntry {Index
OffsetTarget Low
lvLocalVarIndex :: Index
lvLength :: Index
lvStartPc :: OffsetTarget Low
lvLocalVarIndex :: forall r. LocalvarEntry r -> Index
lvLength :: forall r. LocalvarEntry r -> Index
lvStartPc :: forall r. LocalvarEntry r -> ByteCodeRef r
..} =
Int -> Index -> Index -> LocalvarEntry High
forall r. ByteCodeRef r -> Index -> Index -> LocalvarEntry r
LocalvarEntry (Int -> Index -> Index -> LocalvarEntry High)
-> m Int -> m (Index -> Index -> LocalvarEntry High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m Int
ev Index
OffsetTarget Low
lvStartPc m (Index -> Index -> LocalvarEntry High)
-> m Index -> m (Index -> LocalvarEntry High)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Index -> m Index
forall (f :: * -> *) a. Applicative f => a -> f a
pure Index
lvLength m (Index -> LocalvarEntry High)
-> m Index -> m (LocalvarEntry High)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Index -> m Index
forall (f :: * -> *) a. Applicative f => a -> f a
pure Index
lvLocalVarIndex
devolveBC :: (Int -> m Index) -> LocalvarEntry High -> m (LocalvarEntry Low)
devolveBC Int -> m Index
dev LocalvarEntry {Index
OffsetTarget High
lvLocalVarIndex :: Index
lvLength :: Index
lvStartPc :: OffsetTarget High
lvLocalVarIndex :: forall r. LocalvarEntry r -> Index
lvLength :: forall r. LocalvarEntry r -> Index
lvStartPc :: forall r. LocalvarEntry r -> ByteCodeRef r
..} =
Index -> Index -> Index -> LocalvarEntry Low
forall r. ByteCodeRef r -> Index -> Index -> LocalvarEntry r
LocalvarEntry (Index -> Index -> Index -> LocalvarEntry Low)
-> m Index -> m (Index -> Index -> LocalvarEntry Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> m Index
dev Int
OffsetTarget High
lvStartPc m (Index -> Index -> LocalvarEntry Low)
-> m Index -> m (Index -> LocalvarEntry Low)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Index -> m Index
forall (f :: * -> *) a. Applicative f => a -> f a
pure Index
lvLength m (Index -> LocalvarEntry Low) -> m Index -> m (LocalvarEntry Low)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Index -> m Index
forall (f :: * -> *) a. Applicative f => a -> f a
pure Index
lvLocalVarIndex
type CatchTarget = Word16
type OffsetTarget r = ByteCodeRef r
data TypeArgumentTarget r = TypeArgumentTarget
{ TypeArgumentTarget r -> ByteCodeRef r
typeArgumentOffset :: !(ByteCodeRef r)
, TypeArgumentTarget r -> Word8
typeArgumentIndex :: Word8
}
instance ByteCodeStaged TypeArgumentTarget where
evolveBC :: (Index -> m Int)
-> TypeArgumentTarget Low -> m (TypeArgumentTarget High)
evolveBC Index -> m Int
ev TypeArgumentTarget {Word8
OffsetTarget Low
typeArgumentIndex :: Word8
typeArgumentOffset :: OffsetTarget Low
typeArgumentIndex :: forall r. TypeArgumentTarget r -> Word8
typeArgumentOffset :: forall r. TypeArgumentTarget r -> ByteCodeRef r
..} =
Int -> Word8 -> TypeArgumentTarget High
forall r. ByteCodeRef r -> Word8 -> TypeArgumentTarget r
TypeArgumentTarget (Int -> Word8 -> TypeArgumentTarget High)
-> m Int -> m (Word8 -> TypeArgumentTarget High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Index -> m Int
ev Index
OffsetTarget Low
typeArgumentOffset m (Word8 -> TypeArgumentTarget High)
-> m Word8 -> m (TypeArgumentTarget High)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Word8 -> m Word8
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word8
typeArgumentIndex
devolveBC :: (Int -> m Index)
-> TypeArgumentTarget High -> m (TypeArgumentTarget Low)
devolveBC Int -> m Index
dev TypeArgumentTarget {Word8
OffsetTarget High
typeArgumentIndex :: Word8
typeArgumentOffset :: OffsetTarget High
typeArgumentIndex :: forall r. TypeArgumentTarget r -> Word8
typeArgumentOffset :: forall r. TypeArgumentTarget r -> ByteCodeRef r
..} =
Index -> Word8 -> TypeArgumentTarget Low
forall r. ByteCodeRef r -> Word8 -> TypeArgumentTarget r
TypeArgumentTarget (Index -> Word8 -> TypeArgumentTarget Low)
-> m Index -> m (Word8 -> TypeArgumentTarget Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> m Index
dev Int
OffsetTarget High
typeArgumentOffset m (Word8 -> TypeArgumentTarget Low)
-> m Word8 -> m (TypeArgumentTarget Low)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Word8 -> m Word8
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word8
typeArgumentIndex
instance (Generic (m Low), Binary (m Low)) => IsAttribute (RuntimeVisibleTypeAnnotations m Low) where
attrName :: Const Text (RuntimeVisibleTypeAnnotations m Low)
attrName = Text -> Const Text (RuntimeVisibleTypeAnnotations m Low)
forall k a (b :: k). a -> Const a b
Const Text
"RuntimeVisibleTypeAnnotations"
instance (Staged m) => Staged (RuntimeVisibleTypeAnnotations m) where
stage :: (forall (s' :: * -> *). Staged s' => s' r -> m (s' r'))
-> RuntimeVisibleTypeAnnotations m r
-> m (RuntimeVisibleTypeAnnotations m r')
stage forall (s' :: * -> *). Staged s' => s' r -> m (s' r')
f (RuntimeVisibleTypeAnnotations SizedList16 (TypeAnnotation m r)
a) =
SizedList16 (TypeAnnotation m r')
-> RuntimeVisibleTypeAnnotations m r'
forall (m :: * -> *) r.
SizedList16 (TypeAnnotation m r)
-> RuntimeVisibleTypeAnnotations m r
RuntimeVisibleTypeAnnotations (SizedList16 (TypeAnnotation m r')
-> RuntimeVisibleTypeAnnotations m r')
-> m (SizedList16 (TypeAnnotation m r'))
-> m (RuntimeVisibleTypeAnnotations m r')
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (TypeAnnotation m r -> m (TypeAnnotation m r'))
-> SizedList16 (TypeAnnotation m r)
-> m (SizedList16 (TypeAnnotation m r'))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM TypeAnnotation m r -> m (TypeAnnotation m r')
forall (s' :: * -> *). Staged s' => s' r -> m (s' r')
f SizedList16 (TypeAnnotation m r)
a
instance ByteCodeStaged m => ByteCodeStaged (RuntimeVisibleTypeAnnotations m) where
evolveBC :: (Index -> m Int)
-> RuntimeVisibleTypeAnnotations m Low
-> m (RuntimeVisibleTypeAnnotations m High)
evolveBC Index -> m Int
f (RuntimeVisibleTypeAnnotations SizedList16 (TypeAnnotation m Low)
a) =
SizedList16 (TypeAnnotation m High)
-> RuntimeVisibleTypeAnnotations m High
forall (m :: * -> *) r.
SizedList16 (TypeAnnotation m r)
-> RuntimeVisibleTypeAnnotations m r
RuntimeVisibleTypeAnnotations (SizedList16 (TypeAnnotation m High)
-> RuntimeVisibleTypeAnnotations m High)
-> m (SizedList16 (TypeAnnotation m High))
-> m (RuntimeVisibleTypeAnnotations m High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (TypeAnnotation m Low -> m (TypeAnnotation m High))
-> SizedList16 (TypeAnnotation m Low)
-> m (SizedList16 (TypeAnnotation m High))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((Index -> m Int)
-> TypeAnnotation m Low -> m (TypeAnnotation m High)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, EvolveM m) =>
(Index -> m Int) -> s Low -> m (s High)
evolveBC Index -> m Int
f) SizedList16 (TypeAnnotation m Low)
a
devolveBC :: (Int -> m Index)
-> RuntimeVisibleTypeAnnotations m High
-> m (RuntimeVisibleTypeAnnotations m Low)
devolveBC Int -> m Index
f (RuntimeVisibleTypeAnnotations SizedList16 (TypeAnnotation m High)
a) =
SizedList16 (TypeAnnotation m Low)
-> RuntimeVisibleTypeAnnotations m Low
forall (m :: * -> *) r.
SizedList16 (TypeAnnotation m r)
-> RuntimeVisibleTypeAnnotations m r
RuntimeVisibleTypeAnnotations (SizedList16 (TypeAnnotation m Low)
-> RuntimeVisibleTypeAnnotations m Low)
-> m (SizedList16 (TypeAnnotation m Low))
-> m (RuntimeVisibleTypeAnnotations m Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (TypeAnnotation m High -> m (TypeAnnotation m Low))
-> SizedList16 (TypeAnnotation m High)
-> m (SizedList16 (TypeAnnotation m Low))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((Int -> m Index)
-> TypeAnnotation m High -> m (TypeAnnotation m Low)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, DevolveM m) =>
(Int -> m Index) -> s High -> m (s Low)
devolveBC Int -> m Index
f) SizedList16 (TypeAnnotation m High)
a
newtype RuntimeVisibleTypeAnnotations m r =
RuntimeVisibleTypeAnnotations
{ RuntimeVisibleTypeAnnotations m r
-> SizedList16 (TypeAnnotation m r)
asListOfVisibleTypeAnnotations
:: SizedList16 (TypeAnnotation m r)
}
instance (Generic (m Low), Binary (m Low)) => IsAttribute (RuntimeInvisibleTypeAnnotations m Low) where
attrName :: Const Text (RuntimeInvisibleTypeAnnotations m Low)
attrName = Text -> Const Text (RuntimeInvisibleTypeAnnotations m Low)
forall k a (b :: k). a -> Const a b
Const Text
"RuntimeInvisibleTypeAnnotations"
instance Staged m => Staged (RuntimeInvisibleTypeAnnotations m) where
stage :: (forall (s' :: * -> *). Staged s' => s' r -> m (s' r'))
-> RuntimeInvisibleTypeAnnotations m r
-> m (RuntimeInvisibleTypeAnnotations m r')
stage forall (s' :: * -> *). Staged s' => s' r -> m (s' r')
f (RuntimeInvisibleTypeAnnotations SizedList16 (TypeAnnotation m r)
a) =
SizedList16 (TypeAnnotation m r')
-> RuntimeInvisibleTypeAnnotations m r'
forall (m :: * -> *) r.
SizedList16 (TypeAnnotation m r)
-> RuntimeInvisibleTypeAnnotations m r
RuntimeInvisibleTypeAnnotations (SizedList16 (TypeAnnotation m r')
-> RuntimeInvisibleTypeAnnotations m r')
-> m (SizedList16 (TypeAnnotation m r'))
-> m (RuntimeInvisibleTypeAnnotations m r')
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (TypeAnnotation m r -> m (TypeAnnotation m r'))
-> SizedList16 (TypeAnnotation m r)
-> m (SizedList16 (TypeAnnotation m r'))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM TypeAnnotation m r -> m (TypeAnnotation m r')
forall (s' :: * -> *). Staged s' => s' r -> m (s' r')
f SizedList16 (TypeAnnotation m r)
a
instance ByteCodeStaged m => ByteCodeStaged (RuntimeInvisibleTypeAnnotations m) where
evolveBC :: (Index -> m Int)
-> RuntimeInvisibleTypeAnnotations m Low
-> m (RuntimeInvisibleTypeAnnotations m High)
evolveBC Index -> m Int
f (RuntimeInvisibleTypeAnnotations SizedList16 (TypeAnnotation m Low)
a) =
SizedList16 (TypeAnnotation m High)
-> RuntimeInvisibleTypeAnnotations m High
forall (m :: * -> *) r.
SizedList16 (TypeAnnotation m r)
-> RuntimeInvisibleTypeAnnotations m r
RuntimeInvisibleTypeAnnotations (SizedList16 (TypeAnnotation m High)
-> RuntimeInvisibleTypeAnnotations m High)
-> m (SizedList16 (TypeAnnotation m High))
-> m (RuntimeInvisibleTypeAnnotations m High)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (TypeAnnotation m Low -> m (TypeAnnotation m High))
-> SizedList16 (TypeAnnotation m Low)
-> m (SizedList16 (TypeAnnotation m High))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((Index -> m Int)
-> TypeAnnotation m Low -> m (TypeAnnotation m High)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, EvolveM m) =>
(Index -> m Int) -> s Low -> m (s High)
evolveBC Index -> m Int
f) SizedList16 (TypeAnnotation m Low)
a
devolveBC :: (Int -> m Index)
-> RuntimeInvisibleTypeAnnotations m High
-> m (RuntimeInvisibleTypeAnnotations m Low)
devolveBC Int -> m Index
f (RuntimeInvisibleTypeAnnotations SizedList16 (TypeAnnotation m High)
a) =
SizedList16 (TypeAnnotation m Low)
-> RuntimeInvisibleTypeAnnotations m Low
forall (m :: * -> *) r.
SizedList16 (TypeAnnotation m r)
-> RuntimeInvisibleTypeAnnotations m r
RuntimeInvisibleTypeAnnotations (SizedList16 (TypeAnnotation m Low)
-> RuntimeInvisibleTypeAnnotations m Low)
-> m (SizedList16 (TypeAnnotation m Low))
-> m (RuntimeInvisibleTypeAnnotations m Low)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (TypeAnnotation m High -> m (TypeAnnotation m Low))
-> SizedList16 (TypeAnnotation m High)
-> m (SizedList16 (TypeAnnotation m Low))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((Int -> m Index)
-> TypeAnnotation m High -> m (TypeAnnotation m Low)
forall (s :: * -> *) (m :: * -> *).
(ByteCodeStaged s, DevolveM m) =>
(Int -> m Index) -> s High -> m (s Low)
devolveBC Int -> m Index
f) SizedList16 (TypeAnnotation m High)
a
newtype RuntimeInvisibleTypeAnnotations m r =
RuntimeInvisibleTypeAnnotations
{ RuntimeInvisibleTypeAnnotations m r
-> SizedList16 (TypeAnnotation m r)
asListOfInvisibleTypeAnnotations
:: SizedList16 (TypeAnnotation m r)
}
deriving instance Show (m High) => Show (RuntimeVisibleTypeAnnotations m High)
deriving instance Eq (m High) => Eq (RuntimeVisibleTypeAnnotations m High)
deriving instance Generic (m High) => Generic (RuntimeVisibleTypeAnnotations m High)
deriving instance (Generic (m High), NFData (m High)) => NFData (RuntimeVisibleTypeAnnotations m High)
deriving instance Show (m Low) => Show (RuntimeVisibleTypeAnnotations m Low)
deriving instance Eq (m Low) => Eq (RuntimeVisibleTypeAnnotations m Low)
deriving instance Ord (m Low) => Ord (RuntimeVisibleTypeAnnotations m Low)
deriving instance Generic (m Low) => Generic (RuntimeVisibleTypeAnnotations m Low)
deriving instance (Generic (m Low), NFData (m Low)) => NFData (RuntimeVisibleTypeAnnotations m Low)
deriving instance (Generic (m Low), Binary (m Low)) => Binary (RuntimeVisibleTypeAnnotations m Low)
deriving instance Show (m High) => Show (RuntimeInvisibleTypeAnnotations m High)
deriving instance Eq (m High) => Eq (RuntimeInvisibleTypeAnnotations m High)
deriving instance Generic (m High) => Generic (RuntimeInvisibleTypeAnnotations m High)
deriving instance (Generic (m High), NFData (m High)) => NFData (RuntimeInvisibleTypeAnnotations m High)
deriving instance Show (m Low) => Show (RuntimeInvisibleTypeAnnotations m Low)
deriving instance Eq (m Low) => Eq (RuntimeInvisibleTypeAnnotations m Low)
deriving instance Ord (m Low) => Ord (RuntimeInvisibleTypeAnnotations m Low)
deriving instance Generic (m Low) => Generic (RuntimeInvisibleTypeAnnotations m Low)
deriving instance (Generic (m Low), NFData (m Low)) => NFData (RuntimeInvisibleTypeAnnotations m Low)
deriving instance (Generic (m Low), Binary (m Low)) => Binary (RuntimeInvisibleTypeAnnotations m Low)
newtype AnnotationDefault r = AnnotationDefault
{ AnnotationDefault r -> ElementValue r
defaultValue :: ElementValue r
}
instance IsAttribute (AnnotationDefault Low) where
attrName :: Const Text (AnnotationDefault Low)
attrName = Text -> Const Text (AnnotationDefault Low)
forall k a (b :: k). a -> Const a b
Const Text
"AnnotationDefault"
instance Staged AnnotationDefault where
stage :: (forall (s' :: * -> *). Staged s' => s' r -> m (s' r'))
-> AnnotationDefault r -> m (AnnotationDefault r')
stage forall (s' :: * -> *). Staged s' => s' r -> m (s' r')
f AnnotationDefault {ElementValue r
defaultValue :: ElementValue r
defaultValue :: forall r. AnnotationDefault r -> ElementValue r
..} = ElementValue r' -> AnnotationDefault r'
forall r. ElementValue r -> AnnotationDefault r
AnnotationDefault (ElementValue r' -> AnnotationDefault r')
-> m (ElementValue r') -> m (AnnotationDefault r')
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (forall (s' :: * -> *). Staged s' => s' r -> m (s' r'))
-> ElementValue r -> m (ElementValue r')
forall (s :: * -> *) (m :: * -> *) r r'.
(Staged s, LabelM m) =>
(forall (s' :: * -> *). Staged s' => s' r -> m (s' r'))
-> s r -> m (s r')
stage forall (s' :: * -> *). Staged s' => s' r -> m (s' r')
f ElementValue r
defaultValue
$(deriveBaseWithBinary ''RuntimeInvisibleAnnotations)
$(deriveBaseWithBinary ''RuntimeVisibleAnnotations)
$(deriveBaseWithBinary ''RuntimeInvisibleParameterAnnotations)
$(deriveBaseWithBinary ''RuntimeVisibleParameterAnnotations)
$(deriveBaseWithBinary ''Annotation)
$(deriveBaseWithBinary ''ValuePair)
$(deriveBaseWithBinary ''AnnotationDefault)
$(deriveBase ''ElementValue)
deriving instance Ord (ValuePair High)
deriving instance Ord (ElementValue High)
deriving instance Ord (EnumValue High)
deriving instance Ord (Annotation High)
$(deriveBase ''ClassTypeAnnotation)
$(deriveBase ''MethodTypeAnnotation)
$(deriveBase ''FieldTypeAnnotation)
$(deriveBase ''CodeTypeAnnotation)
deriving instance Ord (MethodTypeAnnotation High)
deriving instance Ord (ClassTypeAnnotation High)
deriving instance Ord (FieldTypeAnnotation High)
deriving instance Ord (CodeTypeAnnotation High)
deriving instance Ord (a High) => Ord (TypeAnnotation a High)
$(deriveBaseWithBinary ''LocalvarEntry)
$(deriveBaseWithBinary ''TypeArgumentTarget)
deriving instance Ord (LocalvarEntry High)
deriving instance Ord (TypeArgumentTarget High)
$(deriveBaseWithBinary ''EnumValue)