compiler/TUnionType.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 25 Aug 2015 19:05:18 +0100
changeset 2 2a3e47c13905
parent 1 18b4a3b98e96
child 3 97ee341d3e9f
permissions -rw-r--r--
Removed classes meant for hosting Tea within Smalltalk/X. Hosting support will be re-added later.

"{ Package: 'jv:tea/compiler' }"

"{ NameSpace: Smalltalk }"

TType subclass:#TUnionType
	instanceVariableNames:'types'
	classVariableNames:''
	poolDictionaries:''
	category:'Languages-Tea-Compiler-Types'
!

!TUnionType class methodsFor:'instance creation'!

with: type1 with: type2
    ^ self new initializeWith: type1 and: type2

    "Created: / 21-08-2015 / 18:38:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!TUnionType methodsFor:'accessing'!

types
    ^ types
! !

!TUnionType methodsFor:'initialization'!

initializeWith: type1 with: type2
    type1 isUnionType 
        ifTrue: [ types := type1 types copy  ]
        ifFalse:[ types := Array with: type1 ].
    type2 isUnionType 
        ifTrue: [ types := types , type2 types ]
        ifFalse:[ types := types copyWith: type2 ].

    "Created: / 21-08-2015 / 18:39:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!TUnionType methodsFor:'testing'!

isUnionType
    ^ true
! !