[squeak-dev] Contexts must only be created with newForMethod: ...
Mariano Martinez Peck
marianopeck at gmail.com
Mon Aug 1 18:34:12 UTC 2011
Hi Chris. Yes, I have this problem when materializing MethodContext
instances in Fuel.
I've solved it adding the method:
ContextPart class >> newFromFrameSize: aFrameSize
^ super basicNew: aFrameSize
but it is a hack.
So yes, if there is no real reason to do the opposite, I would change
#basicNew:
Cheers
On Mon, Aug 1, 2011 at 8:27 PM, Chris Muller <ma.chris.m at gmail.com> wrote:
> .. but #newForMethod: requires more in the API than it really uses.
> It only checks the methods #frameSize to determine what basicSized
> MethodContext to create - it doesn't actually set its method from the
> one passed in.
>
> newForMethod: aMethod
> --- (comment snipped for brevity) ---
> ^ super basicNew: aMethod frameSize
>
> So, would it be ok to relax MethodContext class>>basicNew: to something
> like:
>
> basicNew: size
> ^ (size = CompiledMethod smallFrameSize or: [ size =
> CompiledMethod fullframeSize ])
> ifTrue: [ super basicNew: size ]
> ifFalse: [ self error: 'Contexts must be ',
> CompiledMethod smallFrameSize, ' or ', CompiledMethod fullframeSize, '
> bytes.' ]
>
>
--
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20110801/c850d69f/attachment.htm
More information about the Squeak-dev
mailing list
|