Method.st
changeset 5582 737d121ae7de
parent 5564 0f513f04c50f
child 5584 b175797a8c4d
equal deleted inserted replaced
5581:7bef1c75fb06 5582:737d121ae7de
  2068     ^ self containingClass
  2068     ^ self containingClass
  2069 
  2069 
  2070     "Created: 19.6.1997 / 16:26:13 / cg"
  2070     "Created: 19.6.1997 / 16:26:13 / cg"
  2071 !
  2071 !
  2072 
  2072 
       
  2073 messagesSent
       
  2074     "return a collection with the message selectors sent to by the receiver.
       
  2075      Uses Parser to parse methods source and extract the names.
       
  2076      The returned collection includes all used message selectors (i.e. including super-send messages)"
       
  2077 
       
  2078     ^ self parse:#'parseMethodSilent:' return:#messagesSent or:#() 
       
  2079 
       
  2080     "
       
  2081      (Method compiledMethodAt:#printOn:) messagesSent
       
  2082     "
       
  2083 !
       
  2084 
       
  2085 messagesSentToSelf
       
  2086     "return a collection with the message selectors sent to self by the receiver.
       
  2087      Uses Parser to parse methods source and extract the names."
       
  2088 
       
  2089     ^ self parse:#'parseMethodSilent:' return:#messagesSentToSelf or:#() 
       
  2090 !
       
  2091 
       
  2092 messagesSentToSuper
       
  2093     "return a collection with the message selectors sent to super by the receiver.
       
  2094      Uses Parser to parse methods source and extract the names."
       
  2095 
       
  2096     ^ self parse:#'parseMethodSilent:' return:#messagesSentToSuper or:#() 
       
  2097 !
       
  2098 
  2073 methodArgAndVarNames
  2099 methodArgAndVarNames
  2074     "return a collection with the methods argument and variable names.
  2100     "return a collection with the methods argument and variable names.
  2075      Uses Parser to parse methods source and extract the names.
  2101      Uses Parser to parse methods source and extract the names.
  2076      Returns nil if the source is not available, or some other
  2102      Returns nil if the source is not available, or some other
  2077      syntax/parse error occurred. For methods with no args and no vars,
  2103      syntax/parse error occurred. For methods with no args and no vars,
  2326 sends:aSelectorSymbol
  2352 sends:aSelectorSymbol
  2327     "return true, if this method contains a message-send
  2353     "return true, if this method contains a message-send
  2328      with aSelectorSymbol as selector."
  2354      with aSelectorSymbol as selector."
  2329 
  2355 
  2330     (self referencesLiteral:aSelectorSymbol) ifTrue:[
  2356     (self referencesLiteral:aSelectorSymbol) ifTrue:[
  2331         ^ self sentMessages includesIdentical:aSelectorSymbol
  2357         ^ self messagesSent includesIdentical:aSelectorSymbol
  2332     ].
  2358     ].
  2333     ^ false
  2359     ^ false
  2334 !
       
  2335 
       
  2336 sentMessages
       
  2337     "return a collection with the message selectors sent to by the receiver.
       
  2338      Uses Parser to parse methods source and extract the names.
       
  2339      The returned collection includes all used message selectors (i.e. including super-send messages)"
       
  2340 
       
  2341     ^ self parse:#'parseMethodSilent:' return:#sentMessages or:#() 
       
  2342 
       
  2343     "
       
  2344      (Method compiledMethodAt:#printOn:) sentMessages
       
  2345     "
       
  2346 !
       
  2347 
       
  2348 sentSuperMessages
       
  2349     "return a collection with the message selectors sent to super by the receiver.
       
  2350      Uses Parser to parse methods source and extract the names."
       
  2351 
       
  2352     ^ self parse:#'parseMethodSilent:' return:#sentSuperMessages or:#() 
       
  2353 
       
  2354 
       
  2355 !
  2360 !
  2356 
  2361 
  2357 usedGlobals
  2362 usedGlobals
  2358     "return a collection with the global names referred to by the receiver.
  2363     "return a collection with the global names referred to by the receiver.
  2359      Uses Parser to parse methods source and extract them."
  2364      Uses Parser to parse methods source and extract them."
  2744 ! !
  2749 ! !
  2745 
  2750 
  2746 !Method class methodsFor:'documentation'!
  2751 !Method class methodsFor:'documentation'!
  2747 
  2752 
  2748 version
  2753 version
  2749     ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.204 2000-08-27 14:48:50 cg Exp $'
  2754     ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.205 2000-09-03 15:14:56 cg Exp $'
  2750 ! !
  2755 ! !
  2751 Method initialize!
  2756 Method initialize!