added:
authorClaus Gittinger <cg@exept.de>
Fri, 19 Oct 2012 17:00:02 +0200
changeset 14402 b56f22e69448
parent 14401 bdfdcb8d0386
child 14403 2a32b03602d4
added: #messagesPossiblySent #possiblySends:
Method.st
--- a/Method.st	Fri Oct 19 14:03:06 2012 +0200
+++ b/Method.st	Fri Oct 19 17:00:02 2012 +0200
@@ -2684,6 +2684,19 @@
     ^ self messagesSent do:aBlock
 !
 
+messagesPossiblySent
+    "return a collection with the message selectors possibly sent to by the receiver.
+     Uses Parser to parse methods source and extract the names.
+     The returned collection includes perform-like and possibly performed messages"
+
+    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesPossiblySent or:#()
+
+    "
+     (Method compiledMethodAt:#printOn:) messagesSent
+     (Point compiledMethodAt:#x:) messagesSent
+    "
+!
+
 messagesSent
     "return a collection with the message selectors sent to by the receiver.
      Uses Parser to parse methods source and extract the names.
@@ -2985,6 +2998,16 @@
     ^ parser primitiveResources.
 !
 
+possiblySends:aSelectorSymbol
+    "return true, if this method contains an indirect message-send
+     (such as perform) with aSelectorSymbol as selector."
+
+    (self referencesLiteral:aSelectorSymbol) ifTrue:[
+        ^ self messagesPossiblySent includesIdentical:aSelectorSymbol
+    ].
+    ^ false
+!
+
 previousVersion
     "return the receivers previous version's source code"
 
@@ -3721,11 +3744,11 @@
 !Method class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.396 2012-10-02 15:20:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.397 2012-10-19 15:00:02 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.396 2012-10-02 15:20:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.397 2012-10-19 15:00:02 cg Exp $'
 !
 
 version_SVN