don't use print_stack in repl

master
Daniel Kolesa 2021-05-10 01:16:27 +02:00
parent 1739cbed6e
commit a8d2bfc442
3 changed files with 10 additions and 6 deletions

View File

@ -349,7 +349,7 @@ float_type any_value::get_float() const {
case value_type::FLOAT: case value_type::FLOAT:
return p_stor.f; return p_stor.f;
case value_type::INTEGER: case value_type::INTEGER:
return p_stor.i; return float_type(p_stor.i);
case value_type::STRING: case value_type::STRING:
return parse_float(str_managed_view(p_stor.s)); return parse_float(str_managed_view(p_stor.s));
default: default:

View File

@ -172,7 +172,7 @@ bool exec_alias(
auto oldflags = ts.ident_flags; auto oldflags = ts.ident_flags;
ts.ident_flags = aast.flags; ts.ident_flags = aast.flags;
any_value cv; any_value cv;
cv.set_integer(callargs); cv.set_integer(integer_type(callargs));
anargs->set_raw_value(*ts.pstate, std::move(cv)); anargs->set_raw_value(*ts.pstate, std::move(cv));
ident_link aliaslink = {a, ts.callstack, uargs}; ident_link aliaslink = {a, ts.callstack, uargs};
ts.callstack = &aliaslink; ts.callstack = &aliaslink;

View File

@ -253,10 +253,14 @@ static bool do_call(cs::state &cs, std::string_view line, bool file = false) {
std::printf( std::printf(
"%s%s\n", !is_lnum ? "stdin: " : "stdin:", e.what().data() "%s%s\n", !is_lnum ? "stdin: " : "stdin:", e.what().data()
); );
if (e.stack()) { std::size_t pindex = 1;
std::string str; for (auto *nd = e.stack(); nd; nd = nd->next) {
cs::print_stack(std::back_inserter(str), e.stack()); std::printf(" ");
std::printf("%s\n", str.data()); if ((nd->index == 1) && (pindex > 2)) {
std::printf("..");
}
pindex = nd->index;
std::printf("%zu) %s\n", nd->index, nd->id->name().data());
} }
return false; return false;
} }