From 80526dfca013008f0e321fd7383a3070a40e6990 Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Fri, 16 Sep 2022 23:40:16 -0400 Subject: [PATCH] [decompiler] fix local_vars assert on static lambda (#1895) Fixes a crash when there's a `(new 'static 'something :field )`. The output will now be ``` (set! *duck-mods* (new 'static 'surface :name 'duck ... :mult-hook :flags (surface-flag duck) ) ``` fixes https://github.com/open-goal/jak-project/issues/1882 --- decompiler/util/data_decompile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/decompiler/util/data_decompile.cpp b/decompiler/util/data_decompile.cpp index 28d7f7f570..8850da6dd8 100644 --- a/decompiler/util/data_decompile.cpp +++ b/decompiler/util/data_decompile.cpp @@ -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); } }