Why can't I do (aNonSmallInteger becomeFoward: aSmallInteger)?
tim at sumeru.stanford.edu
Tue Apr 2 05:28:51 UTC 2002
Tim Rowledge wrote:
> That would be kind of nice. I wonder if we could persuade the
> 'implementors of' code to add the appropriate method to the menu?
Well the basic part is simple enough; some extra is needed to compensate
for the name munging used in TestInterpreterPlugin and its subclasses.
-------------- next part --------------
'From Squeak3.2gamma of 24 January 2002 [latest update: #4743] on 1 April 2002 at 9:25:13 pm'!
"Change Set: namedprimfinder
Date: 1 April 2002
Author: tim at sumeru.stanford.edu
Extremely quick hack to add the name of a primitive called by a method to the list used by implementors and senders.
It doesn't attempt to deal with FFI calls, nor does it work well with primitives defined in subclasses of TestInterpreterPlugin - their names are munged in such a way as to confuse things. I expect somebody can work out a way around this. Still, it does work for 'ordinary' prims, which is a start"!
!CompiledMethod methodsFor: 'scanning' stamp: 'tpr 4/1/2002 21:16'!
"Answer a Set of all the message selectors sent by this method."
| scanner aSet prim |
aSet _ Set new.
scanner _ InstructionStream on: self.
scanFor: [:x |
scanner addSelectorTo: aSet.
prim _ self primitive.
(prim > 0
and: [(prim between: 255 and: 519) not])
ifTrue: [prim = 117
ifTrue: [aSet add: (self literalAt: 1) second]
ifFalse: [aSet add: (Interpreter primitiveTable at: prim + 1)]].
^ aSet! !
More information about the Squeak-dev