Example #1
0
 public static If GetThrowIfIndicesNotEqual(Expression left, Int32 leftIndex, Expression right, Int32 rightIndex)
 {
     return(new If {
         Condition = new BinaryExpression {
             NodeType = NodeType.Ne,
             Operand1 = NodeHelper.GetConstantIndexerForExpression(left, leftIndex),
             Operand2 = NodeHelper.GetConstantIndexerForExpression(right, rightIndex)
         },
         TrueBlock = new Block {
             Statements = new StatementList(
                 NodeHelper.GetThrowFor(SystemTypes.ArgumentException)
                 )
         }
     });
 }
Example #2
0
 public static If GetThrowIfDimensionsNotEqual(Expression thisSize, Expression otherSize)
 {
     return(new If {
         Condition = new UnaryExpression {
             NodeType = NodeType.LogicalNot,
             Operand = new MethodCall {
                 Callee = new MemberBinding {
                     BoundMember = STANDARD.ComputeHelper.GetMethod(Identifier.For("AreDimensionsEqual"), SystemTypes.UInt64.GetArrayType(1), SystemTypes.UInt64.GetArrayType(1))
                 },
                 Operands = new ExpressionList(
                     thisSize,
                     otherSize
                     ),
             },
         },
         TrueBlock = new Block {
             Statements = new StatementList(
                 NodeHelper.GetThrowFor(SystemTypes.ArgumentException)
                 ),
         },
     });
 }