--- a/compiler/TUnionType.st Tue Aug 25 19:05:18 2015 +0100
+++ b/compiler/TUnionType.st Wed Aug 26 07:51:18 2015 +0100
@@ -15,6 +15,12 @@
^ self new initializeWith: type1 and: type2
"Created: / 21-08-2015 / 18:38:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+withAll: types
+ ^ self new initializeWithAll: types
+
+ "Created: / 25-08-2015 / 22:51:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!TUnionType methodsFor:'accessing'!
@@ -23,6 +29,18 @@
^ types
! !
+!TUnionType methodsFor:'comparing'!
+
+hash
+ | h |
+
+ h := types size.
+ types do:[:type | h := h bitXor: type hash ].
+ ^ h
+
+ "Created: / 25-08-2015 / 23:35:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!TUnionType methodsFor:'initialization'!
initializeWith: type1 with: type2
@@ -34,6 +52,18 @@
ifFalse:[ types := types copyWith: type2 ].
"Created: / 21-08-2015 / 18:39:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+initializeWithAll: aCollection
+ types := OrderedCollection new: aCollection size.
+ aCollection do:[:type |
+ type isUnionType
+ ifTrue:[ types addAll: type types ]
+ ifFalse:[types add: type ].
+ ].
+ types := types asArray.
+
+ "Created: / 25-08-2015 / 22:50:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!TUnionType methodsFor:'testing'!