IRSend.st
changeset 5 b94aea1d3710
parent 1 0dd36941955f
child 23 377bc46cad12
equal deleted inserted replaced
4:7195866510e1 5:b94aea1d3710
     1 "{ Package: 'stx:goodies/newcompiler' }"
     1 "{ Package: 'stx:goodies/newcompiler' }"
     2 
     2 
     3 IRInstruction subclass:#IRSend
     3 IRInstruction subclass:#IRSend
     4 	instanceVariableNames:'selector superOf'
     4 	instanceVariableNames:'selector numArgs superOf'
     5 	classVariableNames:''
     5 	classVariableNames:''
     6 	poolDictionaries:''
     6 	poolDictionaries:''
     7 	category:'NewCompiler-IR'
     7 	category:'NewCompiler-IR'
     8 !
     8 !
     9 
     9 
    10 IRSend comment:'Instruction "send: selector" or "send: selector toSuperOf: behavior"'
    10 IRSend comment:'Instruction "send: selector" or "send: selector toSuperOf: behavior"'
    11 !
    11 !
    12 
    12 
    13 
    13 
    14 !IRSend methodsFor:'accessing'!
    14 !IRSend methodsFor:'accessing'!
       
    15 
       
    16 numArgs
       
    17     ^ numArgs
       
    18 
       
    19     "Created: / 01-12-2008 / 19:33:49 / Jan Vrany <vranyj1@fel.cvut.cz>"
       
    20 !
       
    21 
       
    22 numArgs:anInteger
       
    23     numArgs := anInteger.
       
    24 
       
    25     "Created: / 01-12-2008 / 19:33:49 / Jan Vrany <vranyj1@fel.cvut.cz>"
       
    26 !
    15 
    27 
    16 selector
    28 selector
    17 	^selector
    29 	^selector
    18 !
    30 !
    19 
    31 
    38 
    50 
    39 !IRSend methodsFor:'interpret'!
    51 !IRSend methodsFor:'interpret'!
    40 
    52 
    41 executeOn: interpreter
    53 executeOn: interpreter
    42 
    54 
    43 	^ superOf
    55     numArgs ifNil:[numArgs := selector numArgs].
    44 		ifNil: [interpreter send: selector]
    56 
    45 		ifNotNil: [interpreter send: selector toSuperOf: superOf]
    57     ^ superOf
       
    58         ifNil: [interpreter send: selector numArgs: numArgs]
       
    59         ifNotNil: [interpreter send: selector numArgs: numArgs toSuperOf: superOf ]
       
    60 
       
    61     "Modified: / 01-12-2008 / 19:39:51 / Jan Vrany <vranyj1@fel.cvut.cz>"
    46 ! !
    62 ! !
    47 
    63 
    48 !IRSend methodsFor:'testing'!
    64 !IRSend methodsFor:'testing'!
    49 
    65 
    50 isMessageSend
    66 isMessageSend