Commit f056fafd authored by John van Groningen's avatar John van Groningen
Browse files

bug fix, report error if support for dynamics is not enabled and type Dynamic...

bug fix, report error if support for dynamics is not enabled and type Dynamic is used in a definition module
parent 1f9a747d
......@@ -32,12 +32,12 @@ frontEndInterface opt_file_dir_time options mod_ident search_paths cached_dcl_mo
# error = moduleCouldNotBeImportedError True mod_ident NoPos error
= (No,{},{},0,predef_symbols, hash_table, files, error, io, out, tcl_file, heaps)
# (Yes (mod_file,mod_dir,mod_time)) = opt_file_dir_time
#! support_dynamics = tcl_file=:Yes _
# (ok,dynamic_type_used,mod,hash_table,error,files)
= wantModule mod_file mod_time cWantIclFile mod_ident NoPos hash_table error files
= wantModule mod_file mod_time cWantIclFile mod_ident NoPos support_dynamics hash_table error files
| not ok
= (No,{},{},0,predef_symbols, hash_table, files, error, io, out, tcl_file, heaps)
# cached_module_idents = [dcl_mod.dcl_name \\ dcl_mod<-:cached_dcl_modules]
#! support_dynamics = case tcl_file of Yes _ -> True ; No -> False
# (ok, mod, global_fun_range, mod_functions, optional_dcl_mod, modules, dcl_module_n_in_cache,hash_table, error, files)
= scanModule mod cached_module_idents support_dynamics hash_table error search_paths modtimefunction files
......
......@@ -10,7 +10,7 @@ import syntax, hashtable, scanner, predef
cWantIclFile :== True
cWantDclFile :== False
wantModule :: !*File !{#Char} !Bool !Ident !Position !*HashTable !*File !*Files
-> (!Bool,!Bool,!ParsedModule, !*HashTable, !*File, !*Files)
wantModule :: !*File !{#Char} !Bool !Ident !Position !Bool !*HashTable !*File !*Files
-> (!Bool,!Bool,!ParsedModule,!*HashTable,!*File,!*Files)
moduleCouldNotBeImportedError :: !Bool !Ident !Position !*File -> *File
......@@ -37,6 +37,7 @@ Conventions:
PS_SkippingMask :== 1
PS_DynamicTypeUsedMask :== 4
PS_SupportDynamics :== 8
/*
appScanState :: (ScanState -> ScanState) !ParseState -> ParseState
......@@ -304,9 +305,9 @@ isMemberOrWhereOfMemberDefsContext parseContext :== parseContext bitand MemberOr
cWantIclFile :== True
cWantDclFile :== False
wantModule :: !*File !{#Char} !Bool !Ident !Position !*HashTable !*File !*Files
-> (!Bool,!Bool,!ParsedModule, !*HashTable, !*File, !*Files)
wantModule file modification_time iclmodule file_id=:{id_name} import_file_position hash_table error files
wantModule :: !*File !{#Char} !Bool !Ident !Position !Bool !*HashTable !*File !*Files
-> (!Bool,!Bool,!ParsedModule,!*HashTable,!*File,!*Files)
wantModule file modification_time iclmodule file_id=:{id_name} import_file_position support_dynamics hash_table error files
# scanState = openScanner file id_name file_name_extension
# hash_table=set_hte_mark (if iclmodule 1 0) hash_table
# (ok,dynamic_type_used,mod,hash_table,file,files) = initModule file_name modification_time scanState hash_table error files
......@@ -323,7 +324,7 @@ where
| succ
# pState = { ps_scanState = scanState
, ps_error = { pea_file = error, pea_ok = True }
, ps_flags = 0
, ps_flags = if support_dynamics PS_SupportDynamics 0
, ps_hash_table = hash_table
}
pState = verify_name mod_name id_name file_name pState
......@@ -3553,7 +3554,14 @@ where
try CharTypeToken pState = (Yes BT_Char , pState)
try BoolTypeToken pState = (Yes BT_Bool , pState)
try RealTypeToken pState = (Yes BT_Real , pState)
try DynamicTypeToken pState = (Yes BT_Dynamic , {pState & ps_flags=pState.ps_flags bitor PS_DynamicTypeUsedMask})
try DynamicTypeToken pState
| pState.ps_flags bitand PS_DynamicTypeUsedMask<>0
= (Yes BT_Dynamic , pState)
# pState & ps_flags=pState.ps_flags bitor PS_DynamicTypeUsedMask
| pState.ps_flags bitand PS_SupportDynamics<>0
= (Yes BT_Dynamic , pState)
# pState = parseErrorSimpleNoSkipping "Dynamic used but support for dynamics not enabled" pState
= (Yes BT_Dynamic , pState)
try FileTypeToken pState = (Yes BT_File , pState)
try WorldTypeToken pState = (Yes BT_World , pState)
try _ pState = (No , tokenBack pState)
......@@ -5577,7 +5585,6 @@ parseErrorSimple :: !{# Char} !{# Char} !ParseState -> ParseState
parseErrorSimple act msg pState
| pState.ps_flags bitand PS_SkippingMask<>0
= pState
| otherwise // not pState.ps_skipping
# (pos,pState) = getPosition pState
(filename,pState=:{ps_error={pea_file}}) = getFilename pState
pea_file = pea_file
......@@ -5591,6 +5598,15 @@ parseErrorSimple act msg pState
, ps_error = { pea_file = pea_file, pea_ok = False }
}
parseErrorSimpleNoSkipping :: !{# Char} !ParseState -> ParseState
parseErrorSimpleNoSkipping msg pState
| pState.ps_flags bitand PS_SkippingMask<>0
= pState
# (pos,pState) = getPosition pState
(filename,pState=:{ps_error={pea_file}}) = getFilename pState
pea_file = pea_file <<< "Parse error [" <<< filename <<< "," <<< pos <<< "]: " <<< msg <<< '\n'
= {pState & ps_error = {pea_file = pea_file, pea_ok = False}}
getFileAndLineNr :: !ParseState -> (!String, !Int, !ParseState)
getFileAndLineNr pState =: {ps_scanState}
# (filename,scanState) = getFilename ps_scanState
......
......@@ -1123,7 +1123,7 @@ parseAndScanDclModule dcl_module import_file_position parsed_modules cached_modu
= (False, [MakeEmptyModule dcl_module MK_None: parsed_modules],files, ca)
# (Yes (mod_file,mod_dir,mod_time)) = opt_file_dir_time
# (parse_ok,dynamic_type_used,mod, ca_hash_table, err_file, files)
= wantModule mod_file mod_time cWantDclFile dcl_module import_file_position ca_hash_table ca_error.pea_file files
= wantModule mod_file mod_time cWantDclFile dcl_module import_file_position support_dynamics ca_hash_table ca_error.pea_file files
# ca = {ca & ca_hash_table=ca_hash_table, ca_error={pea_file=err_file,pea_ok=True} }
| parse_ok
= scan_dcl_module dcl_module mod parsed_modules searchPaths modtimefunction files ca
......@@ -1220,7 +1220,7 @@ where
= (False, No,NoIndex, [],cached_modules, files, ca)
# (Yes (mod_file,mod_dir,mod_time)) = opt_file_dir_time
# (parse_ok,dynamic_type_used,mod, hash_table, err_file, files)
= wantModule mod_file mod_time cWantDclFile mod_ident NoPos ca_hash_table ca_error.pea_file files
= wantModule mod_file mod_time cWantDclFile mod_ident NoPos support_dynamics ca_hash_table ca_error.pea_file files
# ca = {ca & ca_hash_table=hash_table, ca_error={pea_file=err_file,pea_ok=True}}
| not parse_ok
= (False, No,NoIndex, [],cached_modules, files, ca)
......
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