methodlookup: unique identifier for methods are name+signature
[mate.git] / Mate / Utilities.hs
index c76d68043c94877ef187389e80929ac175bb2a46..0fd5ddd74ca9f33c5c313c67c102f03e2c9a077c 100644 (file)
@@ -53,3 +53,11 @@ methodHaveReturnValue cls idx = case ret of
     (CIfaceMethod _ nt') -> nt'
     _ -> error "methodHaveReturnValue: something wrong. abort."
   (MethodSignature _ ret) = ntSignature nt
+
+lookupMethodSig :: B.ByteString -> MethodSignature -> Class Direct -> Maybe (Method Direct)
+lookupMethodSig name sig cls = look (classMethods cls)
+  where
+  look [] = Nothing
+  look (f:fs)
+    | methodName f == name && methodSignature f == sig = Just f
+    | otherwise = look fs