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
49e4c395
Commit
49e4c395
authored
Mar 28, 2007
by
John van Groningen
Browse files
fix "not imported" error if StdArray or StdEnum needs to be imported
and is explicitly imported
parent
868c279c
Changes
3
Show whitespace changes
Inline
Side-by-side
frontend/check.icl
View file @
49e4c395
...
@@ -2902,12 +2902,12 @@ check_needed_modules_are_imported mod_ident extension cs=:{cs_x={x_needed_module
...
@@ -2902,12 +2902,12 @@ check_needed_modules_are_imported mod_ident extension cs=:{cs_x={x_needed_module
#
cs
=
case
x_needed_modules
bitand
cNeedStdDynamic
of
#
cs
=
case
x_needed_modules
bitand
cNeedStdDynamic
of
0
->
cs
0
->
cs
_
->
check_it
PD_StdDynamic
mod_ident
""
extension
cs
_
->
check_it
PD_StdDynamic
mod_ident
""
extension
cs
#
cs
=
case
x_needed_modules
bitand
c
Need
StdArray
of
#
cs
=
case
x_needed_modules
bitand
cStdArray
ImportMissing
of
0
->
cs
0
->
cs
_
->
check_it
PD_StdArray
mod_ident
" (needed for array denotations)"
extension
cs
_
->
missing_import_error
PD_StdArray
mod_ident
" (needed for array denotations)"
extension
cs
#
cs
=
case
x_needed_modules
bitand
c
Need
StdEnum
of
#
cs
=
case
x_needed_modules
bitand
cStdEnum
ImportMissing
of
0
->
cs
0
->
cs
_
->
check_it
PD_StdEnum
mod_ident
" (needed for [..] expressions)"
extension
cs
_
->
missing_import_error
PD_StdEnum
mod_ident
" (needed for [..] expressions)"
extension
cs
#
cs
=
case
x_needed_modules
bitand
cNeedStdStrictLists
of
#
cs
=
case
x_needed_modules
bitand
cNeedStdStrictLists
of
0
->
cs
0
->
cs
_
->
check_it
PD_StdStrictLists
mod_ident
" (needed for strict lists)"
extension
cs
_
->
check_it
PD_StdStrictLists
mod_ident
" (needed for strict lists)"
extension
cs
...
@@ -2921,11 +2921,15 @@ check_needed_modules_are_imported mod_ident extension cs=:{cs_x={x_needed_module
...
@@ -2921,11 +2921,15 @@ check_needed_modules_are_imported mod_ident extension cs=:{cs_x={x_needed_module
STE_ClosedModule
STE_ClosedModule
->
cs
->
cs
_
_
#
error_location
=
{
ip_ident
=
mod_ident
,
ip_line
=
1
,
ip_file
=
mod_ident
.
id_name
+++
extension
}
->
missing_import_error
pd
mod_ident
explanation
extension
cs
missing_import_error
pd
mod_ident
explanation
extension
cs
#
pds_ident
=
predefined_idents
.[
pd
]
error_location
=
{
ip_ident
=
mod_ident
,
ip_line
=
1
,
ip_file
=
mod_ident
.
id_name
+++
extension
}
cs_error
=
pushErrorAdmin
error_location
cs
.
cs_error
cs_error
=
pushErrorAdmin
error_location
cs
.
cs_error
cs_error
=
checkError
pds_ident
(
"not imported"
+++
explanation
)
cs_error
cs_error
=
checkError
pds_ident
(
"not imported"
+++
explanation
)
cs_error
cs_error
=
popErrorAdmin
cs_error
cs_error
=
popErrorAdmin
cs_error
->
{
cs
&
cs_error
=
cs_error
}
=
{
cs
&
cs_error
=
cs_error
}
// MV ...
// MV ...
switched_off_Clean_feature
pd
mod_ident
explanation
extension
cs
=:{
cs_symbol_table
}
switched_off_Clean_feature
pd
mod_ident
explanation
extension
cs
=:{
cs_symbol_table
}
...
...
frontend/checkFunctionBodies.icl
View file @
49e4c395
...
@@ -130,6 +130,7 @@ checkFunctionBodies :: !FunctionBody !Ident !.ExpressionInput !*ExpressionState
...
@@ -130,6 +130,7 @@ checkFunctionBodies :: !FunctionBody !Ident !.ExpressionInput !*ExpressionState
->
(!
FunctionBody
,
![
FreeVar
],
!*
ExpressionState
,
!*
ExpressionInfo
,
!*
CheckState
)
->
(!
FunctionBody
,
![
FreeVar
],
!*
ExpressionState
,
!*
ExpressionInfo
,
!*
CheckState
)
checkFunctionBodies
(
ParsedBody
[{
pb_args
,
pb_rhs
={
rhs_alts
,
rhs_locals
},
pb_position
}
:
bodies
])
function_ident_for_errors
e_input
=:{
ei_expr_level
,
ei_mod_index
}
checkFunctionBodies
(
ParsedBody
[{
pb_args
,
pb_rhs
={
rhs_alts
,
rhs_locals
},
pb_position
}
:
bodies
])
function_ident_for_errors
e_input
=:{
ei_expr_level
,
ei_mod_index
}
e_state
=:{
es_var_heap
,
es_fun_defs
}
e_info
cs
e_state
=:{
es_var_heap
,
es_fun_defs
}
e_info
cs
#
(
aux_patterns
,
(
var_env
,
array_patterns
),
{
ps_var_heap
,
ps_fun_defs
},
e_info
,
cs
)
#
(
aux_patterns
,
(
var_env
,
array_patterns
),
{
ps_var_heap
,
ps_fun_defs
},
e_info
,
cs
)
=
check_patterns
pb_args
{
pi_def_level
=
ei_expr_level
,
pi_mod_index
=
ei_mod_index
,
pi_is_node_pattern
=
False
}
([],
[])
=
check_patterns
pb_args
{
pi_def_level
=
ei_expr_level
,
pi_mod_index
=
ei_mod_index
,
pi_is_node_pattern
=
False
}
([],
[])
{
ps_var_heap
=
es_var_heap
,
ps_fun_defs
=
es_fun_defs
}
e_info
cs
{
ps_var_heap
=
es_var_heap
,
ps_fun_defs
=
es_fun_defs
}
e_info
cs
...
@@ -138,10 +139,10 @@ checkFunctionBodies (ParsedBody [{pb_args,pb_rhs={rhs_alts,rhs_locals}, pb_posit
...
@@ -138,10 +139,10 @@ checkFunctionBodies (ParsedBody [{pb_args,pb_rhs={rhs_alts,rhs_locals}, pb_posit
(
expr_with_array_selections
,
free_vars
,
e_state
=:{
es_var_heap
,
es_dynamics
=
dynamics_in_rhs
},
e_info
,
cs
)
(
expr_with_array_selections
,
free_vars
,
e_state
=:{
es_var_heap
,
es_dynamics
=
dynamics_in_rhs
},
e_info
,
cs
)
=
addArraySelections
array_patterns
rhs_expr
free_vars
e_input
e_state
e_info
cs
=
addArraySelections
array_patterns
rhs_expr
free_vars
e_input
e_state
e_info
cs
cs_symbol_table
=
removeLocalIdentsFromSymbolTable
ei_expr_level
var_env
cs
.
cs_symbol_table
cs_symbol_table
=
removeLocalIdentsFromSymbolTable
ei_expr_level
var_env
cs
.
cs_symbol_table
cs
=
{
cs
&
cs_symbol_table
=
cs_symbol_table
}
(
cb_args
,
es_var_heap
)
=
mapSt
determine_function_arg
aux_patterns
es_var_heap
(
cb_args
,
es_var_heap
)
=
mapSt
determine_function_arg
aux_patterns
es_var_heap
(
rhss
,
free_vars
,
e_state
=:{
es_dynamics
,
es_expr_heap
,
es_var_heap
},
e_info
,
cs
)
(
rhss
,
free_vars
,
e_state
=:{
es_dynamics
,
es_expr_heap
,
es_var_heap
},
e_info
,
cs
)
=
check_function_bodies
free_vars
cb_args
bodies
e_input
{
e_state
&
es_dynamics
=
[],
es_var_heap
=
es_var_heap
}
e_info
=
check_function_bodies
free_vars
cb_args
bodies
e_input
{
e_state
&
es_dynamics
=
[],
es_var_heap
=
es_var_heap
}
e_info
cs
{
cs
&
cs_symbol_table
=
cs_symbol_table
}
(
rhs
,
position
,
es_var_heap
,
es_expr_heap
,
dynamics_in_patterns
,
cs
)
(
rhs
,
position
,
es_var_heap
,
es_expr_heap
,
dynamics_in_patterns
,
cs
)
=
transform_patterns_into_cases
aux_patterns
cb_args
expr_with_array_selections
pb_position
es_var_heap
es_expr_heap
=
transform_patterns_into_cases
aux_patterns
cb_args
expr_with_array_selections
pb_position
es_var_heap
es_expr_heap
dynamics_in_rhs
cs
dynamics_in_rhs
cs
...
@@ -1217,7 +1218,7 @@ where
...
@@ -1217,7 +1218,7 @@ where
from_then_to_ident
=
local_predefined_idents
.[
PD_FromThenTo
]
from_then_to_ident
=
local_predefined_idents
.[
PD_FromThenTo
]
|
id
==
from_ident
||
id
==
from_then_ident
||
id
==
from_to_ident
||
id
==
from_then_to_ident
|
id
==
from_ident
||
id
==
from_then_ident
||
id
==
from_to_ident
||
id
==
from_then_to_ident
=
(
EE
,
free_vars
,
e_state
,
e_info
,
{
cs
&
cs_x
.
x_needed_modules
=
cs_x
.
x_needed_modules
bitor
c
Need
StdEnum
})
=
(
EE
,
free_vars
,
e_state
,
e_info
,
{
cs
&
cs_x
.
x_needed_modules
=
cs_x
.
x_needed_modules
bitor
cStdEnum
ImportMissing
})
// instead of giving an error message remember that StdEnum should have been imported.
// instead of giving an error message remember that StdEnum should have been imported.
// Error will be given in function check_needed_modules_are_imported
// Error will be given in function check_needed_modules_are_imported
|
id
==
local_predefined_idents
.[
PD_FromS
]
||
id
==
local_predefined_idents
.[
PD_FromTS
]
||
id
==
local_predefined_idents
.[
PD_FromSTS
]
|
id
==
local_predefined_idents
.[
PD_FromS
]
||
id
==
local_predefined_idents
.[
PD_FromTS
]
||
id
==
local_predefined_idents
.[
PD_FromSTS
]
...
@@ -1234,7 +1235,7 @@ where
...
@@ -1234,7 +1235,7 @@ where
update_ident
=
local_predefined_idents
.[
PD_ArrayUpdateFun
]
update_ident
=
local_predefined_idents
.[
PD_ArrayUpdateFun
]
usize_ident
=
local_predefined_idents
.[
PD_UnqArraySizeFun
]
usize_ident
=
local_predefined_idents
.[
PD_UnqArraySizeFun
]
|
id
==
createArray_ident
||
id
==
uselect_ident
||
id
==
update_ident
||
id
==
usize_ident
|
id
==
createArray_ident
||
id
==
uselect_ident
||
id
==
update_ident
||
id
==
usize_ident
=
(
EE
,
free_vars
,
e_state
,
e_info
,
{
cs
&
cs_x
.
x_needed_modules
=
cs_x
.
x_needed_modules
bitor
c
Need
StdArray
})
=
(
EE
,
free_vars
,
e_state
,
e_info
,
{
cs
&
cs_x
.
x_needed_modules
=
cs_x
.
x_needed_modules
bitor
cStdArray
ImportMissing
})
// instead of giving an error message remember that StdArray should have been be imported.
// instead of giving an error message remember that StdArray should have been be imported.
// Error will be given in function check_needed_modules_are_imported
// Error will be given in function check_needed_modules_are_imported
|
id
==
local_predefined_idents
.[
PD_cons
]
||
id
==
local_predefined_idents
.[
PD_decons
]
|
id
==
local_predefined_idents
.[
PD_cons
]
||
id
==
local_predefined_idents
.[
PD_decons
]
...
...
frontend/checksupport.dcl
View file @
49e4c395
...
@@ -10,8 +10,8 @@ cModuleScope :== 0
...
@@ -10,8 +10,8 @@ cModuleScope :== 0
cGlobalScope
:==
1
cGlobalScope
:==
1
cRankTwoScope
:==
2
cRankTwoScope
:==
2
c
Need
StdArray
:==
1
cStdArray
ImportMissing
:==
1
c
Need
StdEnum
:==
2
cStdEnum
ImportMissing
:==
2
cNeedStdDynamic
:==
4
cNeedStdDynamic
:==
4
cNeedStdGeneric
:==
8
cNeedStdGeneric
:==
8
cNeedStdStrictLists
:==
16
cNeedStdStrictLists
:==
16
...
...
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