trace flag when needed

This commit is contained in:
adelaett 2023-04-03 10:56:13 +02:00
parent 2a50a06b36
commit cc1c018818
2 changed files with 12 additions and 8 deletions

View File

@ -132,11 +132,13 @@ let merge_defaults
let tag_with_log_entry
(e : 'm Ast.expr boxed)
(_l : log_entry)
(_markings : Uid.MarkedString.info list) : 'm Ast.expr boxed =
let _m = mark_tany (Marked.get_mark e) (Expr.pos e) in
(* Expr.eapp (Expr.eop (Log (l, markings)) [TAny, Expr.pos e] m) [e] m *)
e
(l : log_entry)
(markings : Uid.MarkedString.info list) : 'm Ast.expr boxed =
let m = mark_tany (Marked.get_mark e) (Expr.pos e) in
if !Cli.trace_flag then
Expr.eapp (Expr.eop (Log (l, markings)) [TAny, Expr.pos e] m) [e] m
else e
(* In a list of exceptions, it is normally an error if more than a single one
apply at the same time. This relaxes this constraint slightly, allowing a

View File

@ -36,9 +36,11 @@ let tag_with_log_entry
(e : untyped Ast.expr boxed)
(l : log_entry)
(markings : Uid.MarkedString.info list) : untyped Ast.expr boxed =
Expr.eapp
(Expr.eop (Log (l, markings)) [TAny, Expr.pos e] (Marked.get_mark e))
[e] (Marked.get_mark e)
if !Cli.trace_flag then
Expr.eapp
(Expr.eop (Log (l, markings)) [TAny, Expr.pos e] (Marked.get_mark e))
[e] (Marked.get_mark e)
else e
let rec translate_expr (ctx : ctx) (e : Desugared.Ast.expr) :
untyped Ast.expr boxed =