Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-compiler-and-rts
compiler
Commits
63aaf68b
Commit
63aaf68b
authored
May 06, 2013
by
John van Groningen
Browse files
call reset_free_var_heap_pointers before expandCheckedAlternative in expandMacrosInBody,
to prevent crash in collectVariables
parent
e6bb857b
Changes
1
Hide whitespace changes
Inline
Side-by-side
frontend/transform.icl
View file @
63aaf68b
...
...
@@ -1433,19 +1433,22 @@ where
expandMacrosInBody
::
![.
FunCall
]
!
CheckedBody
![
ExprInfoPtr
]
!
PredefSymbolsForTransform
!
Bool
!*
ExpandState
->
(![
FreeVar
],!
Expression
,![
FreeVar
],![
FunCall
],![
ExprInfoPtr
],!*
ExpandState
)
expandMacrosInBody
fi_calls
{
cb_args
,
cb_rhs
}
fi_dynamics
predef_symbols_for_transform
reset_body_of_rhs_macros
es
=:{
es_symbol_table
,
es_expression_heap
,
es_fun_defs
,
es_macro_defs
}
es
=:{
es_symbol_table
,
es_expression_heap
,
es_fun_defs
,
es_macro_defs
,
es_var_heap
}
#
(
prev_calls
,
fun_defs
,
macro_defs
,
es_symbol_table
)
=
addFunctionCallsToSymbolTable
fi_calls
es_fun_defs
es_macro_defs
es_symbol_table
es_var_heap
=
if
reset_body_of_rhs_macros
(
reset_free_var_heap_pointers
cb_rhs
(
reset_free_var_heap_pointers
cb_args
es_var_heap
))
es_var_heap
es
&
es_fun_defs
=
fun_defs
,
es_macro_defs
=
macro_defs
,
es_symbol_table
=
es_symbol_table
,
es_expression_heap
=
es_expression_heap
,
es_var_heap
=
es_var_heap
([
rhs
:
rhss
],
(
all_calls
,
es
)
)
=
mapSt
expandCheckedAlternative
cb_rhs
(
prev_calls
,
{
es
&
es_fun_defs
=
fun_defs
,
es_macro_defs
=
macro_defs
,
es_symbol_table
=
es_symbol_table
,
es_expression_heap
=
es_expression_heap
}
)
=
mapSt
expandCheckedAlternative
cb_rhs
(
prev_calls
,
es
)
(
fun_defs
,
symbol_table
)
=
removeFunctionCallsFromSymbolTable
all_calls
es
.
es_fun_defs
es
.
es_symbol_table
var_heap
=
es
.
es_var_heap
var_heap
=
if
reset_body_of_rhs_macros
(
reset_free_var_heap_pointers
cb_rhs
(
reset_free_var_heap_pointers
cb_args
var_heap
))
var_heap
((
merged_rhs
,
_),
es_var_heap
,
es_expression_heap
,
es_error
)
=
mergeCases
rhs
rhss
var_heap
es
.
es_expression_heap
es
.
es_error
=
mergeCases
rhs
rhss
es
.
es_var_heap
es
.
es_expression_heap
es
.
es_error
(
new_rhs
,
new_args
,
local_vars
,
fi_dynamics
,
{
cos_error
,
cos_var_heap
,
cos_expression_heap
})
=
determineVariablesAndRefCounts
cb_args
merged_rhs
{
cos_error
=
es_error
,
cos_var_heap
=
es_var_heap
,
cos_expression_heap
=
es_expression_heap
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment