get rid of cycle check from push_arg

master
Daniel Kolesa 2021-03-29 23:42:08 +02:00
parent 47f24d6e2e
commit 9e82dc0d2f
2 changed files with 8 additions and 8 deletions

View File

@ -115,12 +115,6 @@ alias_impl::alias_impl(state &cs, string_ref name, any_value v, int fl):
}
void alias_impl::push_arg(any_value &v, ident_stack &st, bool um) {
if (p_astack == &st) {
/* prevent cycles and unnecessary code elsewhere */
p_val = std::move(v);
clean_code();
return;
}
st.val_s = std::move(p_val);
st.next = p_astack;
p_astack = &st;

View File

@ -451,8 +451,14 @@ bool stacked_value::push() {
if (!p_a) {
return false;
}
static_cast<alias_impl *>(p_a)->push_arg(*this, p_stack);
p_pushed = true;
if (!p_pushed) {
static_cast<alias_impl *>(p_a)->push_arg(*this, p_stack);
p_pushed = true;
} else {
static_cast<alias_impl *>(p_a)->p_val = std::move(
*static_cast<any_value *>(this)
);
}
return true;
}