diff --git a/decompiler/backend/variabledeclarations.py b/decompiler/backend/variabledeclarations.py index 4209b3c4b..fb53b8ac9 100644 --- a/decompiler/backend/variabledeclarations.py +++ b/decompiler/backend/variabledeclarations.py @@ -69,12 +69,14 @@ def _get_global_variables_and_constants(asts: Iterable[AbstractSyntaxTree]) -> t global_variables = InsertionOrderedSet() extern_constants = InsertionOrderedSet() + # if this gets more complex, a visitor pattern should perhaps be used instead def handle_obj(obj: DataflowObject): match obj: case GlobalVariable(): global_variables.add(obj) if isinstance(obj.initial_value, Expression): - handle_obj(obj.initial_value) + for subexpression in obj.initial_value.subexpressions(): + handle_obj(subexpression) case ExternConstant(): extern_constants.add(obj)