Proper fix for the problem of scoping of Svar
This commit is contained in:
parent
59c8106e46
commit
29d3c75d55
2 changed files with 11 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -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<a1,a2> (a3) == op <a1> (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
|
||||
*)
|
||||
*)
|
||||
|
|
Loading…
Reference in a new issue