UndertaleModTool icon indicating copy to clipboard operation
UndertaleModTool copied to clipboard

Boolean expressions in function arguments are interpreted as a switch statement by the decompiler.

Open BenjaminUrquhart opened this issue 4 years ago • 1 comments

Sample code (the expression must not be the last or only argument):

draw_sprite(0, a == 1 || a == 2, 0, 0)
instance_find(a == 1 || a == 2, 0)
EXCEPTION!
   System.Exception: Malformed switch statement: bad condition var (a)
   at UndertaleModLib.Decompiler.Decompiler.HLDecompileBlocks(DecompileContext context, Block& block, Dictionary`2 blocks, Dictionary`2 loops, Dictionary`2 reverseDominators, List`1 alreadyVisited, Block currentLoop, Block stopAt, Block breakTo, Boolean decompileTheLoop, UInt32 depth) in C:\Users\benja\source\repos\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 2715
   at UndertaleModLib.Decompiler.Decompiler.HLDecompile(DecompileContext context, Dictionary`2 blocks, Block entryPoint, Block rootExitPoint) in C:\Users\benja\source\repos\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 2873
   at UndertaleModLib.Decompiler.Decompiler.Decompile(UndertaleCode code, DecompileContext context) in C:\Users\benja\source\repos\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 2986
   at UndertaleModTool.UndertaleCodeEditor.<>c__DisplayClass24_1.<DecompileCode>b__1() in C:\Users\benja\source\repos\UndertaleModTool\UndertaleModTool\Editors\UndertaleCodeEditor.xaml.cs:line 319

BenjaminUrquhart avatar May 13 '21 21:05 BenjaminUrquhart

See also #256.

Jacky720 avatar Feb 19 '24 18:02 Jacky720