From 9d09e75da46e408fd799a4a435780c68342035c3 Mon Sep 17 00:00:00 2001 From: Dmitry Zakharov Date: Sat, 17 Aug 2024 19:28:05 +0400 Subject: [PATCH] Remove unused raise_kind --- jscomp/core/lam_convert.ml | 2 +- jscomp/ml/lambda.ml | 17 +---------------- jscomp/ml/lambda.mli | 8 +------- jscomp/ml/matching.ml | 4 ++-- jscomp/ml/printlambda.ml | 4 ++-- jscomp/ml/translcore.ml | 18 ++++++------------ 6 files changed, 13 insertions(+), 40 deletions(-) diff --git a/jscomp/core/lam_convert.ml b/jscomp/core/lam_convert.ml index 442dfe4ab1..e63bf4b81b 100644 --- a/jscomp/core/lam_convert.ml +++ b/jscomp/core/lam_convert.ml @@ -219,7 +219,7 @@ let lam_prim ~primitive:(p : Lambda.primitive) ~args loc : Lam.t = | Psetfield (id, info) -> prim ~primitive:(Psetfield (id, info)) ~args loc | Pduprecord -> prim ~primitive:Pduprecord ~args loc | Plazyforce -> prim ~primitive:Plazyforce ~args loc - | Praise _ -> prim ~primitive:Praise ~args loc + | Praise -> prim ~primitive:Praise ~args loc | Psequand -> prim ~primitive:Psequand ~args loc | Psequor -> prim ~primitive:Psequor ~args loc | Pnot -> prim ~primitive:Pnot ~args loc diff --git a/jscomp/ml/lambda.ml b/jscomp/ml/lambda.ml index 8b7489402f..72fc139e28 100644 --- a/jscomp/ml/lambda.ml +++ b/jscomp/ml/lambda.ml @@ -185,8 +185,6 @@ type immediate_or_pointer = | Immediate | Pointer - - type is_safe = | Safe | Unsafe @@ -204,16 +202,13 @@ type primitive = | Pmakeblock of tag_info | Pfield of int * field_dbg_info | Psetfield of int * set_field_dbg_info - - - | Pduprecord (* Force lazy values *) | Plazyforce (* External call *) | Pccall of Primitive.description (* Exceptions *) - | Praise of raise_kind + | Praise (* Boolean operations *) | Psequand | Psequor | Pnot (* Integer operations *) @@ -279,11 +274,6 @@ and boxed_integer = Primitive.boxed_integer = Pbigint | Pint32 | Pint64 -and raise_kind = - | Raise_regular - | Raise_reraise - | Raise_notrace - type pointer_info = | Pt_constructor of {name: string; const: int; non_const: int; attrs: Parsetree.attributes} | Pt_variant of {name: string} @@ -757,11 +747,6 @@ and negate_comparison = function | Clt -> Cge | Cle -> Cgt | Cgt -> Cle | Cge -> Clt -let raise_kind = function - | Raise_regular -> "raise" - | Raise_reraise -> "reraise" - | Raise_notrace -> "raise_notrace" - let lam_of_loc kind loc = let loc_start = loc.Location.loc_start in let (file, lnum, cnum) = Location.get_pos_info loc_start in diff --git a/jscomp/ml/lambda.mli b/jscomp/ml/lambda.mli index 87125870c5..804b91ff54 100644 --- a/jscomp/ml/lambda.mli +++ b/jscomp/ml/lambda.mli @@ -179,7 +179,7 @@ type primitive = (* External call *) | Pccall of Primitive.description (* Exceptions *) - | Praise of raise_kind + | Praise (* Boolean operations *) | Psequand | Psequor | Pnot (* Integer operations *) @@ -246,11 +246,6 @@ and boxed_integer = Primitive.boxed_integer = Pbigint | Pint32 | Pint64 -and raise_kind = - | Raise_regular - | Raise_reraise - | Raise_notrace - type structured_constant = Const_base of constant | Const_pointer of int * pointer_info @@ -402,7 +397,6 @@ val staticfail : lambda (* Anticipated static failure *) val is_guarded: lambda -> bool val patch_guarded : lambda -> lambda -> lambda -val raise_kind: raise_kind -> string val lam_of_loc : loc_kind -> Location.t -> lambda diff --git a/jscomp/ml/matching.ml b/jscomp/ml/matching.ml index d1fe30cc50..56c263ea68 100644 --- a/jscomp/ml/matching.ml +++ b/jscomp/ml/matching.ml @@ -2918,7 +2918,7 @@ let partial_function loc () = let fname = Filename.basename fname in - Lprim(Praise Raise_regular, [Lprim(Pmakeblock(Blk_extension), + Lprim(Praise, [Lprim(Pmakeblock(Blk_extension), [transl_normal_path Predef.path_match_failure; Lconst(Const_block(Blk_tuple, [Const_base(Const_string (fname, None)); @@ -2931,7 +2931,7 @@ let for_function loc repr param pat_act_list partial = (* In the following two cases, exhaustiveness info is not available! *) let for_trywith param pat_act_list = compile_matching None - (fun () -> Lprim(Praise Raise_reraise, [param], Location.none)) + (fun () -> Lprim(Praise, [param], Location.none)) param pat_act_list Partial let simple_for_let loc param pat body = diff --git a/jscomp/ml/printlambda.ml b/jscomp/ml/printlambda.ml index 4dc4e7705e..ecbdbe8391 100644 --- a/jscomp/ml/printlambda.ml +++ b/jscomp/ml/printlambda.ml @@ -136,7 +136,7 @@ let primitive ppf = function | Pduprecord -> fprintf ppf "duprecord" | Plazyforce -> fprintf ppf "force" | Pccall p -> fprintf ppf "%s" p.prim_name - | Praise k -> fprintf ppf "%s" (Lambda.raise_kind k) + | Praise -> fprintf ppf "raise" | Psequand -> fprintf ppf "&&" | Psequor -> fprintf ppf "||" | Pnot -> fprintf ppf "not" @@ -265,7 +265,7 @@ let name_of_primitive = function | Pduprecord -> "Pduprecord" | Plazyforce -> "Plazyforce" | Pccall _ -> "Pccall" - | Praise _ -> "Praise" + | Praise -> "Praise" | Psequand -> "Psequand" | Psequor -> "Psequor" | Pnot -> "Pnot" diff --git a/jscomp/ml/translcore.ml b/jscomp/ml/translcore.ml index d73468ced0..30467e1441 100644 --- a/jscomp/ml/translcore.ml +++ b/jscomp/ml/translcore.ml @@ -317,9 +317,9 @@ let primitives_table = ("%obj_field", Parrayrefu); ("%obj_set_field", Parraysetu); ("%obj_is_int", Pisint); - ("%raise", Praise Raise_regular); - ("%reraise", Praise Raise_reraise); - ("%raise_notrace", Praise Raise_notrace); + ("%raise", Praise); + ("%reraise", Praise); + ("%raise_notrace", Praise); ("%sequand", Psequand); ("%sequor", Psequor); ("%boolnot", Pnot); @@ -682,7 +682,7 @@ let assert_failed exp = in let fname = Filename.basename fname in Lprim - ( Praise Raise_regular, + ( Praise, [ Lprim ( Pmakeblock Blk_extension, @@ -781,15 +781,9 @@ and transl_exp0 (e : Typedtree.expression) : Lambda.lambda = transl_primitive_application e.exp_loc p e.exp_env prim_type args in match (prim, args) with - | Praise k, [ _ ] -> + | Praise, [ _ ] -> let targ = List.hd argl in - let k = - match (k, targ) with - | Raise_regular, Lvar id when Hashtbl.mem try_ids id -> - Raise_reraise - | _ -> k - in - wrap (Lprim (Praise k, [ targ ], e.exp_loc)) + wrap (Lprim (Praise, [ targ ], e.exp_loc)) | Ploc kind, [] -> lam_of_loc kind e.exp_loc | Ploc kind, [ arg1 ] -> let lam = lam_of_loc kind arg1.exp_loc in