fix: show #eval errors

This commit is contained in:
Sebastian Ullrich 2019-10-18 13:10:13 +02:00
parent 7c56754495
commit 9b55687597
2 changed files with 10 additions and 4 deletions

View file

@ -357,17 +357,23 @@ static environment eval_cmd(parser & p) {
// run `IO Unit`
object * args[] = { io_mk_world() };
object_ref r;
if (p.profiling()) {
timeit timer(out.get_text_stream().get_stream(), "eval time");
// NOTE: no need to free `()`
ir::run_boxed(new_env, fn_name, &args[0]);
r = object_ref(ir::run_boxed(new_env, fn_name, &args[0]));
} else {
ir::run_boxed(new_env, fn_name, &args[0]);
r = object_ref(ir::run_boxed(new_env, fn_name, &args[0]));
}
std::cout.rdbuf(saved_cout);
out.report();
if (io_result_is_error(r.raw())) {
message_builder msg = p.mk_message(p.cmd_pos(), p.pos(), ERROR);
msg << string_to_std(io_result_get_error(r.raw()));
msg.report();
}
return p.env();
}

View file

@ -1,4 +1,4 @@
import init.lean.parser.command
import Init.Lean.Parser.Command
open Lean
open Lean.Parser