Removed systematic qual. of infix op as pervasives

Bug: every infix operator was systematically qualified
as pervasive.
This commit is contained in:
Gwenal Delaval 2012-07-24 17:09:51 +02:00
parent 5890e3599f
commit 5ed07e1e5a
2 changed files with 19 additions and 3 deletions

View file

@ -266,7 +266,7 @@ let mk_call ?(params=[]) ?(inlined=false) op exps =
Eapp (mk_app op params inlined, exps)
let mk_op_call ?(params=[]) s exps =
mk_call ~params:params (Efun (Q (Names.pervasives_qn s))) exps
mk_call ~params:params (Enode (ToQ s)) exps
let mk_iterator_call it ln params n_list pexps exps =
Eiterator (it, mk_app (Enode ln) params false, n_list, pexps, exps)

View file

@ -49,12 +49,28 @@ let static_exp funs local_const se =
| _ -> ());
Hept_parsetree_mapfold.static_exp funs local_const se
(** Qualify and check for pervasiveness *)
let qualify_pervasive q =
match q with
| ToQ name ->
begin
try
match (Modules.qualify_value name) with
| { Names.qual = Names.Pervasives } as qn ->
Q qn
| _ -> raise Not_static
with Not_found -> raise Not_static
end
| Q { Names.qual = Names.Pervasives } -> q
| _ -> raise Not_static
(** 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 =
match app.a_op with
| Efun ((Q { Names.qual = Names.Pervasives }) as q)
| Enode ((Q { Names.qual = Names.Pervasives }) as q) ->
| Efun q
| Enode q ->
let q = qualify_pervasive q in
q, (app.a_params @ args)
| _ -> raise Not_static