[decomp] Small fixes (#541)

* fix a few bugs

* fix local vars missing in top level

* more small fixes

* support missing inline array access case

* one more fix
This commit is contained in:
water111
2021-05-30 19:57:11 -04:00
committed by GitHub
parent c910a22c1b
commit b1a76b2291
32 changed files with 298 additions and 117 deletions
+18
View File
@@ -173,6 +173,15 @@ std::string write_from_top_level(const Function& top_level,
}
std::string result;
// local vars:
int var_count = 0;
auto var_dec = env.local_var_type_list(top_level.ir2.top_form, 0, &var_count);
if (var_count > 0) {
result += pretty_print::to_string(var_dec);
result += '\n';
result += '\n';
}
// look for the whole thing being in a (when *debug-segment* ....)
bool in_debug_only_file = false;
if (forms.size() == 1) {
@@ -341,6 +350,15 @@ std::string write_from_top_level(const Function& top_level,
}
}
if (!something_matched) {
auto empty = dynamic_cast<EmptyElement*>(x);
if (empty) {
something_matched = true;
} else if (!x->active()) {
something_matched = true;
}
}
if (!something_matched) {
result += ";; failed to figure out what this is:\n";
result += pretty_print::to_string(x->to_form(env));