Beispiel #1
0
 public override OperatorMethod Lift(CSharpOperators operators)
 {
     if (Type == TypeCode.Object || Type == TypeCode.String)
     {
         return(null);
     }
     else
     {
         return(new LiftedEqualityOperatorMethod(operators, this));
     }
 }
Beispiel #2
0
            public LambdaBinaryOperatorMethod(CSharpOperators operators, Func <T1, T2, T1> checkedFunc, Func <T1, T2, T1> uncheckedFunc)
                : base(operators.compilation)
            {
                TypeCode t1 = Type.GetTypeCode(typeof(T1));

                this.ReturnType = operators.compilation.FindType(t1);
                this.Parameters.Add(operators.MakeParameter(t1));
                this.Parameters.Add(operators.MakeParameter(Type.GetTypeCode(typeof(T2))));
                this.checkedFunc   = checkedFunc;
                this.uncheckedFunc = uncheckedFunc;
            }
Beispiel #3
0
        /// <summary>
        /// Gets the CSharpOperators instance for the specified <see cref="ICompilation"/>.
        /// This will make use of the context's cache manager (if available) to reuse the CSharpOperators instance.
        /// </summary>
        public static CSharpOperators Get(ICompilation compilation)
        {
            CacheManager    cache     = compilation.CacheManager;
            CSharpOperators operators = (CSharpOperators)cache.GetShared(typeof(CSharpOperators));

            if (operators == null)
            {
                operators = (CSharpOperators)cache.GetOrAddShared(typeof(Conversions), new CSharpOperators(compilation));
            }
            return(operators);
        }
Beispiel #4
0
 public override OperatorMethod Lift(CSharpOperators operators)
 {
     return(new LiftedBinaryOperatorMethod(operators, this));
 }
Beispiel #5
0
 public LambdaBinaryOperatorMethod(CSharpOperators operators, Func <T1, T2, T1> func)
     : this(operators, func, func)
 {
 }
Beispiel #6
0
 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]));
 }
Beispiel #7
0
 public virtual OperatorMethod Lift(CSharpOperators operators)
 {
     return(null);
 }