MakeTypesCompatible() public static method

public static MakeTypesCompatible ( Expression e1, Expression e2, Expression &oute1, Expression &oute2, TokenType operation ) : void
e1 System.Linq.Expressions.Expression
e2 System.Linq.Expressions.Expression
oute1 System.Linq.Expressions.Expression
oute2 System.Linq.Expressions.Expression
operation TokenType
return void
Example #1
0
        public Expression Condition(Expression arg1, Expression arg2, Expression arg3, Token start, Token qmark)
        {
            var type2 = arg2.Type;
            var type3 = arg3.Type;

            TypeAdapter.MakeTypesCompatible(arg2, arg3, out arg2, out arg3, qmark.Type);
            Wall.Cond(arg1, arg2, arg3, type2, type3, start.Location, qmark.Location);

            return(Expression.Condition(arg1, arg2, arg3));
        }
Example #2
0
        public Expression Equal(Expression arg1, Expression arg2, Token oper)
        {
            var type1 = arg1.Type;
            var type2 = arg2.Type;

            TypeAdapter.MakeTypesCompatible(arg1, arg2, out arg1, out arg2, oper.Type);
            Wall.Eq(arg1, arg2, type1, type2, oper);

            try
            {
                return(Expression.Equal(arg1, arg2));
            }
            catch
            {
                throw new ParseErrorException(MakeInvalidTypesError(oper, type1, type2), ExprString, oper.Location);
            }
        }