# HG changeset patch # User Claus Gittinger # Date 1462617197 -7200 # Node ID 5f6b9dbd32c6ca382a1e621245843b47a51cac1c # Parent 8ac31aac9eb61d7f4a864c379a0e061cfd3a4269 #FEATURE by cg class: Method added: #sendsMessageForWhich: diff -r 8ac31aac9eb6 -r 5f6b9dbd32c6 Method.st --- a/Method.st Sat May 07 12:32:29 2016 +0200 +++ b/Method.st Sat May 07 12:33:17 2016 +0200 @@ -3462,6 +3462,29 @@ "Created: / 08-08-2011 / 18:53:24 / cg" ! +sendsMessageForWhich:aCheckBlock + "return true, if this method contains a message-send + for which aCheckBlock returns true, when given the selector." + + self literalsDo:[:each | + each isSymbol ifTrue:[ + "/ first check if the selector matches + (aCheckBlock value:each) ifTrue:[ + "/ then, if this is really a message send + (self messagesSent includes:each) ifTrue:[^ true]. + ] + ] + ]. + ^ false + + " + (self compiledMethodAt:#sendsAnyForWhich:) + sendsAnyForWhich:[:sel | sel startsWith:'message'] + (self compiledMethodAt:#sendsAnyForWhich:) + sendsAnyForWhich:[:sel | sel startsWith:'foo'] + " +! + shadowedMethod "Return the shadowed method if this method is an extension (i.e. package ~= classes' package) AND it shadows (redefines) an existing method from the method's class.