diff --git a/compiler/heptagon/parsing/hept_scoping.ml b/compiler/heptagon/parsing/hept_scoping.ml index 81cacc6..d83ca19 100644 --- a/compiler/heptagon/parsing/hept_scoping.ml +++ b/compiler/heptagon/parsing/hept_scoping.ml @@ -200,10 +200,7 @@ let rec translate_static_exp se = and translate_static_exp_desc loc ed = let t = translate_static_exp in match ed with - | Svar (Q q) -> - let q = try qualify_const S.empty (Q q) - with Not_static -> message loc (Equal_notfound("constant", q)) - in Types.Svar q + | Svar (Q q) -> Types.Svar q | Svar (ToQ _) -> assert false | Sint i -> Types.Sint i | Sfloat f -> Types.Sfloat f diff --git a/compiler/heptagon/parsing/hept_static_scoping.ml b/compiler/heptagon/parsing/hept_static_scoping.ml index d6f2cc4..0f150e2 100644 --- a/compiler/heptagon/parsing/hept_static_scoping.ml +++ b/compiler/heptagon/parsing/hept_static_scoping.ml @@ -13,6 +13,14 @@ let assert_se e = match e.e_desc with | Econst se -> se | _ -> raise Not_static +let static_exp funs local_const se = + (match se.se_desc with + | Svar (Q q) -> + if not (Modules.check_const q) then + Error.message se.se_loc (Error.Equal_notfound("constant", q)) + | _ -> ()); + Hept_parsetree_mapfold.static_exp funs local_const se + (** convention : static params are set as the first static args, op (a3) == op (a2,a3) == op (a1,a2,a3) *) let static_app_from_app app args = @@ -63,7 +71,7 @@ let const_dec funs local_const cd = let program p = let funs = { Hept_parsetree_mapfold.defaults - with node_dec = node; exp = exp; const_dec = const_dec } in + with node_dec = node; exp = exp; static_exp = static_exp; const_dec = const_dec } in let p, _ = Hept_parsetree_mapfold.program_it funs Names.S.empty p in p @@ -73,4 +81,4 @@ let interface i = with node_dec = node; exp = exp; const_dec = const_dec } in let i, _ = Hept_parsetree_mapfold.interface_it funs Names.S.empty i in i -*) \ No newline at end of file +*)