protected OperatorImplementation AddConverter(Type fromType, Type toType, UnaryOperatorMethod method)
 {
     var key = new OperatorDispatchKey(ExpressionType.ConvertChecked, fromType, toType);
     var impl = new OperatorImplementation(key, toType, method);
     OperatorImplementations[key] = impl;
     return impl;
 }
 protected OperatorImplementation AddBinary(ExpressionType op, Type commonType, 
                  BinaryOperatorMethod binaryMethod, UnaryOperatorMethod resultConverter) {
   var key = new OperatorDispatchKey(op, commonType, commonType);
   var impl = new OperatorImplementation(key, commonType, binaryMethod, null, null, resultConverter);
   OperatorImplementations[key] = impl;
   return impl;
 }
        protected OperatorImplementation AddConverter(Type fromType, Type toType, UnaryOperatorMethod method)
        {
            var key  = new OperatorDispatchKey(ExpressionType.ConvertChecked, fromType, toType);
            var impl = new OperatorImplementation(key, toType, method);

            OperatorImplementations[key] = impl;
            return(impl);
        }
Exemplo n.º 4
0
 public OperatorImplementation(OperatorDispatchKey key, Type type, UnaryOperatorMethod method)
 {
     Key              = key;
     CommonType       = type;
     Arg1Converter    = method;
     Arg2Converter    = null;
     ResultConverter  = null;
     BaseBinaryMethod = null;
 }
Exemplo n.º 5
0
        protected OperatorImplementation AddBinary(ExpressionType op, Type commonType, BinaryOperatorMethod binaryMethod,
                                                   UnaryOperatorMethod resultConverter)
        {
            var key  = new OperatorDispatchKey(op, commonType, commonType);
            var impl = new OperatorImplementation(key, commonType, binaryMethod, null, null, resultConverter);

            OperatorImplementations[key] = impl;
            return(impl);
        }
Exemplo n.º 6
0
 public OperatorImplementation(OperatorDispatchKey key, Type resultType, BinaryOperatorMethod baseBinaryMethod,
                               UnaryOperatorMethod arg1Converter, UnaryOperatorMethod arg2Converter, UnaryOperatorMethod resultConverter)
 {
     Key              = key;
     CommonType       = resultType;
     Arg1Converter    = arg1Converter;
     Arg2Converter    = arg2Converter;
     ResultConverter  = resultConverter;
     BaseBinaryMethod = baseBinaryMethod;
     SetupEvaluationMethod();
 }
Exemplo n.º 7
0
        protected virtual OperatorImplementation CreateBinaryOperatorImplementation(ExpressionType op, Type arg1Type, Type arg2Type,
                                                                                    Type commonType, BinaryOperatorMethod method, UnaryOperatorMethod resultConverter)
        {
            OperatorDispatchKey key           = new OperatorDispatchKey(op, arg1Type, arg2Type);
            UnaryOperatorMethod arg1Converter = arg1Type == commonType ? null : GetConverter(arg1Type, commonType);
            UnaryOperatorMethod arg2Converter = arg2Type == commonType ? null : GetConverter(arg2Type, commonType);
            var impl = new OperatorImplementation(
                key, commonType, method, arg1Converter, arg2Converter, resultConverter);

            return(impl);
        }
 public LiftedUnaryOperatorMethod(CSharpOperators operators, UnaryOperatorMethod baseMethod) : base(operators.compilation)
 {
     this.baseMethod = baseMethod;
     this.ReturnType = NullableType.Create(baseMethod.Compilation, baseMethod.ReturnType);
     this.Parameters.Add(operators.MakeNullableParameter(baseMethod.Parameters[0]));
 }
 protected OperatorImplementation AddUnary(ExpressionType op, Type commonType, UnaryOperatorMethod unaryMethod) {
   var key = new OperatorDispatchKey(op, commonType);
   var impl = new OperatorImplementation(key, commonType, null, unaryMethod, null, null);
   OperatorImplementations[key] = impl;
   return impl;
 }
 protected virtual OperatorImplementation CreateBinaryOperatorImplementation(ExpressionType op, Type arg1Type, Type arg2Type, 
                Type commonType, BinaryOperatorMethod method, UnaryOperatorMethod resultConverter) {
   OperatorDispatchKey key = new OperatorDispatchKey(op, arg1Type, arg2Type);
   UnaryOperatorMethod arg1Converter = arg1Type == commonType ? null : GetConverter(arg1Type, commonType);
   UnaryOperatorMethod arg2Converter = arg2Type == commonType ? null : GetConverter(arg2Type, commonType);
   var impl = new OperatorImplementation(
     key, commonType, method, arg1Converter, arg2Converter, resultConverter);
   return impl; 
 }
        protected OperatorImplementation AddUnary(ExpressionType op, Type commonType, UnaryOperatorMethod unaryMethod)
        {
            var key  = new OperatorDispatchKey(op, commonType);
            var impl = new OperatorImplementation(key, commonType, null, unaryMethod, null, null);

            OperatorImplementations[key] = impl;
            return(impl);
        }