[Newcompiler] about RBMethodNode >> #primitiveNode:

stéphane ducasse ducasse at iam.unibe.ch
Mon Oct 2 12:24:27 UTC 2006


Yeap far better

On 2 oct. 06, at 10:45, Philippe Marschall wrote:

> Hi
>
> I just stumbeled on this, I think
>
> primitiveNode: aPrimitiveNode
>
>       (primitiveNode isNil
>               or: [ primitiveNode num = 0 ]
>               or: [ primitiveNode num = aPrimitiveNode num ])
>                       ifTrue: [ primitiveNode := aPrimitiveNode ]
>                       ifFalse: [ self notify: 'Ambigous primitives' ]
>
> makes more sense and is easier to read and understand than the  
> existing
>
> primitiveNode: aPrimitiveNode
>
>       primitiveNode ifNil:[primitiveNode := aPrimitiveNode]
>                                 ifNotNil:[(primitiveNode num = 0)
> ifTrue:[primitiveNode := aPrimitiveNode]
>
>                           ifFalse:[(aPrimitiveNode num = 0)
> ifFalse:[self notify:
> 'Ambigous primitives']]].
>
> Also it checks if the numbers are the same.
>
> Philippe



More information about the Newcompiler mailing list