From 1184114d8c899bbdfa9eff2423219925c49a0ab7 Mon Sep 17 00:00:00 2001 From: Erwan Jahier <jahier@imag.fr> Date: Tue, 26 May 2009 16:47:30 +0200 Subject: [PATCH] Lookup provided constants that are used in iterators, and issue a better error message if the constant is abstract ("an integer is expected whereas an int is provided" was not a great message...). --- Makefile | 2 +- src/licDump.ml | 7 +++++-- src/predefEvalType.ml | 16 +++++++++++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index c2d8c1b8..7b4ffac0 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ utest_lv4: ci:src/version.ml - make test && git commit -F log && rm -f src/version.ml + make alltest && git commit -F log && rm -f src/version.ml cia:src/version.ml make alltest && git commit -a -F log && rm -f src/version.ml \ No newline at end of file diff --git a/src/licDump.ml b/src/licDump.ml index 47011893..0ecb34c3 100644 --- a/src/licDump.ml +++ b/src/licDump.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 12/03/2009 (at 09:41) by Erwan Jahier> *) +(** Time-stamp: <modified the 26/05/2009 (at 16:39) by Erwan Jahier> *) open Printf open Lxm @@ -255,7 +255,10 @@ and string_of_decl var_info_eff = in let clk_str = (string_of_clock (snd var_info_eff.var_clock_eff)) in let vt_str = - if !Global.ec && snd var_info_eff.var_clock_eff <> BaseEff + if !Global.ec && + (match (snd var_info_eff.var_clock_eff) with + BaseEff | ClockVar _ -> false + | _ -> true) then "(" ^ vt_str ^ ")" else vt_str in diff --git a/src/predefEvalType.ml b/src/predefEvalType.ml index 136e94e8..efe67d7a 100644 --- a/src/predefEvalType.ml +++ b/src/predefEvalType.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 26/05/2009 (at 15:34) by Erwan Jahier> *) +(** Time-stamp: <modified the 26/05/2009 (at 15:36) by Erwan Jahier> *) open Predef open Lxm @@ -82,6 +82,20 @@ let (get_node_and_constant: Lxm.t -> | [NodeStaticArgEff(_,(n, inlist, outlist)); ConstStaticArgEff(_,Int_const_eff c)] -> n, inlist, outlist, c + | [NodeStaticArgEff(_,(n, inlist, outlist)); + ConstStaticArgEff(_, Abstract_const_eff(l,_,Int_const_eff c, true))] -> + n, inlist, outlist, c + + | [NodeStaticArgEff(_,_); ConstStaticArgEff(_, Extern_const_eff(l, _))] -> + let msg = "an integer is expected, whereas an extern constant (" ^ + (Ident.string_of_long l) ^ ") was provided.\n" + in + raise (Compile_error(lxm, msg)) + | [NodeStaticArgEff(_,_); ConstStaticArgEff(_, Abstract_const_eff(l,_,_, false))] -> + let msg = "an integer is expected, whereas an abstract constant (" ^ + (Ident.string_of_long l) ^ ") was provided.\n" + in + raise (Compile_error(lxm, msg)) | [NodeStaticArgEff(_,(n, inlist, outlist)); ConstStaticArgEff(_, const)] -> let msg = "an integer is expected, whereas a " ^ (LicDump.string_of_type_eff4msg (Eff.type_of_const const)) ^ -- GitLab