readable failure messages should not be debug-mode-only features
This commit is contained in:
parent
3083bd1fe9
commit
70655bf514
16
envir.ml
16
envir.ml
@ -114,15 +114,13 @@ let decompose get_module_data env { txt = lident; loc } =
|
||||
let lookup object_name ~env_name object_env { txt = str; loc } =
|
||||
try snd (SMap.find str object_env)
|
||||
with Not_found ->
|
||||
if debug
|
||||
then
|
||||
Format.eprintf
|
||||
"%a@.%s not found in %s: %s@."
|
||||
Location.print_loc
|
||||
loc
|
||||
(String.capitalize_ascii object_name)
|
||||
env_name
|
||||
str;
|
||||
Format.eprintf
|
||||
"%a@.%s not found in %s: %s@."
|
||||
Location.print_loc
|
||||
loc
|
||||
(String.capitalize_ascii object_name)
|
||||
env_name
|
||||
str;
|
||||
raise Not_found
|
||||
|
||||
let rec env_get_module env ({ loc; _ } as lid) =
|
||||
|
5
eval.ml
5
eval.ml
@ -169,8 +169,7 @@ and eval_expr prims env expr =
|
||||
let loc = expr.pexp_loc in
|
||||
(match fexpr loc l with
|
||||
| None ->
|
||||
if debug
|
||||
then Format.eprintf "%a@.F-expr failure.@." Location.print_loc loc;
|
||||
Format.eprintf "%a@.F-expr failure.@." Location.print_loc loc;
|
||||
assert false
|
||||
| Some expr -> eval_expr prims env expr)
|
||||
| func_value ->
|
||||
@ -761,7 +760,7 @@ and eval_structitem prims env it =
|
||||
with Not_found ->
|
||||
ptr @@ Prim
|
||||
(fun _ ->
|
||||
if debug then Format.eprintf "%a@." Location.print_loc loc;
|
||||
Format.eprintf "%a@." Location.print_loc loc;
|
||||
failwith ("Unimplemented primitive " ^ prim_name))
|
||||
in
|
||||
env_set_value name prim env
|
||||
|
Loading…
x
Reference in New Issue
Block a user