/// <summary> /// Updates the block. /// </summary> /// <param name="block">The block.</param> /// <param name="commands">The commands.</param> /// <returns></returns> protected BlockCommand UpdateBlock(BlockCommand block, IList <Expression> commands) { if (block.Commands != commands) { return(new BlockCommand(commands)); } return(block); }
/// <summary> /// Compares the block. /// </summary> /// <param name="x">The x.</param> /// <param name="y">The y.</param> /// <returns></returns> protected virtual bool CompareBlock(BlockCommand x, BlockCommand y) { if (x.Commands.Count != y.Commands.Count) { return(false); } for (int i = 0, n = x.Commands.Count; i < n; i++) { if (!this.Compare(x.Commands[i], y.Commands[i])) { return(false); } } return(true); }
/// <summary> /// Visits the block. /// </summary> /// <param name="block">The block.</param> /// <returns></returns> protected virtual Expression VisitBlock(BlockCommand block) { var commands = this.VisitExpressionList(block.Commands); return(this.UpdateBlock(block, commands)); }