Method.st
changeset 5294 f2d689cf7be4
parent 5284 37c436edfa71
child 5322 411b6c0f7250
equal deleted inserted replaced
5293:e329b1ad8fe9 5294:f2d689cf7be4
  2186      Q: should we add a backref from the method to the class 
  2186      Q: should we add a backref from the method to the class 
  2187         and/or add a subclass of Method for unbound ones ?
  2187         and/or add a subclass of Method for unbound ones ?
  2188      Q2: if so, what about the bad guy then, who copies methods around to
  2188      Q2: if so, what about the bad guy then, who copies methods around to
  2189          other classes ?"
  2189          other classes ?"
  2190 
  2190 
  2191     |classes cls sel|
  2191     |classes cls sel fn clsName|
  2192 
  2192 
  2193     "
  2193     "
  2194      very first, look in the class we found something the last time
  2194      speedup kludge: if my sourceFileName is valid,
       
  2195      extract the className from it and try that class first.
       
  2196     "
       
  2197     (fn := self sourceFilename) notNil ifTrue:[
       
  2198         clsName := fn asFilename withoutSuffix name.
       
  2199         clsName := clsName asSymbolIfInterned.
       
  2200         clsName notNil ifTrue:[
       
  2201             cls := Smalltalk at:clsName ifAbsent:nil.
       
  2202             cls notNil ifTrue:[
       
  2203                 sel := cls selectorAtMethod:self.
       
  2204                 sel notNil ifTrue:[
       
  2205                     ^ MethodWhoInfo class:cls selector:sel
       
  2206                 ].
       
  2207 
       
  2208                 cls := cls class.
       
  2209                 sel := cls selectorAtMethod:self.
       
  2210                 sel notNil ifTrue:[
       
  2211                     ^ MethodWhoInfo class:cls selector:sel
       
  2212                 ].
       
  2213             ]
       
  2214         ].
       
  2215     ].
       
  2216 
       
  2217     "
       
  2218      then, look in the class we found something the last time
  2195      this may often give a hit, when asking who repeatingly for
  2219      this may often give a hit, when asking who repeatingly for
  2196      a context chain. (keep last by its name, to not keep classes from
  2220      a context chain. (keep last by its name, to not keep classes from
  2197      being garbage collected)
  2221      being garbage collected)
  2198     "
  2222     "
  2199     LastWhoClass notNil ifTrue:[
  2223     LastWhoClass notNil ifTrue:[
  2482 ! !
  2506 ! !
  2483 
  2507 
  2484 !Method class methodsFor:'documentation'!
  2508 !Method class methodsFor:'documentation'!
  2485 
  2509 
  2486 version
  2510 version
  2487     ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.184 2000-02-29 18:09:04 cg Exp $'
  2511     ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.185 2000-03-10 18:12:34 cg Exp $'
  2488 ! !
  2512 ! !
  2489 Method initialize!
  2513 Method initialize!