{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StandaloneDeriving #-}
module Language.JVM.Attribute.MethodParameters
( MethodParameters(..)
, MethodParameter(..)
)
where
import qualified Data.Text as Text
import Language.JVM.Constant
import Language.JVM.Attribute.Base
import Language.JVM.Staged
import Language.JVM.Utils
import Language.JVM.AccessFlag
instance IsAttribute (MethodParameters Low) where
attrName = Const "MethodParameters"
newtype MethodParameters r = MethodParameters
{ methodParameters :: SizedList8 (MethodParameter r)
}
data MethodParameter r = MethodParameter
{ parameterName :: !(Ref Text.Text r)
, parameterAccessFlags :: !(BitSet16 PAccessFlag)
}
instance Staged MethodParameters where
stage f (MethodParameters m) =
label "BootstrapMethods" $ MethodParameters <$> mapM f m
instance Staged MethodParameter where
evolve (MethodParameter a m) = MethodParameter <$> link a <*> pure m
devolve (MethodParameter a m) = MethodParameter <$> unlink a <*> pure m
$(deriveBaseWithBinary ''MethodParameter)
$(deriveBaseWithBinary ''MethodParameters)