Mate.hs now uses lately introduced Utilities lookupMethod
[mate.git] / Utilities.hs
1 module Utilities where
2
3 import qualified Data.ByteString.Lazy as B
4
5 import qualified JVM.Assembler as J
6 import JVM.Assembler hiding (Instruction)
7 import JVM.Common
8 import JVM.ClassFile
9
10
11 -- TODO: actually this function already exists in hs-java-0.3!
12 lookupMethod :: B.ByteString -> Class Resolved -> Maybe (Method Resolved)
13 lookupMethod name cls = look (classMethods cls)
14   where
15     look [] = Nothing
16     look (f:fs)
17       | methodName f == name = Just f
18       | otherwise  = look fs