aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorjohnvg2007-03-28 12:36:16 +0000
committerjohnvg2007-03-28 12:36:16 +0000
commit9e14e0bf7db0df82688dda1c124497ba8de24f0b (patch)
tree69410eca4266a08a7297b82b3b93937bfc22c142 /frontend
parentfix module number test in function try_to_expand_synonym_type_in_main_dcl, (diff)
fix "not imported" error if StdArray or StdEnum needs to be imported
and is explicitly imported git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@1657 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend')
-rw-r--r--frontend/check.icl26
-rw-r--r--frontend/checkFunctionBodies.icl9
-rw-r--r--frontend/checksupport.dcl10
3 files changed, 25 insertions, 20 deletions
diff --git a/frontend/check.icl b/frontend/check.icl
index b31284e..9e3eb45 100644
--- a/frontend/check.icl
+++ b/frontend/check.icl
@@ -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
0 -> cs
_ -> check_it PD_StdDynamic mod_ident "" extension cs
- # cs = case x_needed_modules bitand cNeedStdArray of
+ # cs = case x_needed_modules bitand cStdArrayImportMissing of
0 -> cs
- _ -> check_it PD_StdArray mod_ident " (needed for array denotations)" extension cs
- # cs = case x_needed_modules bitand cNeedStdEnum of
+ _ -> missing_import_error PD_StdArray mod_ident " (needed for array denotations)" extension cs
+ # cs = case x_needed_modules bitand cStdEnumImportMissing of
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
0 -> cs
_ -> check_it PD_StdStrictLists mod_ident " (needed for strict lists)" extension cs
@@ -2920,13 +2920,17 @@ check_needed_modules_are_imported mod_ident extension cs=:{cs_x={x_needed_module
= case ste_kind of
STE_ClosedModule
-> cs
- _
- # 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 = checkError pds_ident ("not imported"+++explanation) cs_error
- cs_error = popErrorAdmin cs_error
- -> { cs & cs_error = cs_error }
-
+ _
+ -> 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 = checkError pds_ident ("not imported"+++explanation) cs_error
+ cs_error = popErrorAdmin cs_error
+ = { cs & cs_error = cs_error }
+
// MV ...
switched_off_Clean_feature pd mod_ident explanation extension cs=:{cs_symbol_table}
# ident = predefined_idents.[pd]
diff --git a/frontend/checkFunctionBodies.icl b/frontend/checkFunctionBodies.icl
index 6ec2135..4f17c18 100644
--- a/frontend/checkFunctionBodies.icl
+++ b/frontend/checkFunctionBodies.icl
@@ -130,6 +130,7 @@ checkFunctionBodies :: !FunctionBody !Ident !.ExpressionInput !*ExpressionState
-> (!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}
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)
= 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
@@ -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)
= 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 = { cs & cs_symbol_table = cs_symbol_table }
(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)
- = check_function_bodies free_vars cb_args bodies e_input { e_state & es_dynamics = [], es_var_heap = es_var_heap } e_info
- { cs & cs_symbol_table = cs_symbol_table }
+ = check_function_bodies free_vars cb_args bodies e_input { e_state & es_dynamics = [], es_var_heap = es_var_heap } e_info 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
dynamics_in_rhs cs
@@ -1217,7 +1218,7 @@ where
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
- = (EE, free_vars, e_state, e_info, { cs & cs_x.x_needed_modules = cs_x.x_needed_modules bitor cNeedStdEnum})
+ = (EE, free_vars, e_state, e_info, { cs & cs_x.x_needed_modules = cs_x.x_needed_modules bitor cStdEnumImportMissing})
// instead of giving an error message remember that StdEnum should have been 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]
@@ -1234,7 +1235,7 @@ where
update_ident = local_predefined_idents.[PD_ArrayUpdateFun]
usize_ident = local_predefined_idents.[PD_UnqArraySizeFun]
| 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 cNeedStdArray})
+ = (EE, free_vars, e_state, e_info, { cs & cs_x.x_needed_modules = cs_x.x_needed_modules bitor cStdArrayImportMissing})
// 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
| id==local_predefined_idents.[PD_cons] || id==local_predefined_idents.[PD_decons]
diff --git a/frontend/checksupport.dcl b/frontend/checksupport.dcl
index 9af55a6..763c15a 100644
--- a/frontend/checksupport.dcl
+++ b/frontend/checksupport.dcl
@@ -10,11 +10,11 @@ cModuleScope :== 0
cGlobalScope :== 1
cRankTwoScope :== 2
-cNeedStdArray :== 1
-cNeedStdEnum :== 2
-cNeedStdDynamic :== 4
-cNeedStdGeneric :== 8
-cNeedStdStrictLists :== 16
+cStdArrayImportMissing :== 1
+cStdEnumImportMissing :== 2
+cNeedStdDynamic :== 4
+cNeedStdGeneric :== 8
+cNeedStdStrictLists :== 16
:: VarHeap :== Heap VarInfo