mirror of
https://github.com/open-goal/jak-project
synced 2026-07-07 14:13:45 -04:00
[decompiler] Several small fixes (#775)
* fix assorted bugs * stricter return types * only look for functions in code files
This commit is contained in:
@@ -84,8 +84,31 @@ bool convert_to_expressions(
|
||||
}
|
||||
}
|
||||
|
||||
bool needs_cast = false;
|
||||
if (!dts.ts.tc(f.type.last_arg(), return_type)) {
|
||||
// we need to cast the final value.
|
||||
needs_cast = true;
|
||||
|
||||
} else {
|
||||
bool found_early_return = false;
|
||||
for (auto e : new_entries) {
|
||||
e->apply([&](FormElement* elt) {
|
||||
auto as_ret = dynamic_cast<ReturnElement*>(elt);
|
||||
if (as_ret) {
|
||||
found_early_return = true;
|
||||
}
|
||||
});
|
||||
if (found_early_return) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found_early_return && f.type.last_arg() != return_type) {
|
||||
needs_cast = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (needs_cast) {
|
||||
auto to_cast = new_entries.back();
|
||||
auto as_cast = dynamic_cast<CastElement*>(to_cast);
|
||||
if (as_cast) {
|
||||
|
||||
Reference in New Issue
Block a user