[Newcompiler] about RBMethodNode >> #primitiveNode:

Philippe Marschall philippe.marschall at gmail.com
Mon Oct 2 08:45:28 UTC 2006


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