Example #1
0
        /// <summary>
        /// Visits if.
        /// </summary>
        /// <param name="ifx">The ifx.</param>
        /// <returns></returns>
        protected virtual Expression VisitIf(IFCommand ifx)
        {
            var check   = this.Visit(ifx.Check);
            var ifTrue  = this.Visit(ifx.IfTrue);
            var ifFalse = this.Visit(ifx.IfFalse);

            return(this.UpdateIf(ifx, check, ifTrue, ifFalse));
        }
Example #2
0
        /// <summary>
        /// Updates if.
        /// </summary>
        /// <param name="ifx">The ifx.</param>
        /// <param name="check">The check.</param>
        /// <param name="ifTrue">If true.</param>
        /// <param name="ifFalse">If false.</param>
        /// <returns></returns>
        protected IFCommand UpdateIf(IFCommand ifx, Expression check, Expression ifTrue, Expression ifFalse)
        {
            if (check != ifx.Check || ifTrue != ifx.IfTrue || ifFalse != ifx.IfFalse)
            {
                return(new IFCommand(check, ifTrue, ifFalse));
            }

            return(ifx);
        }
Example #3
0
 /// <summary>
 /// Compares if.
 /// </summary>
 /// <param name="x">The x.</param>
 /// <param name="y">The y.</param>
 /// <returns></returns>
 protected virtual bool CompareIf(IFCommand x, IFCommand y)
 {
     return(this.Compare(x.Check, y.Check) && this.Compare(x.IfTrue, y.IfTrue) && this.Compare(x.IfFalse, y.IfFalse));
 }