Skip to content
GitLab
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
c78d2bb5
Commit
c78d2bb5
authored
Sep 13, 2001
by
Sjaak Smetsers
Browse files
Two fixes: (1) error with missing type contexts
(2) uniqueness bug with local variables
parent
082df595
Changes
2
Hide whitespace changes
Inline
Side-by-side
frontend/overloading.icl
View file @
c78d2bb5
...
...
@@ -997,7 +997,7 @@ getClassVariable symb var_info_ptr var_heap error
->
(
var_name
,
new_info_ptr
,
var_heap
<:=
(
var_info_ptr
,
VI_ClassVar
var_name
new_info_ptr
(
inc
count
)),
error
)
(_,
var_heap
)
#
(
new_info_ptr
,
var_heap
)
=
newPtr
VI_Empty
var_heap
->
(
symb
,
var
_info_ptr
,
var_heap
<:=
(
var_info_ptr
,
VI_ClassVar
symb
new_info_ptr
1
),
overloadingError
symb
error
)
->
(
symb
,
new
_info_ptr
,
var_heap
<:=
(
var_info_ptr
,
VI_ClassVar
symb
new_info_ptr
1
),
overloadingError
symb
error
)
updateDynamics
::
![
Index
]
![
LocalTypePatternVariable
]
!
Int
!*{#
FunDef
}
!*{!
FunctionType
}
!*
ExpressionHeap
!*
TypeCodeInfo
!*
VarHeap
!*
ErrorAdmin
!*{#
PredefinedSymbol
}
->
(!*{#
FunDef
},
!*{!
FunctionType
},
!*
ExpressionHeap
,
!*
TypeCodeInfo
,
!*
VarHeap
,
!*
ErrorAdmin
,
!*{#
PredefinedSymbol
})
...
...
@@ -1035,7 +1035,7 @@ where
=
update_dynamics
funs
type_pattern_vars
({
ui_fun_defs
&
[
fun
]
=
fun_def
})
ui_fun_env
ui_symbol_heap
x_type_code_info
ui_var_heap
ui_error
predef_symbols
removeOverloadedFunctions
::
![
Index
]
![
LocalTypePatternVariable
]
!
Int
!*{#
FunDef
}
!*{!
FunctionType
}
!*
ExpressionHeap
removeOverloadedFunctions
::
![
Index
]
![
LocalTypePatternVariable
]
!
Int
!*{#
FunDef
}
!*{!
FunctionType
}
!*
ExpressionHeap
!*
TypeCodeInfo
!*
VarHeap
!*
ErrorAdmin
!*{#
PredefinedSymbol
}
->
(!*{#
FunDef
},
!*{!
FunctionType
},
!*
ExpressionHeap
,
!*
TypeCodeInfo
,
!*
VarHeap
,
!*
ErrorAdmin
,
!*{#
PredefinedSymbol
})
removeOverloadedFunctions
group
type_pattern_vars
main_dcl_module_n
fun_defs
fun_env
symbol_heap
type_code_info
var_heap
error
predef_symbols
...
...
@@ -1053,7 +1053,7 @@ where
#
(
fun_def
,
fun_defs
)
=
fun_defs
![
fun_index
]
(
CheckedType
st
=:{
st_context
},
fun_env
)
=
fun_env
![
fun_index
]
{
fun_body
=
TransformedBody
{
tb_args
,
tb_rhs
},
fun_info
,
fun_arity
,
fun_symb
,
fun_pos
}
=
fun_def
(
rev_variables
,
var_heap
)
=
foldSt
determine_class_argument
st_context
([],
var_heap
)
(
rev_variables
,
var_heap
)
=
foldSt
determine_class_argument
st_context
([],
var_heap
)
// ---> ("remove_overloaded_function", fun_symb, st_context))
error
=
setErrorAdmin
(
newPosition
fun_symb
fun_pos
)
error
(
type_code_info
,
symbol_heap
,
type_pattern_vars
,
var_heap
,
error
)
=
convertDynamicTypes
fun_info
.
fi_dynamics
(
type_code_info
,
symbol_heap
,
type_pattern_vars
,
var_heap
,
error
)
...
...
@@ -1064,7 +1064,6 @@ where
// MV ...
ui_x
=
{
x_type_code_info
=
type_code_info
,
x_predef_symbols
=
predef_symbols
,
x_main_dcl_module_n
=
main_dcl_module_n
,
x_internal_type_id
=
module_id_app
,
x_module_id
=
No
}}
// ... MV
// WAS: ui_x = {x_type_code_info=type_code_info, x_predef_symbols=predef_symbols,x_main_dcl_module_n=main_dcl_module_n}}
(
tb_args
,
var_heap
)
=
foldSt
retrieve_class_argument
rev_variables
(
tb_args
,
ui_var_heap
)
fun_def
=
{
fun_def
&
fun_body
=
TransformedBody
{
tb_args
=
tb_args
,
tb_rhs
=
tb_rhs
},
fun_arity
=
length
tb_args
,
fun_info
=
{
fun_info
&
fi_calls
=
fun_info
.
fi_calls
++
ui_instance_calls
,
fi_local_vars
=
ui_local_vars
}
}
...
...
@@ -1268,6 +1267,8 @@ where
// ... MV
}
import
RWSDebug
class
updateExpression
e
::
!
Index
!
e
!*
UpdateInfo
->
(!
e
,
!*
UpdateInfo
)
instance
updateExpression
Expression
...
...
@@ -1326,7 +1327,9 @@ where
->
(
Var
{
var_name
=
var_name
,
var_info_ptr
=
new_info_ptr
,
var_expr_ptr
=
nilPtr
},
(
var_heap
<:=
(
tc_var
,
VI_ClassVar
var_name
new_info_ptr
(
inc
count
)),
error
))
_
->
abort
"build_context_arg (overloading.icl)"
// ---> (tc <<- var_info))
#
(
new_info_ptr
,
var_heap
)
=
newPtr
VI_Empty
var_heap
->
(
Var
{
var_name
=
symb
,
var_info_ptr
=
new_info_ptr
,
var_expr_ptr
=
nilPtr
},
(
var_heap
<:=
(
tc_var
,
VI_ClassVar
symb
new_info_ptr
1
),
overloadingError
symb
error
))
get_recursive_fun_index
::
!
Index
!
SymbKind
Int
!{#
FunDef
}
->
Index
get_recursive_fun_index
group_index
(
SK_Function
{
glob_module
,
glob_object
})
main_dcl_module_n
fun_defs
...
...
frontend/refmark.icl
View file @
c78d2bb5
...
...
@@ -266,9 +266,6 @@ refMarkOfCase free_vars sel def {case_expr,case_guards=BasicPatterns type patter
(
def
,
used_lets
,
var_heap
)
=
refMarkOfDefault
case_explicit
free_vars
sel
def
case_default
local_lets
var_heap
(
pattern_depth
,
used_lets
,
var_heap
)
=
foldSt
(
ref_mark_of_basic_pattern
free_vars
sel
local_lets
def
)
patterns
(
0
,
used_lets
,
var_heap
)
=
addRefMarkOfDefault
False
pattern_depth
free_vars
def
used_lets
var_heap
// = refMarkOfDefault False pattern_depth free_vars sel defaul used_lets var_heap
// ---> ("refMarkOfCase", expr, [ (bp_value, bp_expr) \\ {bp_value, bp_expr} <- patterns])
where
ref_mark_of_basic_pattern
free_vars
sel
local_lets
def
{
bp_expr
}
(
pattern_depth
,
used_lets
,
var_heap
)
#
pattern_depth
=
inc
pattern_depth
...
...
@@ -289,7 +286,6 @@ refMarkOfCase free_vars sel def {case_expr,case_guards=DynamicPatterns patterns,
(
def
,
used_lets
,
var_heap
)
=
refMarkOfDefault
case_explicit
free_vars
sel
def
case_default
local_lets
var_heap
(
pattern_depth
,
used_lets
,
var_heap
)
=
foldSt
(
ref_mark_of_dynamic_pattern
free_vars
sel
local_lets
def
)
patterns
(
0
,
used_lets
,
var_heap
)
=
addRefMarkOfDefault
True
pattern_depth
free_vars
def
used_lets
var_heap
// = refMarkOfDefault True pattern_depth free_vars sel defaul used_lets var_heap
where
ref_mark_of_dynamic_pattern
free_vars
sel
local_lets
def
{
dp_var
,
dp_rhs
}
(
pattern_depth
,
used_lets
,
var_heap
)
#
pattern_depth
=
inc
pattern_depth
...
...
@@ -347,9 +343,6 @@ where
=
foldSt
(
ref_mark_of_algebraic_pattern
free_vars
sel
opt_pattern_var
local_lets
def
)
patterns
(
False
,
0
,
used_lets
,
var_heap
)
=
addRefMarkOfDefault
(
with_composite_pattern
&&
with_pattern_bindings
)
pattern_depth
free_vars
def
used_lets
var_heap
// = refMarkOfDefault (with_composite_pattern && with_pattern_bindings) pattern_depth free_vars sel case_default used_lets var_heap
ref_mark_of_algebraic_pattern
free_vars
sel
opt_pattern_var
local_lets
def
{
ap_vars
,
ap_expr
}
(
with_pattern_bindings
,
pattern_depth
,
used_lets
,
var_heap
)
#
pattern_depth
=
inc
pattern_depth
...
...
@@ -359,7 +352,7 @@ where
var_heap
=
refMark
[
[
fv
\\
(
fv
,_)
<-
used_pattern_vars
]
:
free_vars
]
sel
def
ap_expr
var_heap
// (var_heap ---> ("ref_mark_of_algebraic_pattern", ap_expr))
var_heap
=
restore_binding_of_pattern_variable
opt_pattern_var
used_pattern_vars
var_heap
(
used_lets
,
var_heap
)
=
collectUsedLetVars
local_lets
(
used_lets
,
var_heap
)
var_heap
=
clear_local_vars
used_pattern_vars
var_heap
//
var_heap = clear_local_vars used_pattern_vars var_heap
=
(
with_pattern_bindings
||
not
(
isEmpty
used_pattern_vars
),
pattern_depth
,
used_lets
,
var_heap
)
clear_local_vars
vars
var_heap
...
...
@@ -382,9 +375,8 @@ where
restore_binding_of_pattern_variable
_
[]
var_heap
=
var_heap
restore_binding_of_pattern_variable
(
Yes
var_info_ptr
)
used_pattern_vars
var_heap
#
(
VI_Occurrence
var_occ
=:{
occ_ref_count
,
occ_bind
=
OB_Pattern
_
occ_bind
},
var_heap
)
=
readPtr
var_info_ptr
var_heap
#
(
VI_Occurrence
var_occ
=:{
occ_ref_count
,
occ_bind
=
OB_Pattern
_
occ_bind
},
var_heap
)
=
readPtr
var_info_ptr
var_heap
=
var_heap
<:=
(
var_info_ptr
,
VI_Occurrence
{
var_occ
&
occ_bind
=
occ_bind
})
// ---> ("restore_binding_of_pattern_variable", occ_ref_count)
restore_binding_of_pattern_variable
_
used_pattern_vars
var_heap
=
var_heap
...
...
@@ -459,10 +451,10 @@ where
|
do_par_combine
#
new_comb_ref_count
=
parCombineRefCount
comb_ref_count
occ_ref_count
=
(
new_comb_ref_count
,
occ_previous
)
// ---> ("parCombineRefCount", comb_ref_count, occ_ref_count, new_comb_ref_count)
// ---> ("parCombineRefCount",
("this:",
comb_ref_count
), ("prev:"
, occ_ref_count
), ("new:"
, new_comb_ref_count)
)
#
new_comb_ref_count
=
seqCombineRefCount
comb_ref_count
occ_ref_count
=
(
new_comb_ref_count
,
occ_previous
)
// ---> ("seqCombineRefCount", comb_ref_count, occ_ref_count, new_comb_ref_count)
// ---> ("seqCombineRefCount",
("this:",
comb_ref_count
), ("prev:"
, occ_ref_count
), ("new:"
, new_comb_ref_count)
)
case_combine_ref_counts
do_par_combine
comb_ref_count
[
occ_ref_count
:
occ_previous
]
depth
#
new_comb_ref_count
=
case_combine_ref_count
comb_ref_count
occ_ref_count
=
case_combine_ref_counts
do_par_combine
new_comb_ref_count
occ_previous
(
dec
depth
)
...
...
@@ -596,6 +588,7 @@ where
->
(
coercion_env
,
var_heap
,
expr_heap
,
error
)
_
->
(
coercion_env
,
var_heap
,
expr_heap
,
error
)
// ---> ("make_shared_var_non_unique", fv_name)
make_shared_occurrences_non_unique
fv
multiply
(
coercion_env
,
expr_heap
,
error
)
=
foldSt
(
make_shared_occurrence_non_unique
fv
)
multiply
(
coercion_env
,
expr_heap
,
error
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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