@@ -19,40 +19,50 @@ function is_incomplete(prompt_state)
1919 end
2020end
2121
22- function eval_ish (mod, ex, do_eval)
22+ function eval_ish (mod, ex, do_eval, do_print_ir )
2323 k = kind (ex)
2424 if k == K " toplevel"
2525 x = nothing
2626 for e in children (ex)
27- x = eval_ish (mod, e, do_eval)
27+ x = eval_ish (mod, e, do_eval, do_print_ir )
2828 end
2929 return x
3030 end
3131 linear_ir = JuliaLowering. lower (mod, ex)
32- JuliaLowering. print_ir (stdout , linear_ir)
32+ if do_print_ir
33+ JuliaLowering. print_ir (stdout , linear_ir)
34+ end
3335 if do_eval
3436 println (stdout , " #----------------------" )
3537 expr_form = JuliaLowering. to_lowered_expr (mod, linear_ir)
3638 Base. eval (mod, expr_form)
3739 end
3840end
3941
42+ PRINT_IR:: Bool = true
4043DO_EVAL:: Bool = false
41- function opts (; do_eval= false )
44+ function opts (; do_eval= false , print_ir = false )
4245 global DO_EVAL = do_eval
46+ global PRINT_IR = print_ir
4347end
4448
4549function handle_input (str)
46- global DO_EVAL
50+ global DO_EVAL, PRINT_IR
4751 if str == " DO_EVAL"
4852 DO_EVAL = true
4953 return
5054 elseif str == " !DO_EVAL"
5155 DO_EVAL = false
5256 return
57+ elseif str == " PRINT_IR"
58+ PRINT_IR = true
59+ return
60+ elseif str == " !PRINT_IR"
61+ PRINT_IR = false
62+ return
5363 end
5464 ex = parseall (SyntaxTree, str; filename= " REPL" )
55- eval_ish (Main, ex, DO_EVAL)
65+ eval_ish (Main, ex, DO_EVAL, PRINT_IR )
5666end
5767
5868function init ()
@@ -69,3 +79,4 @@ function __init__()
6979end
7080
7181end
82+
0 commit comments