summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2015-10-15 01:55:52 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2015-10-15 01:55:52 +0000
commita09fb037accb1d9266ab8b8db89b1c81d3d958b4 (patch)
tree5914055af241b5e066007a2f2ce62d6ccaf3dc35 /tools
parente6075fd1e33717d6fe2a547ee3d82f6b627b2c8d (diff)
downloadocaml-a09fb037accb1d9266ab8b8db89b1c81d3d958b4.tar.gz
add refuted cases, syntax is 'pat -> _'
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gadt-warnings@16500 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'tools')
-rw-r--r--tools/depend.ml2
-rw-r--r--tools/ocamlprof.ml25
2 files changed, 15 insertions, 12 deletions
diff --git a/tools/depend.ml b/tools/depend.ml
index a09c156765..c788eb2ec5 100644
--- a/tools/depend.ml
+++ b/tools/depend.ml
@@ -208,7 +208,7 @@ and add_cases bv cases =
and add_case bv {pc_lhs; pc_guard; pc_rhs} =
let bv = add_pattern bv pc_lhs in
add_opt add_expr bv pc_guard;
- add_expr bv pc_rhs
+ add_opt add_expr bv pc_rhs
and add_bindings recf bv pel =
let bv' = List.fold_left (fun bv x -> add_pattern bv x.pvb_pat) bv pel in
diff --git a/tools/ocamlprof.ml b/tools/ocamlprof.ml
index dde248cd48..18e4681e2a 100644
--- a/tools/ocamlprof.ml
+++ b/tools/ocamlprof.ml
@@ -153,14 +153,15 @@ let rec rewrite_patexp_list iflag l =
and rewrite_cases iflag l =
List.iter
(fun pc ->
- begin match pc.pc_guard with
- | None -> ()
- | Some g -> rewrite_exp iflag g
- end;
- rewrite_exp iflag pc.pc_rhs
- )
+ rewrite_exp_opt iflag pc.pc_guard;
+ rewrite_exp_opt iflag pc.pc_rhs)
l
+and rewrite_exp_opt iflag o =
+ match o with
+ None -> ()
+ | Some e -> rewrite_exp iflag e
+
and rewrite_labelexp_list iflag l =
rewrite_exp_list iflag (List.map snd l)
@@ -187,7 +188,7 @@ and rw_exp iflag sexp =
rewrite_cases iflag caselist
| Pexp_fun (_, _, p, e) ->
- let l = [{pc_lhs=p; pc_guard=None; pc_rhs=e}] in
+ let l = [{pc_lhs=p; pc_guard=None; pc_rhs=Some e}] in
if !instr_fun then
rewrite_function iflag l
else
@@ -305,17 +306,19 @@ and rewrite_ifbody iflag ghost sifbody =
and rewrite_annotate_exp_list l =
List.iter
(function
- | {pc_guard=Some scond; pc_rhs=sbody} ->
+ | {pc_guard=Some scond; pc_rhs=Some sbody} ->
insert_profile rw_exp scond;
insert_profile rw_exp sbody;
- | {pc_rhs={pexp_desc = Pexp_constraint(sbody, _)}} (* let f x : t = e *)
+ | {pc_rhs=Some {pexp_desc = Pexp_constraint(sbody, _)}}
+ (* let f x : t = e *)
-> insert_profile rw_exp sbody
- | {pc_rhs=sexp} -> insert_profile rw_exp sexp)
+ | {pc_rhs=Some sexp} -> insert_profile rw_exp sexp
+ | {pc_rhs=None} -> ())
l
and rewrite_function iflag = function
| [{pc_lhs=_; pc_guard=None;
- pc_rhs={pexp_desc = (Pexp_function _|Pexp_fun _)} as sexp}] ->
+ pc_rhs=Some ({pexp_desc = (Pexp_function _|Pexp_fun _)} as sexp)}] ->
rewrite_exp iflag sexp
| l -> rewrite_funmatching l