[decompiler] fix local_vars assert on static lambda (#1895)

Fixes a crash when there's a `(new 'static 'something :field <some
anonymous function with a particular set of errors in the decompler>)`.
The output will now be
```
 (set! *duck-mods* (new 'static 'surface
                      :name 'duck
...
                      :mult-hook <lambda at L615>
                      :flags (surface-flag duck)
                      )
```

fixes https://github.com/open-goal/jak-project/issues/1882
This commit is contained in:
water111
2022-09-16 23:40:16 -04:00
committed by GitHub
parent 6a1bde4168
commit 80526dfca0
+2 -1
View File
@@ -163,7 +163,8 @@ goos::Object decompile_function_at_label(const DecompilerLabel& label,
const LinkedObjectFile* file) {
if (file) {
auto other_func = file->try_get_function_at_label(label);
if (other_func) {
if (other_func && other_func->ir2.env.has_local_vars() && other_func->ir2.top_form &&
other_func->ir2.expressions_succeeded) {
return final_output_lambda(*other_func);
}
}