aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsjakie2000-05-11 07:41:52 +0000
committersjakie2000-05-11 07:41:52 +0000
commit216793c16fc52cd7fb00c3eae7615cb3d4e79179 (patch)
tree97c8c23e3101d4406915d7ede6e26c34b5b961e5
parentfixed basic types in dynamics and (diff)
bug fix in macros
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@136 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
-rw-r--r--frontend/transform.icl21
1 files changed, 18 insertions, 3 deletions
diff --git a/frontend/transform.icl b/frontend/transform.icl
index 606e9a3..cd48ae0 100644
--- a/frontend/transform.icl
+++ b/frontend/transform.icl
@@ -568,8 +568,8 @@ where
| macro_def.fun_kind == FK_Macro
= case macro_def.fun_body of
CheckedBody body
- # macros_modules_pi = foldSt (visit_macro mod_index max_fun_nr) macro_def.fun_info.fi_calls (
- { macro_defs & [macro_index] = { macro_def & fun_body = PartioningMacro }}, modules, pi)
+ # macros_modules_pi = foldSt (visit_macro mod_index max_fun_nr) macro_def.fun_info.fi_calls
+ ({ macro_defs & [macro_index] = { macro_def & fun_body = PartioningMacro }}, modules, pi)
-> expand_simple_macro mod_index macro_index macro_def macros_modules_pi
PartioningMacro
# identPos = newPosition macro_def.fun_symb macro_def.fun_pos
@@ -639,6 +639,7 @@ where
-> (fun_number, (fun_defs, modules, pi))
TransformedBody _
| fun_def.fun_info.fi_group_index == NoIndex
+ # (fun_defs, pi) = add_called_macros fun_def.fun_info.fi_calls (fun_defs, pi)
-> (max_fun_nr, ({ fun_defs & [fun_index] = {fun_def & fun_info.fi_group_index = pi.pi_next_group }}, modules,
{pi & pi_next_group = inc pi.pi_next_group, pi_groups = [ [fun_index] : pi.pi_groups]}))
-> (max_fun_nr, (fun_defs, modules, pi))
@@ -690,7 +691,21 @@ where
fun_def = { fun_def & fun_body = TransformedBody { tb_args = tb_args, tb_rhs = tb_rhs},
fun_info = { fun_info & fi_calls = fi_calls, fi_local_vars = fi_local_vars }}
= ({ fun_and_macro_defs & [fun_index] = fun_def }, modules, es)
-// ---> ("expand_macros", fun_symb, tb_args, tb_rhs)
+
+ add_called_macros calls macro_defs_and_pi
+ = foldSt add_called_macro calls macro_defs_and_pi
+ where
+ add_called_macro {fc_index} (macro_defs, pi)
+ # (macro_def, macro_defs) = macro_defs![fc_index]
+ = case macro_def.fun_body of
+ TransformedBody _
+ | macro_def.fun_info.fi_group_index == NoIndex
+ # (macro_defs, pi) = add_called_macros macro_def.fun_info.fi_calls (macro_defs, pi)
+ -> ({ macro_defs & [fc_index] = {macro_def & fun_info.fi_group_index = pi.pi_next_group }},
+ {pi & pi_next_group = inc pi.pi_next_group, pi_groups = [ [fc_index] : pi.pi_groups]})
+ -> (macro_defs, pi)
+
+
addFunctionCallsToSymbolTable calls fun_defs symbol_table
= foldSt add_function_call_to_symbol_table calls ([], fun_defs, symbol_table)