summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>1999-11-15 12:44:49 +0000
committerDamien Doligez <damien.doligez-inria.fr>1999-11-15 12:44:49 +0000
commit536805736cd31e7e8d1d45541f5171e1e94b8dab (patch)
tree10ed05470a59c44ab0639be12279e0a83bd4e406
parent632e0ddfabb264a7527382fa7c3c99f986de7661 (diff)
exception -> false dans les assertions
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2524 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--parsing/parser.mly27
-rw-r--r--utils/config.mlp2
2 files changed, 18 insertions, 11 deletions
diff --git a/parsing/parser.mly b/parsing/parser.mly
index 145962567..a71414897 100644
--- a/parsing/parser.mly
+++ b/parsing/parser.mly
@@ -56,21 +56,28 @@ let ghpat d = { ppat_desc = d; ppat_loc = symbol_gloc () };;
let ghtyp d = { ptyp_desc = d; ptyp_loc = symbol_gloc () };;
let mkassert e =
- let {loc_start = st; loc_end = en} = symbol_rloc () in
+ let l = symbol_rloc () in
let triple = ghexp (Pexp_tuple
[ghexp (Pexp_constant (Const_string !input_name));
- ghexp (Pexp_constant (Const_int st));
- ghexp (Pexp_constant (Const_int en))]) in
- let ex = Ldot (Lident "Pervasives", "Assert_failure") in
- let bucket = ghexp (Pexp_construct (ex, Some triple, false)) in
- let ra = Ldot (Lident "Pervasives", "raise") in
- let raiser = ghexp (Pexp_apply (ghexp (Pexp_ident ra), [bucket])) in
- let un = ghexp (Pexp_construct (Lident "()", None, false)) in
+ ghexp (Pexp_constant (Const_int l.loc_start));
+ ghexp (Pexp_constant (Const_int l.loc_end))])
+ in
+ let excep = Ldot (Lident "Pervasives", "Assert_failure") in
+ let bucket = ghexp (Pexp_construct (excep, Some triple, false)) in
+ let raise_ = ghexp (Pexp_ident (Ldot (Lident "Pervasives", "raise"))) in
+ let raise_af = ghexp (Pexp_apply (raise_, [bucket])) in
+
+ let under = ghpat Ppat_any in
+ let false_ = ghexp (Pexp_construct (Lident "false", None, false)) in
+ let try_e = ghexp (Pexp_try (e, [(under, false_)])) in
+
+ let not_ = ghexp (Pexp_ident (Ldot (Lident "Pervasives", "not"))) in
+ let not_try_e = ghexp (Pexp_apply (not_, [try_e])) in
match e with
- | {pexp_desc = Pexp_construct (Lident "false", None, false) } -> raiser
+ | {pexp_desc = Pexp_construct (Lident "false", None, false) } -> raise_af
| _ -> if !Clflags.noassert
then mkexp (Pexp_construct (Lident "()", None, false))
- else mkexp (Pexp_ifthenelse (e, un, Some raiser))
+ else mkexp (Pexp_ifthenelse (not_try_e, raise_af, None))
;;
let mklazy e =
diff --git a/utils/config.mlp b/utils/config.mlp
index 499ded621..467377647 100644
--- a/utils/config.mlp
+++ b/utils/config.mlp
@@ -11,7 +11,7 @@
(* $Id$ *)
-let version = "2.02+8"
+let version = "2.02+9"
let standard_library =
try