mirror of
https://github.com/open-goal/jak-project
synced 2026-08-10 19:17:55 -04:00
[decompiler] fix missing casts issue (#573)
* fix casts issue * fix bug * one last small fix
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user