IRConstant.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 30 Mar 2009 17:49:01 +0000
changeset 10 0fd549e0c784
parent 1 0dd36941955f
child 23 377bc46cad12
permissions -rw-r--r--
First simple block works. See IRBuilderTest>>testBlock_blockTempArg. More tests are comming.

"{ Package: 'stx:goodies/newcompiler' }"

IRInstruction subclass:#IRConstant
	instanceVariableNames:'constant type'
	classVariableNames:''
	poolDictionaries:''
	category:'NewCompiler-IR'
!

IRConstant comment:'Instruction "pushLiteral: object"'
!


!IRConstant methodsFor:'accessing'!

constant

	^ constant
!

constant: object

	constant _ object
!

type
	"type is nil, #block, or #blockMethod"

	^ type
!

type: symbol
	"symbol is nil, #block, or #blockMethod"

	type _ symbol
! !

!IRConstant methodsFor:'interpret'!

executeOn: interpreter

    type == nil ifTrue:[^interpreter pushLiteral: constant].
    type == #block ifTrue:[^interpreter pushBlock: constant].
    self shouldNeverBeReached.

    "Modified: / 30-03-2009 / 16:50:28 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!IRConstant methodsFor:'testing'!

isConstant

	^ true
!

isConstant: valueTest

	^ valueTest value: constant
! !

!IRConstant class methodsFor:'documentation'!

version
    ^'$Id$'
! !