public override OperatorMethod Lift(CppOperators operators) { var lifted = new LiftedBinaryOperatorMethod(operators, this); lifted.ReturnType = this.ReturnType; // don't lift the return type for relational operators return(lifted); }
public RelationalOperatorMethod(CppOperators operators, Func <T1, T2, bool> func) : base(operators.compilation) { this.ReturnType = operators.compilation.FindType(KnownTypeCode.Boolean); this.Parameters.Add(operators.MakeParameter(Type.GetTypeCode(typeof(T1)))); this.Parameters.Add(operators.MakeParameter(Type.GetTypeCode(typeof(T2)))); this.func = func; }
public StringConcatenation(CppOperators operators, TypeCode p1, TypeCode p2) : base(operators.compilation) { this.canEvaluateAtCompileTime = p1 == TypeCode.String && p2 == TypeCode.String; this.ReturnType = operators.compilation.FindType(KnownTypeCode.String); this.Parameters.Add(operators.MakeParameter(p1)); this.Parameters.Add(operators.MakeParameter(p2)); }
public LiftedBinaryOperatorMethod(CppOperators operators, BinaryOperatorMethod baseMethod) : base(operators.compilation) { this.baseMethod = baseMethod; this.ReturnType = NullableType.Create(operators.compilation, baseMethod.ReturnType); this.Parameters.Add(operators.MakeNullableParameter(baseMethod.Parameters[0])); this.Parameters.Add(operators.MakeNullableParameter(baseMethod.Parameters[1])); }
public EqualityOperatorMethod(CppOperators operators, TypeCode type, bool negate) : base(operators.compilation) { this.Negate = negate; this.Type = type; this.ReturnType = operators.compilation.FindType(KnownTypeCode.Boolean); this.Parameters.Add(operators.MakeParameter(type)); this.Parameters.Add(operators.MakeParameter(type)); }
public LambdaUnaryOperatorMethod(CppOperators operators, Func <T, T> func) : base(operators.compilation) { TypeCode typeCode = Type.GetTypeCode(typeof(T)); this.ReturnType = operators.compilation.FindType(typeCode); this.Parameters.Add(operators.MakeParameter(typeCode)); this.func = func; }
public LiftedEqualityOperatorMethod(CppOperators operators, EqualityOperatorMethod baseMethod) : base(operators.compilation) { this.baseMethod = baseMethod; this.ReturnType = baseMethod.ReturnType; IParameter p = operators.MakeNullableParameter(baseMethod.Parameters[0]); this.Parameters.Add(p); this.Parameters.Add(p); }
public override OperatorMethod Lift(CppOperators operators) { if (Type == TypeCode.Object || Type == TypeCode.String) { return(null); } else { return(new LiftedEqualityOperatorMethod(operators, this)); } }
public LambdaBinaryOperatorMethod(CppOperators 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; }
/// <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 CppOperators Get(ICompilation compilation) { CacheManager cache = compilation.CacheManager; CppOperators operators = (CppOperators)cache.GetShared(typeof(CppOperators)); if (operators == null) { operators = (CppOperators)cache.GetOrAddShared(typeof(Conversions), new CppOperators(compilation)); } return(operators); }
public override OperatorMethod Lift(CppOperators operators) { return(new LiftedBinaryOperatorMethod(operators, this)); }
public LambdaBinaryOperatorMethod(CppOperators operators, Func <T1, T2, T1> func) : this(operators, func, func) { }
public virtual OperatorMethod Lift(CppOperators operators) { return(null); }