.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

19 lines
533 B

using System;
using System.Linq;
using ICSharpCode.NRefactory.CSharp;
namespace Decompiler.Transforms.Ast
{
public class RemoveEmptyElseBody: DepthFirstAstVisitor<object, object>
{
public override object VisitIfElseStatement(IfElseStatement ifElseStatement, object data)
{
base.VisitIfElseStatement(ifElseStatement, data);
BlockStatement block = ifElseStatement.FalseStatement as BlockStatement;
if (block != null && !block.Statements.Any()) {
ifElseStatement.FalseStatement = null;
}
return null;
}
}
}