Commit f1b5100f authored by Sjaak Smetsers's avatar Sjaak Smetsers
Browse files

minor bug fix, some code polishing

parent 99c3e87f
......@@ -718,8 +718,9 @@ checkPatternConstructor mod_index is_expr_list {ste_index, ste_kind} cons_symb o
where
determine_pattern_symbol mod_index id_index STE_Constructor id_name cons_defs modules error
#! cons_def = cons_defs.[id_index]
# {cons_type={st_arity},cons_priority, cons_type_index} = cons_def
# {cons_symb, cons_type={st_arity},cons_priority, cons_type_index} = cons_def
= (id_index, mod_index, st_arity, cons_priority, cons_type_index, cons_defs, modules, error)
// ---> ("determine_pattern_symbol", id_name, cons_symb)
determine_pattern_symbol mod_index id_index (STE_Imported STE_Constructor import_mod_index) id_name cons_defs modules error
#! {dcl_common,dcl_conversions} = modules.[import_mod_index]
#! cons_def = dcl_common.com_cons_defs.[id_index]
......@@ -2226,11 +2227,11 @@ combineDclAndIclModule _ modules icl_decl_symbols icl_definitions icl_sizes cs
= ( { modules & [cIclModIndex] = { dcl_mod & dcl_conversions = Yes conversion_table }}
, icl_decl_symbols
, { icl_definitions
& def_types = rev_append icl_definitions.def_types new_type_defs
, def_constructors = rev_append icl_definitions.def_constructors new_cons_defs
, def_selectors = rev_append icl_definitions.def_selectors new_selector_defs
, def_classes = rev_append icl_definitions.def_classes new_class_defs
, def_members = rev_append icl_definitions.def_members new_member_defs
& def_types = my_append icl_definitions.def_types new_type_defs
, def_constructors = my_append icl_definitions.def_constructors new_cons_defs
, def_selectors = my_append icl_definitions.def_selectors new_selector_defs
, def_classes = my_append icl_definitions.def_classes new_class_defs
, def_members = my_append icl_definitions.def_members new_member_defs
}
, icl_sizes
, { cs & cs_symbol_table = cs_symbol_table }
......@@ -2336,10 +2337,10 @@ where
(new_type_defs, new_class_defs, new_cons_defs, new_selector_defs, new_member_defs, cs)
= (new_type_defs, new_class_defs, new_cons_defs, new_selector_defs, new_member_defs, cs)
rev_append front []
my_append front []
= front
rev_append front back
= front ++ reverse back
my_append front back
= front ++ back
(<=<) infixl
(<=<) state fun :== fun state
......
......@@ -901,7 +901,7 @@ liftFunctions min_level group group_index fun_defs var_heap expr_heap
# (contains_free_vars, lifted_function_called, fun_defs)
= foldSt (add_free_vars_of_non_recursive_calls_to_function group_index) group (False, False, fun_defs)
| contains_free_vars
# fun_defs = iterateSt (foldSt (add_free_vars_of_recursive_calls_to_function group_index) group) fun_defs
# fun_defs = iterateSt (add_free_vars_of_recursive_calls_to_functions group_index group) fun_defs
= lift_functions group fun_defs var_heap expr_heap
| lifted_function_called
= lift_functions group fun_defs var_heap expr_heap
......@@ -925,6 +925,9 @@ where
# (free_vars_added, free_vars) = add_free_variables fun_def_level fi_free_vars (False, free_vars)
= (True, free_vars, fun_defs)
add_free_vars_of_recursive_calls_to_functions group_index group fun_defs
= foldSt (add_free_vars_of_recursive_calls_to_function group_index) group (False, fun_defs)
add_free_vars_of_recursive_calls_to_function group_index fun (free_vars_added, fun_defs)
# (fun_def=:{fun_info}, fun_defs) = fun_defs![fun]
{ fi_free_vars,fi_def_level,fi_calls } = fun_info
......
This diff is collapsed.
......@@ -3,6 +3,7 @@ definition module utilities
from StdString import String
from StdEnv import Eq, not, Ord, IncDec
import StdMisc, general
/*
For Strings
*/
......@@ -72,6 +73,7 @@ foldSt op l st :== fold_st l st
fold_st [] st = st
fold_st [a:x] st = fold_st x (op a st)
// iFoldSt :: (Int -> .(.b -> .b)) !Int !Int .b -> .b
iFoldSt op fr to st :== i_fold_st fr to st
where
i_fold_st fr to st
......@@ -82,7 +84,7 @@ iFoldSt op fr to st :== i_fold_st fr to st
iterateSt op st :== iterate_st op st
where
iterate_st op st
# (continue, st) = op (False, st)
# (continue, st) = op st
| continue
= iterate_st op st
= st
......
......@@ -169,7 +169,7 @@ iFoldSt op fr to st :== i_fold_st fr to st
iterateSt op st :== iterate_st op st
where
iterate_st op st
# (continue, st) = op (False, st)
# (continue, st) = op st
| continue
= iterate_st op st
= st
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment