aboutsummaryrefslogtreecommitdiff
path: root/frontend/partition.icl
diff options
context:
space:
mode:
authorjohnvg2012-08-16 09:18:54 +0000
committerjohnvg2012-08-16 09:18:54 +0000
commitdee7082b27bf1498706afc8c80e1e41267f60262 (patch)
tree51d4cf13b91bff82cf5941ecc03d02c9ef2025a8 /frontend/partition.icl
parentfix coercibility check of instance of classes with a . before a (constructor)... (diff)
optimize function get_mark
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@2154 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend/partition.icl')
-rw-r--r--frontend/partition.icl16
1 files changed, 10 insertions, 6 deletions
diff --git a/frontend/partition.icl b/frontend/partition.icl
index f10ccc3..74bada3 100644
--- a/frontend/partition.icl
+++ b/frontend/partition.icl
@@ -1,6 +1,3 @@
-/*
- module owner: Diederik van Arkel
-*/
implementation module partition
import syntax, transform, utilities
@@ -224,9 +221,16 @@ component_members_to_list NoComponentMembers
get_mark max_fun_nr marks fun
// :== marks.[fun]
- :== case [m_mark \\ {m_fun,m_mark} <-: marks | m_fun == fun] of
- [] -> max_fun_nr
- [m:_] -> m
+ :== get_mark 0 marks fun max_fun_nr
+where
+ get_mark :: !Int !{#Mark} !Int !Int -> Int
+ get_mark i marks fun max_fun_nr
+ | i<size marks
+ | marks.[i].m_fun<>fun
+ = get_mark (i+1) marks fun max_fun_nr
+ = marks.[i].m_mark
+ = max_fun_nr
+
set_mark marks fun val
// :== { marks & [fun] = val}
// :== { if (m_fun==fun) {m & m_mark = val} m \\ m=:{m_fun=m_fun} <-: marks}