aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiederik2002-10-10 09:06:22 +0000
committerdiederik2002-10-10 09:06:22 +0000
commitd226aec0723da4f5257a6a0ab2e05b39efa18a59 (patch)
treee8a6e4c0f740fcd32e1fd9baf4d9b01af1ee6ad9
parentpossiblyFoldOuterCase (diff)
transform record selections
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@1227 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
-rw-r--r--frontend/trans.icl21
1 files changed, 21 insertions, 0 deletions
diff --git a/frontend/trans.icl b/frontend/trans.icl
index 1b05621..0b4dfda 100644
--- a/frontend/trans.icl
+++ b/frontend/trans.icl
@@ -2483,6 +2483,27 @@ where
= cnf_args app_args 0 cons_type.st_args_strictness ro
cnf_app_args {app_symb=symb=:{symb_kind}, app_args} ro
= False
+transformSelection NormalSelector s=:[RecordSelection _ field_index : selectors]
+ app=:(App appi=:{app_symb=app_symb=:{symb_kind}, app_args, app_info_ptr})
+ ro ti
+ | isOKSymbol symb_kind && isEmpty app_args
+ # (fun_def,ti_fun_defs,ti_fun_heap) = get_fun_def symb_kind ro.ro_main_dcl_module_n ti.ti_fun_defs ti.ti_fun_heap
+ # ti = {ti & ti_fun_defs = ti_fun_defs, ti_fun_heap = ti_fun_heap}
+ # {fun_body,fun_type,fun_kind} = fun_def
+ | is_not_caf fun_kind
+ = case fun_body of
+ TransformedBody {tb_rhs} -> case tb_rhs of
+ App app -> transformSelection NormalSelector s tb_rhs ro ti
+ _ -> (Selection NormalSelector app s, ti)
+ = (Selection NormalSelector app s, ti)
+where
+ isOKSymbol (SK_Function {glob_module}) = glob_module == ro.ro_main_dcl_module_n
+ isOKSymbol (SK_LocalMacroFunction _) = True
+ isOKSymbol (SK_GeneratedFunction _ _) = True
+ isOKSymbol _ = False
+
+ is_not_caf FK_Caf = False
+ is_not_caf _ = True
transformSelection NormalSelector [] expr ro ti
= (expr, ti)
transformSelection selector_kind selectors expr ro ti