mirror of
https://github.com/ZuneDev/ZuneUIXTools.git
synced 2026-07-27 13:11:59 -07:00
Slightly more intelligent way of detecting expressions that can also be statements
This commit is contained in:
@@ -77,9 +77,13 @@ partial class Decompiler
|
|||||||
|
|
||||||
case OpCode.DiscardValue:
|
case OpCode.DiscardValue:
|
||||||
var value = stack.Pop();
|
var value = stack.Pop();
|
||||||
if ((value is InvocationExpressionSyntax)
|
if (value is ExpressionSyntax expr)
|
||||||
&& methodBody.Skip(i).Any(m => m.OpCode is not (OpCode.DiscardValue or OpCode.ReturnValue)))
|
{
|
||||||
blockStack.Peek().Statements.Add(ExpressionStatement((ExpressionSyntax)value));
|
var lastStatement = blockStack.Peek().Statements[^1];
|
||||||
|
|
||||||
|
if (!lastStatement.DescendantNodes().Any(n => n.IsEquivalentTo(expr)))
|
||||||
|
blockStack.Peek().Statements.Add(ExpressionStatement(expr));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpCode.LookupSymbol:
|
case OpCode.LookupSymbol:
|
||||||
|
|||||||
Reference in New Issue
Block a user