From 1ca381fc66c96c124ea66b52a65744c5da41dde6 Mon Sep 17 00:00:00 2001 From: diederik Date: Thu, 1 Aug 2002 12:49:54 +0000 Subject: fix curried constructor applications git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@1184 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d --- frontend/trans.icl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'frontend') diff --git a/frontend/trans.icl b/frontend/trans.icl index c2fa7bb..8f551e7 100644 --- a/frontend/trans.icl +++ b/frontend/trans.icl @@ -2381,6 +2381,22 @@ transformApplication app=:{app_symb={symb_name,symb_kind = SK_GeneratedFunction = transformFunctionApplication gf_fun_def gf_instance_info gf_cons_args app extra_args ro { ti & ti_fun_heap = ti_fun_heap } transformApplication app [] ro ti = (App app, ti) +transformApplication app=:{app_symb={symb_name,symb_kind = SK_Constructor cons_index},app_args} extra_args + ro ti=:{ti_cons_args,ti_instances,ti_fun_defs,ti_fun_heap} + # {cons_type} = ro.ro_common_defs.[cons_index.glob_module].com_cons_defs.[cons_index.glob_object] + # (app_args,extra_args) = complete_application cons_type.st_arity app_args extra_args + = (build_application { app & app_args = app_args } extra_args, ti) +where + complete_application form_arity args [] + = (args, []) + complete_application form_arity args extra_args + # arity_diff = min (form_arity - length args) (length extra_args) + = (args ++ take arity_diff extra_args, drop arity_diff extra_args) + + build_application app [] + = App app + build_application app extra_args + = App app @ extra_args transformApplication app extra_args ro ti = (App app @ extra_args, ti) -- cgit v1.2.3