[decompiler] fix missing casts issue (#573)

* fix casts issue

* fix bug

* one last small fix
This commit is contained in:
water111
2021-06-09 21:35:13 -04:00
committed by GitHub
parent 12d72c7897
commit 92afd62e2c
102 changed files with 340 additions and 528 deletions
+9
View File
@@ -1645,6 +1645,12 @@ CastElement::CastElement(TypeSpec type, Form* source, bool numeric)
}
goos::Object CastElement::to_form_internal(const Env& env) const {
auto atom = form_as_atom(m_source);
if (atom && atom->is_var()) {
return pretty_print::build_list(
m_numeric ? "the" : "the-as", m_type.print(),
atom->var().to_form(env, RegisterAccess::Print::AS_VARIABLE_NO_CAST));
}
return pretty_print::build_list(m_numeric ? "the" : "the-as", m_type.print(),
m_source->to_form(env));
}
@@ -2173,6 +2179,9 @@ void LetElement::apply_form(const std::function<void(Form*)>& f) {
void LetElement::collect_vars(RegAccessSet& vars, bool recursive) const {
for (auto& entry : m_entries) {
vars.insert(entry.dest);
if (recursive) {
entry.src->collect_vars(vars, recursive);
}
}
m_body->collect_vars(vars, recursive);
}