aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorronny2000-02-14 18:51:34 +0000
committerronny2000-02-14 18:51:34 +0000
commit644f7202f3522dd4f443f30fbe07bdcee6a71994 (patch)
treec2a2801553e38d92571c44aae92ae4c160fe801b /frontend
parentfixed bugs in comprehensions (manifested as type error and abort in check) (diff)
comprehensions: (re)introduced code duplication in transformation to work around a bug in Clean 2.0
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@88 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend')
-rw-r--r--frontend/postparse.icl9
1 files changed, 5 insertions, 4 deletions
diff --git a/frontend/postparse.icl b/frontend/postparse.icl
index 5023ad2..107fb79 100644
--- a/frontend/postparse.icl
+++ b/frontend/postparse.icl
@@ -554,9 +554,9 @@ makeComprehensions [{tq_generators, tq_filter, tq_end, tq_call, tq_lhs_args, tq_
build_rhs :: [TransformedGenerator] ParsedExpr (Optional ParsedExpr) ParsedExpr ParsedExpr -> Rhs
build_rhs [generator : generators] success optional_filter failure end
= case_with_default generator.tg_case1 generator.tg_case_end_expr generator.tg_case_end_pattern
- (foldr (case_end /* end */)
+ (foldr (case_end end)
(case_with_default generator.tg_case2 generator.tg_element generator.tg_pattern
- (foldr (case_pattern /* failure */) rhs generators) failure)
+ (foldr (case_pattern failure) rhs generators) failure)
generators)
end
where
@@ -569,6 +569,7 @@ makeComprehensions [{tq_generators, tq_filter, tq_end, tq_call, tq_lhs_args, tq_
No
-> exprToRhs success
+ /* +++ remove code duplication (bug in 2.0 with nested cases)
case_end :: TransformedGenerator Rhs -> Rhs
case_end {tg_case1, tg_case_end_expr, tg_case_end_pattern} rhs
= single_case tg_case1 tg_case_end_expr tg_case_end_pattern rhs
@@ -576,7 +577,8 @@ makeComprehensions [{tq_generators, tq_filter, tq_end, tq_call, tq_lhs_args, tq_
case_pattern :: TransformedGenerator Rhs -> Rhs
case_pattern {tg_case2, tg_element, tg_pattern} rhs
= single_case tg_case2 tg_element tg_pattern rhs
- /* +++ this introduces code duplication (bug in 2.0 with nested cases)
+ */
+
case_end :: ParsedExpr TransformedGenerator Rhs -> Rhs
case_end end {tg_case1, tg_case_end_expr, tg_case_end_pattern} rhs
= case_with_default tg_case1 tg_case_end_expr tg_case_end_pattern rhs end
@@ -584,7 +586,6 @@ makeComprehensions [{tq_generators, tq_filter, tq_end, tq_call, tq_lhs_args, tq_
case_pattern :: ParsedExpr TransformedGenerator Rhs -> Rhs
case_pattern failure {tg_case2, tg_element, tg_pattern} rhs
= case_with_default tg_case2 tg_element tg_pattern rhs failure
- */
single_case :: Ident ParsedExpr ParsedExpr Rhs -> Rhs
single_case case_ident expr pattern rhs