IRConstant.st
changeset 1 0dd36941955f
child 10 0fd549e0c784
equal deleted inserted replaced
0:de981640a2ec 1:0dd36941955f
       
     1 "{ Package: 'stx:goodies/newcompiler' }"
       
     2 
       
     3 IRInstruction subclass:#IRConstant
       
     4 	instanceVariableNames:'constant type'
       
     5 	classVariableNames:''
       
     6 	poolDictionaries:''
       
     7 	category:'NewCompiler-IR'
       
     8 !
       
     9 
       
    10 IRConstant comment:'Instruction "pushLiteral: object"'
       
    11 !
       
    12 
       
    13 
       
    14 !IRConstant methodsFor:'accessing'!
       
    15 
       
    16 constant
       
    17 
       
    18 	^ constant
       
    19 !
       
    20 
       
    21 constant: object
       
    22 
       
    23 	constant _ object
       
    24 !
       
    25 
       
    26 type
       
    27 	"type is nil, #block, or #blockMethod"
       
    28 
       
    29 	^ type
       
    30 !
       
    31 
       
    32 type: symbol
       
    33 	"symbol is nil, #block, or #blockMethod"
       
    34 
       
    35 	type _ symbol
       
    36 ! !
       
    37 
       
    38 !IRConstant methodsFor:'interpret'!
       
    39 
       
    40 executeOn: interpreter
       
    41 
       
    42     type == nil ifTrue:[^interpreter pushLiteral: constant].
       
    43     type == #block ifTrue:[^interpreter pushBlock: constant].
       
    44     type == #blockMethod ifTrue:[^interpreter pushBlockMethod: constant].
       
    45     self shouldNeverBeReached.
       
    46 
       
    47     "Modified: / 11-06-2008 / 01:03:20 / Jan Vrany <vranyj1@fel.cvut.cz>"
       
    48 ! !
       
    49 
       
    50 !IRConstant methodsFor:'testing'!
       
    51 
       
    52 isConstant
       
    53 
       
    54 	^ true
       
    55 !
       
    56 
       
    57 isConstant: valueTest
       
    58 
       
    59 	^ valueTest value: constant
       
    60 ! !
       
    61 
       
    62 !IRConstant class methodsFor:'documentation'!
       
    63 
       
    64 version
       
    65     ^'$Id$'
       
    66 ! !