public Ast.Statements.BlockStatement Process(Decompiler.DecompilationContext context, Ast.Statements.BlockStatement body)
        {
            if (!new ExpressionTreesFinder().ContainsExpressionTree(body))
            {
                return body;
            }

            this.context = context;
            this.typeSystem = context.TypeContext.CurrentType.Module.TypeSystem;
            this.failure = false;
            BlockStatement clone = (BlockStatement)Visit(body.Clone());
            if (failure || usedVariables.Count == 0 || !TryRemoveUnusedVariableAssignments(clone))
            {
                return body;
            }
            clone = (BlockStatement)new ClosureVariablesRemover(context.MethodContext).Visit(clone);
            clone = new CombinedTransformerStep(){ Method = context.MethodContext.Method }.Process(context, clone);
            return clone;
        }
コード例 #2
0
        public Ast.Statements.BlockStatement Process(Decompiler.DecompilationContext context, Ast.Statements.BlockStatement body)
        {
            if (!new ExpressionTreesFinder().ContainsExpressionTree(body))
            {
                return(body);
            }

            this.context    = context;
            this.typeSystem = context.TypeContext.CurrentType.Module.TypeSystem;
            this.failure    = false;
            BlockStatement clone = (BlockStatement)Visit(body.Clone());

            if (failure || usedVariables.Count == 0 || !TryRemoveUnusedVariableAssignments(clone))
            {
                return(body);
            }
            clone = (BlockStatement) new ClosureVariablesRemover(context.MethodContext).Visit(clone);
            clone = new CombinedTransformerStep().Process(context, clone);
            return(clone);
        }