aboutsummaryrefslogtreecommitdiff
path: root/frontend/unitype.icl
diff options
context:
space:
mode:
authorronny2001-10-03 12:56:36 +0000
committerronny2001-10-03 12:56:36 +0000
commit64be2315eec12b9655341da602a2083380510915 (patch)
tree9c449a63aecb4ff6d143078859cd4c0294f50ad8 /frontend/unitype.icl
parentfixed type error by reintroducing uniqueCopy (diff)
replace uniqueCopy with copyCoercions
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@819 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend/unitype.icl')
-rw-r--r--frontend/unitype.icl22
1 files changed, 22 insertions, 0 deletions
diff --git a/frontend/unitype.icl b/frontend/unitype.icl
index 72f239c..ca83155 100644
--- a/frontend/unitype.icl
+++ b/frontend/unitype.icl
@@ -928,3 +928,25 @@ where
= ok_coercions
check_demanded_attribute_vars av_group_nr _ partition (ok, coercions)
= (False, coercions)
+
+copyCoercions :: *Coercions -> (*Coercions, *Coercions)
+copyCoercions coercions=:{coer_demanded, coer_offered}
+ # (coer_demanded_copy, coer_demanded) = copy_coercion_trees coer_demanded
+ # (coer_offered_copy, coer_offered) = copy_coercion_trees coer_offered
+ = ({coercions & coer_demanded = coer_demanded, coer_offered = coer_offered}, {coercions & coer_demanded = coer_demanded_copy, coer_offered = coer_offered_copy})
+where
+ copy_coercion_trees trees
+ = arrayAndElementsCopy CT_Empty copy_coercion_tree trees
+
+ copy_coercion_tree (CT_Node attr left right)
+ # (copy_left, left) = copy_coercion_tree left
+ # (copy_right, right) = copy_coercion_tree right
+ = (CT_Node attr copy_left copy_right, CT_Node attr left right)
+ copy_coercion_tree tree=:CT_Empty
+ = (CT_Empty, tree)
+ copy_coercion_tree tree=:CT_Unique
+ = (CT_Unique, tree)
+ copy_coercion_tree tree=:CT_NonUnique
+ = (CT_NonUnique, tree)
+ copy_coercion_tree tree=:CT_Existential
+ = (CT_Existential, tree)