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:
|
||||
var value = stack.Pop();
|
||||
if ((value is InvocationExpressionSyntax)
|
||||
&& methodBody.Skip(i).Any(m => m.OpCode is not (OpCode.DiscardValue or OpCode.ReturnValue)))
|
||||
blockStack.Peek().Statements.Add(ExpressionStatement((ExpressionSyntax)value));
|
||||
if (value is ExpressionSyntax expr)
|
||||
{
|
||||
var lastStatement = blockStack.Peek().Statements[^1];
|
||||
|
||||
if (!lastStatement.DescendantNodes().Any(n => n.IsEquivalentTo(expr)))
|
||||
blockStack.Peek().Statements.Add(ExpressionStatement(expr));
|
||||
}
|
||||
break;
|
||||
|
||||
case OpCode.LookupSymbol:
|
||||
|
||||
Reference in New Issue
Block a user