예제 #1
0
        /// <summary>
        /// Decompile the specified expression, given the network, process, method, and statement
        /// </summary>
        /// <param name="network">The top-level network.</param>
        /// <param name="proc">The process where the method is located.</param>
        /// <param name="method">The method where the statement is found.</param>
        /// <param name="statement">The statement where the expression is found.</param>
        /// <param name="expression">The expression to decompile</param>
        protected ConditionalExpression Decompile(NetworkState network, ProcessState proc, MethodState method, Statement statement, ICSharpCode.Decompiler.CSharp.Syntax.ConditionalExpression expression)
        {
            var res = new ConditionalExpression()
            {
                SourceResultType    = ResolveExpressionType(network, proc, method, statement, expression),
                SourceExpression    = expression,
                ConditionExpression = Decompile(network, proc, method, statement, expression.Condition),
                TrueExpression      = Decompile(network, proc, method, statement, expression.TrueExpression),
                FalseExpression     = Decompile(network, proc, method, statement, expression.FalseExpression),
                Parent = statement
            };

            res.ConditionExpression.Parent = res;
            res.TrueExpression.Parent      = res;
            res.FalseExpression.Parent     = res;

            return(res);
        }
예제 #2
0
        protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
        {
            ConditionalExpression o = other as ConditionalExpression;

            return(o != null && this.Condition.DoMatch(o.Condition, match) && this.TrueExpression.DoMatch(o.TrueExpression, match) && this.FalseExpression.DoMatch(o.FalseExpression, match));
        }