1 // --------------------------------------------------------------------------- 2 // Copyright (C) 2005 Microsoft Corporation All Rights Reserved 3 // --------------------------------------------------------------------------- 4 5 #define CODE_ANALYSIS 6 using System.CodeDom; 7 using System.Collections.Generic; 8 using System.Diagnostics.CodeAnalysis; 9 using System.Globalization; 10 using System.Reflection; 11 using System.Workflow.ComponentModel; 12 using System.Workflow.ComponentModel.Compiler; 13 using System.Workflow.Activities.Common; 14 15 namespace System.Workflow.Activities.Rules 16 { 17 #region ArithmeticLiteral Class 18 internal abstract class ArithmeticLiteral 19 { 20 #region Properties 21 /// <summary> 22 /// The type of the literal 23 /// </summary> 24 internal protected Type m_type; 25 26 /// <summary> 27 /// Return the name of the type 28 /// </summary> 29 protected virtual string TypeName 30 { 31 get { return m_type.FullName; } 32 } 33 34 /// <summary> 35 /// Get the boxed literal 36 /// </summary> 37 internal abstract object Value { get; } 38 39 /// <summary> 40 /// A delegate for literal factory methods 41 /// </summary> 42 /// <param name="literalValue"></param> 43 /// <returns></returns> LiteralMaker(object literalValue)44 private delegate ArithmeticLiteral LiteralMaker(object literalValue); 45 46 /// <summary> 47 /// Collection of literal factory methods indexed by type 48 /// </summary> 49 private static Dictionary<Type, LiteralMaker> types = CreateTypesDictionary(); 50 51 /// <summary> 52 /// Group types by characteristics so we can check if operation is allowed 53 /// </summary> 54 [Flags()] 55 private enum TypeFlags 56 { 57 UInt16 = 0x01, 58 Int32 = 0x02, 59 UInt32 = 0x04, 60 Int64 = 0x08, 61 UInt64 = 0x10, 62 Single = 0x20, 63 Double = 0x40, 64 Decimal = 0x80, 65 Boolean = 0x100, 66 String = 0x800, 67 Nullable = 0x10000 68 }; 69 70 /// <summary> 71 /// Collection of TypeFlags for the supported value types indexed by type 72 /// </summary> 73 private static Dictionary<Type, TypeFlags> supportedTypes = CreateSupportedTypesDictionary(); 74 CreateTypesDictionary()75 private static Dictionary<Type, LiteralMaker> CreateTypesDictionary() 76 { 77 // Create the literal class factory delegates 78 Dictionary<Type, LiteralMaker> dictionary = new Dictionary<Type, LiteralMaker>(16); 79 dictionary.Add(typeof(byte), MakeByte); 80 dictionary.Add(typeof(sbyte), MakeSByte); 81 dictionary.Add(typeof(char), MakeChar); 82 dictionary.Add(typeof(short), MakeShort); 83 dictionary.Add(typeof(int), MakeInt); 84 dictionary.Add(typeof(long), MakeLong); 85 dictionary.Add(typeof(ushort), MakeUShort); 86 dictionary.Add(typeof(uint), MakeUInt); 87 dictionary.Add(typeof(ulong), MakeULong); 88 dictionary.Add(typeof(float), MakeFloat); 89 dictionary.Add(typeof(double), MakeDouble); 90 dictionary.Add(typeof(decimal), MakeDecimal); 91 dictionary.Add(typeof(bool), MakeBoolean); 92 dictionary.Add(typeof(string), MakeString); 93 94 dictionary.Add(typeof(byte?), MakeByte); 95 dictionary.Add(typeof(sbyte?), MakeSByte); 96 dictionary.Add(typeof(char?), MakeChar); 97 dictionary.Add(typeof(short?), MakeShort); 98 dictionary.Add(typeof(int?), MakeInt); 99 dictionary.Add(typeof(long?), MakeLong); 100 dictionary.Add(typeof(ushort?), MakeUShort); 101 dictionary.Add(typeof(uint?), MakeUInt); 102 dictionary.Add(typeof(ulong?), MakeULong); 103 dictionary.Add(typeof(float?), MakeFloat); 104 dictionary.Add(typeof(double?), MakeDouble); 105 dictionary.Add(typeof(decimal?), MakeDecimal); 106 dictionary.Add(typeof(bool?), MakeBoolean); 107 return dictionary; 108 } 109 CreateSupportedTypesDictionary()110 static private Dictionary<Type, TypeFlags> CreateSupportedTypesDictionary() 111 { 112 Dictionary<Type, TypeFlags> dictionary = new Dictionary<Type, TypeFlags>(26); 113 dictionary.Add(typeof(byte), TypeFlags.UInt16); 114 dictionary.Add(typeof(byte?), TypeFlags.Nullable | TypeFlags.UInt16); 115 dictionary.Add(typeof(sbyte), TypeFlags.Int32); 116 dictionary.Add(typeof(sbyte?), TypeFlags.Nullable | TypeFlags.Int32); 117 dictionary.Add(typeof(char), TypeFlags.UInt16); 118 dictionary.Add(typeof(char?), TypeFlags.Nullable | TypeFlags.UInt16); 119 dictionary.Add(typeof(short), TypeFlags.Int32); 120 dictionary.Add(typeof(short?), TypeFlags.Nullable | TypeFlags.Int32); 121 dictionary.Add(typeof(int), TypeFlags.Int32); 122 dictionary.Add(typeof(int?), TypeFlags.Nullable | TypeFlags.Int32); 123 dictionary.Add(typeof(long), TypeFlags.Int64); 124 dictionary.Add(typeof(long?), TypeFlags.Nullable | TypeFlags.Int64); 125 dictionary.Add(typeof(ushort), TypeFlags.UInt16); 126 dictionary.Add(typeof(ushort?), TypeFlags.Nullable | TypeFlags.UInt16); 127 dictionary.Add(typeof(uint), TypeFlags.UInt32); 128 dictionary.Add(typeof(uint?), TypeFlags.Nullable | TypeFlags.UInt32); 129 dictionary.Add(typeof(ulong), TypeFlags.UInt64); 130 dictionary.Add(typeof(ulong?), TypeFlags.Nullable | TypeFlags.UInt64); 131 dictionary.Add(typeof(float), TypeFlags.Single); 132 dictionary.Add(typeof(float?), TypeFlags.Nullable | TypeFlags.Single); 133 dictionary.Add(typeof(double), TypeFlags.Double); 134 dictionary.Add(typeof(double?), TypeFlags.Nullable | TypeFlags.Double); 135 dictionary.Add(typeof(decimal), TypeFlags.Decimal); 136 dictionary.Add(typeof(decimal?), TypeFlags.Nullable | TypeFlags.Decimal); 137 dictionary.Add(typeof(bool), TypeFlags.Boolean); 138 dictionary.Add(typeof(bool?), TypeFlags.Nullable | TypeFlags.Boolean); 139 dictionary.Add(typeof(string), TypeFlags.String); 140 return dictionary; 141 } 142 #endregion 143 144 #region Factory Methods MakeLiteral(Type literalType, object literalValue)145 internal static ArithmeticLiteral MakeLiteral(Type literalType, object literalValue) 146 { 147 LiteralMaker f; 148 if (literalValue == null) 149 return new NullArithmeticLiteral(literalType); 150 return (types.TryGetValue(literalType, out f)) ? f(literalValue) : null; 151 } 152 153 /// <summary> 154 /// Factory function for a byte type 155 /// </summary> 156 /// <param name="literalValue"></param> 157 /// <returns></returns> MakeByte(object literalValue)158 private static ArithmeticLiteral MakeByte(object literalValue) 159 { 160 return new UShortArithmeticLiteral((byte)literalValue); 161 } 162 163 /// <summary> 164 /// Factory function for a sbyte type 165 /// </summary> 166 /// <param name="literalValue"></param> 167 /// <returns></returns> MakeSByte(object literalValue)168 private static ArithmeticLiteral MakeSByte(object literalValue) 169 { 170 return new IntArithmeticLiteral((sbyte)literalValue); 171 } 172 173 /// <summary> 174 /// Factory function for a char type 175 /// </summary> 176 /// <param name="literalValue"></param> 177 /// <returns></returns> MakeChar(object literalValue)178 private static ArithmeticLiteral MakeChar(object literalValue) 179 { 180 char c = (char)literalValue; 181 return new CharArithmeticLiteral(c); 182 } 183 184 /// <summary> 185 /// Factory function for a decimal type 186 /// </summary> 187 /// <param name="literalValue"></param> 188 /// <returns></returns> MakeDecimal(object literalValue)189 private static ArithmeticLiteral MakeDecimal(object literalValue) 190 { 191 return new DecimalArithmeticLiteral((decimal)literalValue); 192 } 193 194 /// <summary> 195 /// Factory function for an Int16 type 196 /// </summary> 197 /// <param name="literalValue"></param> 198 /// <returns></returns> MakeShort(object literalValue)199 private static ArithmeticLiteral MakeShort(object literalValue) 200 { 201 return new IntArithmeticLiteral((short)literalValue); 202 } 203 204 /// <summary> 205 /// Factory function for an Int32 type 206 /// </summary> 207 /// <param name="literalValue"></param> 208 /// <returns></returns> MakeInt(object literalValue)209 private static ArithmeticLiteral MakeInt(object literalValue) 210 { 211 return new IntArithmeticLiteral((int)literalValue); 212 } 213 214 /// <summary> 215 /// Factory function for an Int64 type 216 /// </summary> 217 /// <param name="literalValue"></param> 218 /// <returns></returns> MakeLong(object literalValue)219 private static ArithmeticLiteral MakeLong(object literalValue) 220 { 221 return new LongArithmeticLiteral((long)literalValue); 222 } 223 224 /// <summary> 225 /// Factory function for an UInt16 type 226 /// </summary> 227 /// <param name="literalValue"></param> 228 /// <returns></returns> MakeUShort(object literalValue)229 private static ArithmeticLiteral MakeUShort(object literalValue) 230 { 231 return new UShortArithmeticLiteral((ushort)literalValue); 232 } 233 234 /// <summary> 235 /// Factory function for an UInt32 type 236 /// </summary> 237 /// <param name="literalValue"></param> 238 /// <returns></returns> MakeUInt(object literalValue)239 private static ArithmeticLiteral MakeUInt(object literalValue) 240 { 241 return new UIntArithmeticLiteral((uint)literalValue); 242 } 243 244 /// <summary> 245 /// Factory function for an UInt64 type 246 /// </summary> 247 /// <param name="literalValue"></param> 248 /// <returns></returns> MakeULong(object literalValue)249 private static ArithmeticLiteral MakeULong(object literalValue) 250 { 251 return new ULongArithmeticLiteral((ulong)literalValue); 252 } 253 254 /// <summary> 255 /// Factory function for a float type 256 /// </summary> 257 /// <param name="literalValue"></param> 258 /// <returns></returns> MakeFloat(object literalValue)259 private static ArithmeticLiteral MakeFloat(object literalValue) 260 { 261 return new FloatArithmeticLiteral((float)literalValue); 262 } 263 264 /// <summary> 265 /// Factory function for a double type 266 /// </summary> 267 /// <param name="literalValue"></param> 268 /// <returns></returns> MakeDouble(object literalValue)269 private static ArithmeticLiteral MakeDouble(object literalValue) 270 { 271 return new DoubleArithmeticLiteral((double)literalValue); 272 } 273 274 /// <summary> 275 /// Factory function for a bool type 276 /// </summary> 277 /// <param name="literalValue"></param> 278 /// <returns></returns> MakeBoolean(object literalValue)279 private static ArithmeticLiteral MakeBoolean(object literalValue) 280 { 281 return new BooleanArithmeticLiteral((bool)literalValue); 282 } 283 284 /// <summary> 285 /// Factory function for a String type 286 /// </summary> 287 /// <param name="literalValue"></param> 288 /// <returns></returns> MakeString(object literalValue)289 private static ArithmeticLiteral MakeString(object literalValue) 290 { 291 return new StringArithmeticLiteral(literalValue.ToString()); 292 } 293 #endregion 294 295 #region Type Checking Methods 296 ResultType( CodeBinaryOperatorType operation, Type lhs, CodeExpression lhsExpression, Type rhs, CodeExpression rhsExpression, RuleValidation validator, out ValidationError error)297 internal static RuleBinaryExpressionInfo ResultType( 298 CodeBinaryOperatorType operation, 299 Type lhs, 300 CodeExpression lhsExpression, 301 Type rhs, 302 CodeExpression rhsExpression, 303 RuleValidation validator, 304 out ValidationError error) 305 { 306 // do we support the types natively? 307 TypeFlags lhsType, rhsType; 308 if (supportedTypes.TryGetValue(lhs, out lhsType) && supportedTypes.TryGetValue(rhs, out rhsType)) 309 { 310 Type resultType = ResultType(operation, lhsType, rhsType); 311 if (resultType != null) 312 { 313 error = null; 314 return new RuleBinaryExpressionInfo(lhs, rhs, resultType); 315 } 316 else 317 { 318 string message = string.Format(CultureInfo.CurrentCulture, Messages.ArithOpBadTypes, operation.ToString(), 319 (lhs == typeof(NullLiteral)) ? Messages.NullValue : RuleDecompiler.DecompileType(lhs), 320 (rhs == typeof(NullLiteral)) ? Messages.NullValue : RuleDecompiler.DecompileType(rhs)); 321 error = new ValidationError(message, ErrorNumbers.Error_OperandTypesIncompatible); 322 return null; 323 } 324 } 325 else 326 { 327 // not natively supported, see if user overrides operator 328 MethodInfo opOverload = Literal.MapOperatorToMethod(operation, lhs, lhsExpression, rhs, rhsExpression, validator, out error); 329 if (opOverload != null) 330 return new RuleBinaryExpressionInfo(lhs, rhs, opOverload); 331 else 332 return null; 333 } 334 } 335 336 [SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] ResultType(CodeBinaryOperatorType operation, TypeFlags lhsType, TypeFlags rhsType)337 private static Type ResultType(CodeBinaryOperatorType operation, TypeFlags lhsType, TypeFlags rhsType) 338 { 339 TypeFlags combined = (lhsType | rhsType); 340 bool nullable = (combined & TypeFlags.Nullable) == TypeFlags.Nullable; 341 if (nullable) combined ^= TypeFlags.Nullable; 342 343 switch (operation) 344 { 345 case CodeBinaryOperatorType.Add: 346 // string + anything or anything + string always work 347 if ((lhsType == TypeFlags.String) || (rhsType == TypeFlags.String)) 348 return typeof(string); 349 goto case CodeBinaryOperatorType.Divide; 350 351 case CodeBinaryOperatorType.Divide: 352 case CodeBinaryOperatorType.Modulus: 353 case CodeBinaryOperatorType.Multiply: 354 case CodeBinaryOperatorType.Subtract: 355 switch (combined) 356 { 357 case TypeFlags.Decimal: 358 case TypeFlags.Decimal | TypeFlags.UInt16: 359 case TypeFlags.Decimal | TypeFlags.Int32: 360 case TypeFlags.Decimal | TypeFlags.UInt32: 361 case TypeFlags.Decimal | TypeFlags.Int64: 362 case TypeFlags.Decimal | TypeFlags.UInt64: 363 return (nullable) ? typeof(decimal?) : typeof(decimal); 364 case TypeFlags.Double: 365 case TypeFlags.Double | TypeFlags.UInt16: 366 case TypeFlags.Double | TypeFlags.Int32: 367 case TypeFlags.Double | TypeFlags.UInt32: 368 case TypeFlags.Double | TypeFlags.Int64: 369 case TypeFlags.Double | TypeFlags.UInt64: 370 case TypeFlags.Double | TypeFlags.Single: 371 return (nullable) ? typeof(double?) : typeof(double); 372 case TypeFlags.Single: 373 case TypeFlags.Single | TypeFlags.UInt16: 374 case TypeFlags.Single | TypeFlags.Int32: 375 case TypeFlags.Single | TypeFlags.UInt32: 376 case TypeFlags.Single | TypeFlags.Int64: 377 case TypeFlags.Single | TypeFlags.UInt64: 378 return (nullable) ? typeof(float?) : typeof(float); 379 case TypeFlags.Int64: 380 case TypeFlags.Int64 | TypeFlags.UInt16: 381 case TypeFlags.Int64 | TypeFlags.Int32: 382 case TypeFlags.Int64 | TypeFlags.UInt32: 383 case TypeFlags.Int32 | TypeFlags.UInt32: 384 return (nullable) ? typeof(long?) : typeof(long); 385 case TypeFlags.UInt64: 386 case TypeFlags.UInt64 | TypeFlags.UInt16: 387 case TypeFlags.UInt64 | TypeFlags.UInt32: 388 return (nullable) ? typeof(ulong?) : typeof(ulong); 389 case TypeFlags.Int32: 390 case TypeFlags.UInt16: 391 case TypeFlags.Int32 | TypeFlags.UInt16: 392 return (nullable) ? typeof(int?) : typeof(int); 393 case TypeFlags.UInt32: 394 case TypeFlags.UInt32 | TypeFlags.UInt16: 395 return (nullable) ? typeof(uint?) : typeof(uint); 396 } 397 break; 398 399 case CodeBinaryOperatorType.BitwiseAnd: 400 case CodeBinaryOperatorType.BitwiseOr: 401 switch (combined) 402 { 403 case TypeFlags.Int64: 404 case TypeFlags.Int64 | TypeFlags.UInt16: 405 case TypeFlags.Int64 | TypeFlags.Int32: 406 case TypeFlags.Int64 | TypeFlags.UInt32: 407 case TypeFlags.Int32 | TypeFlags.UInt32: 408 return (nullable) ? typeof(long?) : typeof(long); 409 case TypeFlags.UInt64: 410 case TypeFlags.UInt64 | TypeFlags.UInt16: 411 case TypeFlags.UInt64 | TypeFlags.UInt32: 412 return (nullable) ? typeof(ulong?) : typeof(ulong); 413 case TypeFlags.Int32: 414 case TypeFlags.UInt16: 415 case TypeFlags.Int32 | TypeFlags.UInt16: 416 return (nullable) ? typeof(int?) : typeof(int); 417 case TypeFlags.UInt32: 418 case TypeFlags.UInt32 | TypeFlags.UInt16: 419 return (nullable) ? typeof(uint?) : typeof(uint); 420 case TypeFlags.Boolean: 421 return (nullable) ? typeof(bool?) : typeof(bool); 422 } 423 break; 424 } 425 return null; 426 } 427 #endregion 428 429 #region Value Type Dispatch Methods Add(ArithmeticLiteral v)430 internal virtual object Add(ArithmeticLiteral v) 431 { 432 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.TypeName, CodeBinaryOperatorType.Add, this.TypeName); 433 throw new RuleEvaluationIncompatibleTypesException(message, v.m_type, CodeBinaryOperatorType.Add, this.m_type); 434 } Add()435 internal virtual object Add() 436 { 437 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, Messages.NullValue, CodeBinaryOperatorType.Add, this.TypeName); 438 throw new RuleEvaluationIncompatibleTypesException(message, typeof(void), CodeBinaryOperatorType.Add, this.m_type); 439 } Add(int v)440 internal virtual object Add(int v) 441 { 442 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Add, this.TypeName); 443 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Add, this.m_type); 444 } Add(long v)445 internal virtual object Add(long v) 446 { 447 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Add, this.TypeName); 448 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Add, this.m_type); 449 } Add(char v)450 internal virtual object Add(char v) 451 { 452 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Add, this.TypeName); 453 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Add, this.m_type); 454 } Add(ushort v)455 internal virtual object Add(ushort v) 456 { 457 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Add, this.TypeName); 458 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Add, this.m_type); 459 } Add(uint v)460 internal virtual object Add(uint v) 461 { 462 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Add, this.TypeName); 463 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Add, this.m_type); 464 } Add(ulong v)465 internal virtual object Add(ulong v) 466 { 467 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Add, this.TypeName); 468 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Add, this.m_type); 469 } Add(float v)470 internal virtual object Add(float v) 471 { 472 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Add, this.TypeName); 473 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Add, this.m_type); 474 } Add(double v)475 internal virtual object Add(double v) 476 { 477 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Add, this.TypeName); 478 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Add, this.m_type); 479 } Add(decimal v)480 internal virtual object Add(decimal v) 481 { 482 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Add, this.TypeName); 483 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Add, this.m_type); 484 } Add(bool v)485 internal virtual object Add(bool v) 486 { 487 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Add, this.TypeName); 488 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Add, this.m_type); 489 } Add(string v)490 internal virtual object Add(string v) 491 { 492 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Add, this.TypeName); 493 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Add, this.m_type); 494 } 495 Subtract(ArithmeticLiteral v)496 internal virtual object Subtract(ArithmeticLiteral v) 497 { 498 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.TypeName, CodeBinaryOperatorType.Subtract, this.TypeName); 499 throw new RuleEvaluationIncompatibleTypesException(message, v.m_type, CodeBinaryOperatorType.Subtract, this.m_type); 500 } Subtract()501 internal virtual object Subtract() 502 { 503 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, Messages.NullValue, CodeBinaryOperatorType.Subtract, this.TypeName); 504 throw new RuleEvaluationIncompatibleTypesException(message, typeof(void), CodeBinaryOperatorType.Subtract, this.m_type); 505 } Subtract(int v)506 internal virtual object Subtract(int v) 507 { 508 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Subtract, this.TypeName); 509 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Subtract, this.m_type); 510 } Subtract(long v)511 internal virtual object Subtract(long v) 512 { 513 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Subtract, this.TypeName); 514 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Subtract, this.m_type); 515 } Subtract(ushort v)516 internal virtual object Subtract(ushort v) 517 { 518 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Subtract, this.TypeName); 519 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Subtract, this.m_type); 520 } Subtract(uint v)521 internal virtual object Subtract(uint v) 522 { 523 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Subtract, this.TypeName); 524 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Subtract, this.m_type); 525 } Subtract(ulong v)526 internal virtual object Subtract(ulong v) 527 { 528 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Subtract, this.TypeName); 529 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Subtract, this.m_type); 530 } Subtract(float v)531 internal virtual object Subtract(float v) 532 { 533 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Subtract, this.TypeName); 534 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Subtract, this.m_type); 535 } Subtract(double v)536 internal virtual object Subtract(double v) 537 { 538 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Subtract, this.TypeName); 539 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Subtract, this.m_type); 540 } Subtract(decimal v)541 internal virtual object Subtract(decimal v) 542 { 543 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Subtract, this.TypeName); 544 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Subtract, this.m_type); 545 } 546 Multiply(ArithmeticLiteral v)547 internal virtual object Multiply(ArithmeticLiteral v) 548 { 549 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.TypeName, CodeBinaryOperatorType.Multiply, this.TypeName); 550 throw new RuleEvaluationIncompatibleTypesException(message, v.m_type, CodeBinaryOperatorType.Multiply, this.m_type); 551 } Multiply()552 internal virtual object Multiply() 553 { 554 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, Messages.NullValue, CodeBinaryOperatorType.Multiply, this.TypeName); 555 throw new RuleEvaluationIncompatibleTypesException(message, typeof(void), CodeBinaryOperatorType.Multiply, this.m_type); 556 } Multiply(int v)557 internal virtual object Multiply(int v) 558 { 559 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Multiply, this.TypeName); 560 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Multiply, this.m_type); 561 } Multiply(long v)562 internal virtual object Multiply(long v) 563 { 564 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Multiply, this.TypeName); 565 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Multiply, this.m_type); 566 } Multiply(ushort v)567 internal virtual object Multiply(ushort v) 568 { 569 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Multiply, this.TypeName); 570 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Multiply, this.m_type); 571 } Multiply(uint v)572 internal virtual object Multiply(uint v) 573 { 574 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Multiply, this.TypeName); 575 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Multiply, this.m_type); 576 } Multiply(ulong v)577 internal virtual object Multiply(ulong v) 578 { 579 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Multiply, this.TypeName); 580 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Multiply, this.m_type); 581 } Multiply(float v)582 internal virtual object Multiply(float v) 583 { 584 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Multiply, this.TypeName); 585 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Multiply, this.m_type); 586 } Multiply(double v)587 internal virtual object Multiply(double v) 588 { 589 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Multiply, this.TypeName); 590 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Multiply, this.m_type); 591 } Multiply(decimal v)592 internal virtual object Multiply(decimal v) 593 { 594 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Multiply, this.TypeName); 595 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Multiply, this.m_type); 596 } 597 Divide(ArithmeticLiteral v)598 internal virtual object Divide(ArithmeticLiteral v) 599 { 600 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.TypeName, CodeBinaryOperatorType.Divide, this.TypeName); 601 throw new RuleEvaluationIncompatibleTypesException(message, v.m_type, CodeBinaryOperatorType.Divide, this.m_type); 602 } Divide()603 internal virtual object Divide() 604 { 605 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, Messages.NullValue, CodeBinaryOperatorType.Divide, this.TypeName); 606 throw new RuleEvaluationIncompatibleTypesException(message, typeof(void), CodeBinaryOperatorType.Divide, this.m_type); 607 } Divide(int v)608 internal virtual object Divide(int v) 609 { 610 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Divide, this.TypeName); 611 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Divide, this.m_type); 612 } Divide(long v)613 internal virtual object Divide(long v) 614 { 615 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Divide, this.TypeName); 616 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Divide, this.m_type); 617 } Divide(ushort v)618 internal virtual object Divide(ushort v) 619 { 620 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Divide, this.TypeName); 621 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Divide, this.m_type); 622 } Divide(uint v)623 internal virtual object Divide(uint v) 624 { 625 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Divide, this.TypeName); 626 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Divide, this.m_type); 627 } Divide(ulong v)628 internal virtual object Divide(ulong v) 629 { 630 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Divide, this.TypeName); 631 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Divide, this.m_type); 632 } Divide(float v)633 internal virtual object Divide(float v) 634 { 635 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Divide, this.TypeName); 636 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Divide, this.m_type); 637 } Divide(double v)638 internal virtual object Divide(double v) 639 { 640 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Divide, this.TypeName); 641 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Divide, this.m_type); 642 } Divide(decimal v)643 internal virtual object Divide(decimal v) 644 { 645 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Divide, this.TypeName); 646 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Divide, this.m_type); 647 } 648 Modulus(ArithmeticLiteral v)649 internal virtual object Modulus(ArithmeticLiteral v) 650 { 651 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.m_type, CodeBinaryOperatorType.Modulus, this.TypeName); 652 throw new RuleEvaluationIncompatibleTypesException(message, v.m_type, CodeBinaryOperatorType.Modulus, this.m_type); 653 } Modulus()654 internal virtual object Modulus() 655 { 656 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, Messages.NullValue, CodeBinaryOperatorType.Modulus, this.TypeName); 657 throw new RuleEvaluationIncompatibleTypesException(message, typeof(void), CodeBinaryOperatorType.Modulus, this.m_type); 658 } Modulus(int v)659 internal virtual object Modulus(int v) 660 { 661 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Modulus, this.TypeName); 662 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Modulus, this.m_type); 663 } Modulus(long v)664 internal virtual object Modulus(long v) 665 { 666 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Modulus, this.TypeName); 667 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Modulus, this.m_type); 668 } Modulus(ushort v)669 internal virtual object Modulus(ushort v) 670 { 671 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Modulus, this.TypeName); 672 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Modulus, this.m_type); 673 } Modulus(uint v)674 internal virtual object Modulus(uint v) 675 { 676 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Modulus, this.TypeName); 677 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Modulus, this.m_type); 678 } Modulus(ulong v)679 internal virtual object Modulus(ulong v) 680 { 681 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Modulus, this.TypeName); 682 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Modulus, this.m_type); 683 } Modulus(float v)684 internal virtual object Modulus(float v) 685 { 686 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Modulus, this.TypeName); 687 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Modulus, this.m_type); 688 } Modulus(double v)689 internal virtual object Modulus(double v) 690 { 691 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Modulus, this.TypeName); 692 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Modulus, this.m_type); 693 } Modulus(decimal v)694 internal virtual object Modulus(decimal v) 695 { 696 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.Modulus, this.TypeName); 697 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.Modulus, this.m_type); 698 } 699 BitAnd(ArithmeticLiteral v)700 internal virtual object BitAnd(ArithmeticLiteral v) 701 { 702 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.m_type, CodeBinaryOperatorType.BitwiseAnd, this.TypeName); 703 throw new RuleEvaluationIncompatibleTypesException(message, v.m_type, CodeBinaryOperatorType.BitwiseAnd, this.m_type); 704 } BitAnd()705 internal virtual object BitAnd() 706 { 707 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, Messages.NullValue, CodeBinaryOperatorType.BitwiseAnd, this.TypeName); 708 throw new RuleEvaluationIncompatibleTypesException(message, typeof(void), CodeBinaryOperatorType.BitwiseAnd, this.m_type); 709 } BitAnd(int v)710 internal virtual object BitAnd(int v) 711 { 712 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.BitwiseAnd, this.TypeName); 713 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.BitwiseAnd, this.m_type); 714 } BitAnd(long v)715 internal virtual object BitAnd(long v) 716 { 717 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.BitwiseAnd, this.TypeName); 718 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.BitwiseAnd, this.m_type); 719 } BitAnd(ushort v)720 internal virtual object BitAnd(ushort v) 721 { 722 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.BitwiseAnd, this.TypeName); 723 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.BitwiseAnd, this.m_type); 724 } BitAnd(uint v)725 internal virtual object BitAnd(uint v) 726 { 727 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.BitwiseAnd, this.TypeName); 728 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.BitwiseAnd, this.m_type); 729 } BitAnd(ulong v)730 internal virtual object BitAnd(ulong v) 731 { 732 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.BitwiseAnd, this.TypeName); 733 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.BitwiseAnd, this.m_type); 734 } BitAnd(float v)735 internal virtual object BitAnd(float v) 736 { 737 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.BitwiseAnd, this.TypeName); 738 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.BitwiseAnd, this.m_type); 739 } BitAnd(double v)740 internal virtual object BitAnd(double v) 741 { 742 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.BitwiseAnd, this.TypeName); 743 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.BitwiseAnd, this.m_type); 744 } BitAnd(decimal v)745 internal virtual object BitAnd(decimal v) 746 { 747 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.BitwiseAnd, this.TypeName); 748 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.BitwiseAnd, this.m_type); 749 } BitAnd(bool v)750 internal virtual object BitAnd(bool v) 751 { 752 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.BitwiseAnd, this.TypeName); 753 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.BitwiseAnd, this.m_type); 754 } 755 BitOr(ArithmeticLiteral v)756 internal virtual object BitOr(ArithmeticLiteral v) 757 { 758 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.TypeName, CodeBinaryOperatorType.BitwiseOr, this.TypeName); 759 throw new RuleEvaluationIncompatibleTypesException(message, v.m_type, CodeBinaryOperatorType.BitwiseOr, this.m_type); 760 } BitOr()761 internal virtual object BitOr() 762 { 763 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, Messages.NullValue, CodeBinaryOperatorType.BitwiseOr, this.TypeName); 764 throw new RuleEvaluationIncompatibleTypesException(message, typeof(void), CodeBinaryOperatorType.BitwiseOr, this.m_type); 765 } BitOr(int v)766 internal virtual object BitOr(int v) 767 { 768 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.BitwiseOr, this.TypeName); 769 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.BitwiseOr, this.m_type); 770 } BitOr(long v)771 internal virtual object BitOr(long v) 772 { 773 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.BitwiseOr, this.TypeName); 774 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.BitwiseOr, this.m_type); 775 } BitOr(ushort v)776 internal virtual object BitOr(ushort v) 777 { 778 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.BitwiseOr, this.TypeName); 779 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.BitwiseOr, this.m_type); 780 } BitOr(uint v)781 internal virtual object BitOr(uint v) 782 { 783 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.BitwiseOr, this.TypeName); 784 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.BitwiseOr, this.m_type); 785 } BitOr(ulong v)786 internal virtual object BitOr(ulong v) 787 { 788 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.BitwiseOr, this.TypeName); 789 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.BitwiseOr, this.m_type); 790 } BitOr(float v)791 internal virtual object BitOr(float v) 792 { 793 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.BitwiseOr, this.TypeName); 794 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.BitwiseOr, this.m_type); 795 } BitOr(double v)796 internal virtual object BitOr(double v) 797 { 798 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.BitwiseOr, this.TypeName); 799 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.BitwiseOr, this.m_type); 800 } BitOr(decimal v)801 internal virtual object BitOr(decimal v) 802 { 803 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.BitwiseOr, this.TypeName); 804 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.BitwiseOr, this.m_type); 805 } BitOr(bool v)806 internal virtual object BitOr(bool v) 807 { 808 string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleArithmeticTypes, v.GetType(), CodeBinaryOperatorType.BitwiseOr, this.TypeName); 809 throw new RuleEvaluationIncompatibleTypesException(message, v.GetType(), CodeBinaryOperatorType.BitwiseOr, this.m_type); 810 } 811 #endregion 812 } 813 #endregion 814 815 #region IntArithmeticLiteral Class 816 internal class IntArithmeticLiteral : ArithmeticLiteral 817 { 818 private int m_value; IntArithmeticLiteral(int literalValue)819 internal IntArithmeticLiteral(int literalValue) 820 { 821 m_value = literalValue; 822 m_type = typeof(int); 823 } 824 825 internal override object Value 826 { 827 get { return m_value; } 828 } 829 #region Add Add(ArithmeticLiteral v)830 internal override object Add(ArithmeticLiteral v) 831 { 832 return v.Add(m_value); 833 } Add()834 internal override object Add() 835 { 836 return null; 837 } Add(int v)838 internal override object Add(int v) 839 { 840 return (v + m_value); 841 } Add(long v)842 internal override object Add(long v) 843 { 844 return (v + m_value); 845 } Add(char v)846 internal override object Add(char v) 847 { 848 return (v + m_value); 849 } Add(ushort v)850 internal override object Add(ushort v) 851 { 852 return (v + m_value); 853 } Add(uint v)854 internal override object Add(uint v) 855 { 856 return (v + m_value); 857 } Add(ulong v)858 internal override object Add(ulong v) 859 { 860 // this should only happen when using a constant (+ve) int and an ulong 861 // if that's not the case, you get an error 862 return (m_value >= 0) ? (v + (ulong)m_value) : base.Add(v); 863 } Add(float v)864 internal override object Add(float v) 865 { 866 return (v + m_value); 867 } Add(double v)868 internal override object Add(double v) 869 { 870 return (v + m_value); 871 } Add(decimal v)872 internal override object Add(decimal v) 873 { 874 return (v + m_value); 875 } Add(string v)876 internal override object Add(string v) 877 { 878 return (v + m_value.ToString(CultureInfo.CurrentCulture)); 879 } 880 #endregion 881 #region Subtract Subtract(ArithmeticLiteral v)882 internal override object Subtract(ArithmeticLiteral v) 883 { 884 return v.Subtract(m_value); 885 } Subtract()886 internal override object Subtract() 887 { 888 return null; 889 } Subtract(int v)890 internal override object Subtract(int v) 891 { 892 return (v - m_value); 893 } Subtract(long v)894 internal override object Subtract(long v) 895 { 896 return (v - m_value); 897 } Subtract(ushort v)898 internal override object Subtract(ushort v) 899 { 900 return (v - m_value); 901 } Subtract(uint v)902 internal override object Subtract(uint v) 903 { 904 return (v - m_value); 905 } Subtract(ulong v)906 internal override object Subtract(ulong v) 907 { 908 // this should only happen when using a constant (+ve) int and an ulong 909 // if that's not the case, you get an error 910 return (m_value >= 0) ? (v - (ulong)m_value) : base.Subtract(v); 911 } Subtract(float v)912 internal override object Subtract(float v) 913 { 914 return (v - m_value); 915 } Subtract(double v)916 internal override object Subtract(double v) 917 { 918 return (v - m_value); 919 } Subtract(decimal v)920 internal override object Subtract(decimal v) 921 { 922 return (v - m_value); 923 } 924 #endregion 925 #region Multiply Multiply(ArithmeticLiteral v)926 internal override object Multiply(ArithmeticLiteral v) 927 { 928 return v.Multiply(m_value); 929 } Multiply()930 internal override object Multiply() 931 { 932 return null; 933 } Multiply(int v)934 internal override object Multiply(int v) 935 { 936 return (v * m_value); 937 } Multiply(long v)938 internal override object Multiply(long v) 939 { 940 return (v * m_value); 941 } Multiply(ushort v)942 internal override object Multiply(ushort v) 943 { 944 return (v * m_value); 945 } Multiply(uint v)946 internal override object Multiply(uint v) 947 { 948 return (v * m_value); 949 } Multiply(ulong v)950 internal override object Multiply(ulong v) 951 { 952 // this should only happen when using a constant (+ve) int and an ulong 953 // if that's not the case, you get an error 954 return (m_value >= 0) ? (v * (ulong)m_value) : base.Multiply(v); 955 } Multiply(float v)956 internal override object Multiply(float v) 957 { 958 return (v * m_value); 959 } Multiply(double v)960 internal override object Multiply(double v) 961 { 962 return (v * m_value); 963 } Multiply(decimal v)964 internal override object Multiply(decimal v) 965 { 966 return (v * m_value); 967 } 968 #endregion 969 #region Divide Divide(ArithmeticLiteral v)970 internal override object Divide(ArithmeticLiteral v) 971 { 972 return v.Divide(m_value); 973 } Divide()974 internal override object Divide() 975 { 976 return null; 977 } Divide(int v)978 internal override object Divide(int v) 979 { 980 return (v / m_value); 981 } Divide(long v)982 internal override object Divide(long v) 983 { 984 return (v / m_value); 985 } Divide(ushort v)986 internal override object Divide(ushort v) 987 { 988 return (v / m_value); 989 } Divide(uint v)990 internal override object Divide(uint v) 991 { 992 return (v / m_value); 993 } Divide(ulong v)994 internal override object Divide(ulong v) 995 { 996 // this should only happen when using a constant (+ve) int and an ulong 997 // if that's not the case, you get an error 998 return (m_value >= 0) ? (v / (ulong)m_value) : base.Divide(v); 999 } Divide(float v)1000 internal override object Divide(float v) 1001 { 1002 return (v / m_value); 1003 } Divide(double v)1004 internal override object Divide(double v) 1005 { 1006 return (v / m_value); 1007 } Divide(decimal v)1008 internal override object Divide(decimal v) 1009 { 1010 return (v / m_value); 1011 } 1012 #endregion 1013 #region Modulus Modulus(ArithmeticLiteral v)1014 internal override object Modulus(ArithmeticLiteral v) 1015 { 1016 return v.Modulus(m_value); 1017 } Modulus()1018 internal override object Modulus() 1019 { 1020 return null; 1021 } Modulus(int v)1022 internal override object Modulus(int v) 1023 { 1024 return (v % m_value); 1025 } Modulus(long v)1026 internal override object Modulus(long v) 1027 { 1028 return (v % m_value); 1029 } Modulus(ushort v)1030 internal override object Modulus(ushort v) 1031 { 1032 return (v % m_value); 1033 } Modulus(uint v)1034 internal override object Modulus(uint v) 1035 { 1036 return (v % m_value); 1037 } Modulus(ulong v)1038 internal override object Modulus(ulong v) 1039 { 1040 // this should only happen when using a constant (+ve) int and an ulong 1041 // if that's not the case, you get an error 1042 return (m_value >= 0) ? (v % (ulong)m_value) : base.Modulus(v); 1043 } Modulus(float v)1044 internal override object Modulus(float v) 1045 { 1046 return (v % m_value); 1047 } Modulus(double v)1048 internal override object Modulus(double v) 1049 { 1050 return (v % m_value); 1051 } Modulus(decimal v)1052 internal override object Modulus(decimal v) 1053 { 1054 return (v % m_value); 1055 } 1056 #endregion 1057 #region BitAnd BitAnd(ArithmeticLiteral v)1058 internal override object BitAnd(ArithmeticLiteral v) 1059 { 1060 return v.BitAnd(m_value); 1061 } BitAnd()1062 internal override object BitAnd() 1063 { 1064 return null; 1065 } BitAnd(int v)1066 internal override object BitAnd(int v) 1067 { 1068 return (v & m_value); 1069 } BitAnd(long v)1070 internal override object BitAnd(long v) 1071 { 1072 return (v & m_value); 1073 } BitAnd(ushort v)1074 internal override object BitAnd(ushort v) 1075 { 1076 return (v & m_value); 1077 } BitAnd(uint v)1078 internal override object BitAnd(uint v) 1079 { 1080 return (v & m_value); 1081 } BitAnd(ulong v)1082 internal override object BitAnd(ulong v) 1083 { 1084 // this should only happen when using a constant (+ve) int and an ulong 1085 // if that's not the case, you get an error 1086 return (m_value >= 0) ? (v & (ulong)m_value) : base.BitAnd(v); 1087 } 1088 #endregion 1089 #region BitOr BitOr(ArithmeticLiteral v)1090 internal override object BitOr(ArithmeticLiteral v) 1091 { 1092 return v.BitOr(m_value); 1093 } BitOr()1094 internal override object BitOr() 1095 { 1096 return null; 1097 } BitOr(int v)1098 internal override object BitOr(int v) 1099 { 1100 return (v | m_value); 1101 } BitOr(long v)1102 internal override object BitOr(long v) 1103 { 1104 long l = m_value; 1105 return (v | l); 1106 } BitOr(ushort v)1107 internal override object BitOr(ushort v) 1108 { 1109 return (v | m_value); 1110 } BitOr(uint v)1111 internal override object BitOr(uint v) 1112 { 1113 long l = m_value; 1114 return (v | l); 1115 } BitOr(ulong v)1116 internal override object BitOr(ulong v) 1117 { 1118 // this should only happen when using a constant (+ve) int and an ulong 1119 // if that's not the case, you get an error 1120 long l = m_value; 1121 return (l >= 0) ? (v | (ulong)l) : base.BitOr(v); 1122 } 1123 #endregion 1124 } 1125 #endregion 1126 1127 #region LongArithmeticLiteral Class 1128 internal class LongArithmeticLiteral : ArithmeticLiteral 1129 { 1130 private long m_value; LongArithmeticLiteral(long literalValue)1131 internal LongArithmeticLiteral(long literalValue) 1132 { 1133 m_value = literalValue; 1134 m_type = typeof(long); 1135 } 1136 1137 internal override object Value 1138 { 1139 get { return m_value; } 1140 } 1141 #region Add Add(ArithmeticLiteral v)1142 internal override object Add(ArithmeticLiteral v) 1143 { 1144 return v.Add(m_value); 1145 } Add()1146 internal override object Add() 1147 { 1148 return null; 1149 } Add(int v)1150 internal override object Add(int v) 1151 { 1152 return (v + m_value); 1153 } Add(long v)1154 internal override object Add(long v) 1155 { 1156 return (v + m_value); 1157 } Add(char v)1158 internal override object Add(char v) 1159 { 1160 return (v + m_value); 1161 } Add(ushort v)1162 internal override object Add(ushort v) 1163 { 1164 return (v + m_value); 1165 } Add(uint v)1166 internal override object Add(uint v) 1167 { 1168 return (v + m_value); 1169 } Add(ulong v)1170 internal override object Add(ulong v) 1171 { 1172 // this should only happen when using a constant (+ve) long and an ulong 1173 // if that's not the case, you get an error 1174 return (m_value >= 0) ? (v + (ulong)m_value) : base.Add(v); 1175 } Add(float v)1176 internal override object Add(float v) 1177 { 1178 return (v + m_value); 1179 } Add(double v)1180 internal override object Add(double v) 1181 { 1182 return (v + m_value); 1183 } Add(decimal v)1184 internal override object Add(decimal v) 1185 { 1186 return (v + m_value); 1187 } Add(string v)1188 internal override object Add(string v) 1189 { 1190 return (v + m_value.ToString(CultureInfo.CurrentCulture)); 1191 } 1192 #endregion 1193 #region Subtract Subtract(ArithmeticLiteral v)1194 internal override object Subtract(ArithmeticLiteral v) 1195 { 1196 return v.Subtract(m_value); 1197 } Subtract()1198 internal override object Subtract() 1199 { 1200 return null; 1201 } Subtract(int v)1202 internal override object Subtract(int v) 1203 { 1204 return (v - m_value); 1205 } Subtract(long v)1206 internal override object Subtract(long v) 1207 { 1208 return (v - m_value); 1209 } Subtract(ushort v)1210 internal override object Subtract(ushort v) 1211 { 1212 return (v - m_value); 1213 } Subtract(uint v)1214 internal override object Subtract(uint v) 1215 { 1216 return (v - m_value); 1217 } Subtract(ulong v)1218 internal override object Subtract(ulong v) 1219 { 1220 // this should only happen when using a constant (+ve) long and an ulong 1221 // if that's not the case, you get an error 1222 return (m_value >= 0) ? (v - (ulong)m_value) : base.Subtract(v); 1223 } Subtract(float v)1224 internal override object Subtract(float v) 1225 { 1226 return (v - m_value); 1227 } Subtract(double v)1228 internal override object Subtract(double v) 1229 { 1230 return (v - m_value); 1231 } Subtract(decimal v)1232 internal override object Subtract(decimal v) 1233 { 1234 return (v - m_value); 1235 } 1236 #endregion 1237 #region Multiply Multiply(ArithmeticLiteral v)1238 internal override object Multiply(ArithmeticLiteral v) 1239 { 1240 return v.Multiply(m_value); 1241 } Multiply()1242 internal override object Multiply() 1243 { 1244 return null; 1245 } Multiply(int v)1246 internal override object Multiply(int v) 1247 { 1248 return (v * m_value); 1249 } Multiply(long v)1250 internal override object Multiply(long v) 1251 { 1252 return (v * m_value); 1253 } Multiply(ushort v)1254 internal override object Multiply(ushort v) 1255 { 1256 return (v * m_value); 1257 } Multiply(uint v)1258 internal override object Multiply(uint v) 1259 { 1260 return (v * m_value); 1261 } Multiply(ulong v)1262 internal override object Multiply(ulong v) 1263 { 1264 // this should only happen when using a constant (+ve) long and an ulong 1265 // if that's not the case, you get an error 1266 return (m_value >= 0) ? (v * (ulong)m_value) : base.Multiply(v); 1267 } Multiply(float v)1268 internal override object Multiply(float v) 1269 { 1270 return (v * m_value); 1271 } Multiply(double v)1272 internal override object Multiply(double v) 1273 { 1274 return (v * m_value); 1275 } Multiply(decimal v)1276 internal override object Multiply(decimal v) 1277 { 1278 return (v * m_value); 1279 } 1280 #endregion 1281 #region Divide Divide(ArithmeticLiteral v)1282 internal override object Divide(ArithmeticLiteral v) 1283 { 1284 return v.Divide(m_value); 1285 } Divide()1286 internal override object Divide() 1287 { 1288 return null; 1289 } Divide(int v)1290 internal override object Divide(int v) 1291 { 1292 return (v / m_value); 1293 } Divide(long v)1294 internal override object Divide(long v) 1295 { 1296 return (v / m_value); 1297 } Divide(ushort v)1298 internal override object Divide(ushort v) 1299 { 1300 return (v / m_value); 1301 } Divide(uint v)1302 internal override object Divide(uint v) 1303 { 1304 return (v / m_value); 1305 } Divide(ulong v)1306 internal override object Divide(ulong v) 1307 { 1308 // this should only happen when using a constant (+ve) long and an ulong 1309 // if that's not the case, you get an error 1310 return (m_value >= 0) ? (v / (ulong)m_value) : base.Divide(v); 1311 } Divide(float v)1312 internal override object Divide(float v) 1313 { 1314 return (v / m_value); 1315 } Divide(double v)1316 internal override object Divide(double v) 1317 { 1318 return (v / m_value); 1319 } Divide(decimal v)1320 internal override object Divide(decimal v) 1321 { 1322 return (v / m_value); 1323 } 1324 #endregion 1325 #region Modulus Modulus(ArithmeticLiteral v)1326 internal override object Modulus(ArithmeticLiteral v) 1327 { 1328 return v.Modulus(m_value); 1329 } Modulus()1330 internal override object Modulus() 1331 { 1332 return null; 1333 } Modulus(int v)1334 internal override object Modulus(int v) 1335 { 1336 return (v % m_value); 1337 } Modulus(long v)1338 internal override object Modulus(long v) 1339 { 1340 return (v % m_value); 1341 } Modulus(ushort v)1342 internal override object Modulus(ushort v) 1343 { 1344 return (v % m_value); 1345 } Modulus(uint v)1346 internal override object Modulus(uint v) 1347 { 1348 return (v % m_value); 1349 } Modulus(ulong v)1350 internal override object Modulus(ulong v) 1351 { 1352 // this should only happen when using a constant (+ve) long and an ulong 1353 // if that's not the case, you get an error 1354 return (m_value >= 0) ? (v % (ulong)m_value) : base.Modulus(v); 1355 } Modulus(float v)1356 internal override object Modulus(float v) 1357 { 1358 return (v % m_value); 1359 } Modulus(double v)1360 internal override object Modulus(double v) 1361 { 1362 return (v % m_value); 1363 } Modulus(decimal v)1364 internal override object Modulus(decimal v) 1365 { 1366 return (v % m_value); 1367 } 1368 #endregion 1369 #region BitAnd BitAnd(ArithmeticLiteral v)1370 internal override object BitAnd(ArithmeticLiteral v) 1371 { 1372 return v.BitAnd(m_value); 1373 } BitAnd()1374 internal override object BitAnd() 1375 { 1376 return null; 1377 } BitAnd(int v)1378 internal override object BitAnd(int v) 1379 { 1380 return (v & m_value); 1381 } BitAnd(long v)1382 internal override object BitAnd(long v) 1383 { 1384 return (v & m_value); 1385 } BitAnd(ushort v)1386 internal override object BitAnd(ushort v) 1387 { 1388 return (v & m_value); 1389 } BitAnd(uint v)1390 internal override object BitAnd(uint v) 1391 { 1392 return (v & m_value); 1393 } BitAnd(ulong v)1394 internal override object BitAnd(ulong v) 1395 { 1396 // this should only happen when using a constant (+ve) long and an ulong 1397 // if that's not the case, you get an error 1398 return (m_value >= 0) ? (v & (ulong)m_value) : base.BitAnd(v); 1399 } 1400 #endregion 1401 #region BitOr BitOr(ArithmeticLiteral v)1402 internal override object BitOr(ArithmeticLiteral v) 1403 { 1404 return v.BitOr(m_value); 1405 } BitOr()1406 internal override object BitOr() 1407 { 1408 return null; 1409 } BitOr(int v)1410 internal override object BitOr(int v) 1411 { 1412 long l = v; 1413 return (l | m_value); 1414 } BitOr(long v)1415 internal override object BitOr(long v) 1416 { 1417 return (v | m_value); 1418 } BitOr(ushort v)1419 internal override object BitOr(ushort v) 1420 { 1421 return (v | m_value); 1422 } BitOr(uint v)1423 internal override object BitOr(uint v) 1424 { 1425 return (v | m_value); 1426 } BitOr(ulong v)1427 internal override object BitOr(ulong v) 1428 { 1429 // this should only happen when using a constant (+ve) long and an ulong 1430 // if that's not the case, you get an error 1431 return (m_value >= 0) ? (v | (ulong)m_value) : base.BitOr(v); 1432 } 1433 #endregion 1434 } 1435 #endregion 1436 1437 #region CharArithmeticLiteral Class 1438 internal class CharArithmeticLiteral : ArithmeticLiteral 1439 { 1440 private char m_value; CharArithmeticLiteral(char literalValue)1441 internal CharArithmeticLiteral(char literalValue) 1442 { 1443 m_value = literalValue; 1444 m_type = typeof(char); 1445 } 1446 1447 internal override object Value 1448 { 1449 get { return m_value; } 1450 } 1451 #region Add Add(ArithmeticLiteral v)1452 internal override object Add(ArithmeticLiteral v) 1453 { 1454 return v.Add(m_value); 1455 } Add()1456 internal override object Add() 1457 { 1458 return null; 1459 } Add(int v)1460 internal override object Add(int v) 1461 { 1462 return (v + m_value); 1463 } Add(long v)1464 internal override object Add(long v) 1465 { 1466 return (v + m_value); 1467 } Add(char v)1468 internal override object Add(char v) 1469 { 1470 return (v + m_value); 1471 } Add(ushort v)1472 internal override object Add(ushort v) 1473 { 1474 return (v + m_value); 1475 } Add(uint v)1476 internal override object Add(uint v) 1477 { 1478 return (v + m_value); 1479 } Add(ulong v)1480 internal override object Add(ulong v) 1481 { 1482 return (v + m_value); 1483 } Add(float v)1484 internal override object Add(float v) 1485 { 1486 return (v + m_value); 1487 } Add(double v)1488 internal override object Add(double v) 1489 { 1490 return (v + m_value); 1491 } Add(decimal v)1492 internal override object Add(decimal v) 1493 { 1494 return (v + m_value); 1495 } Add(string v)1496 internal override object Add(string v) 1497 { 1498 return (v + m_value.ToString(CultureInfo.CurrentCulture)); 1499 } 1500 #endregion 1501 #region Subtract Subtract(ArithmeticLiteral v)1502 internal override object Subtract(ArithmeticLiteral v) 1503 { 1504 return v.Subtract(m_value); 1505 } Subtract()1506 internal override object Subtract() 1507 { 1508 return null; 1509 } Subtract(int v)1510 internal override object Subtract(int v) 1511 { 1512 return (v - m_value); 1513 } Subtract(long v)1514 internal override object Subtract(long v) 1515 { 1516 return (v - m_value); 1517 } Subtract(ushort v)1518 internal override object Subtract(ushort v) 1519 { 1520 return (v - m_value); 1521 } Subtract(uint v)1522 internal override object Subtract(uint v) 1523 { 1524 return (v - m_value); 1525 } Subtract(ulong v)1526 internal override object Subtract(ulong v) 1527 { 1528 return (v - m_value); 1529 } Subtract(float v)1530 internal override object Subtract(float v) 1531 { 1532 return (v - m_value); 1533 } Subtract(double v)1534 internal override object Subtract(double v) 1535 { 1536 return (v - m_value); 1537 } Subtract(decimal v)1538 internal override object Subtract(decimal v) 1539 { 1540 return (v - m_value); 1541 } 1542 #endregion 1543 #region Multiply Multiply(ArithmeticLiteral v)1544 internal override object Multiply(ArithmeticLiteral v) 1545 { 1546 return v.Multiply(m_value); 1547 } Multiply()1548 internal override object Multiply() 1549 { 1550 return null; 1551 } Multiply(int v)1552 internal override object Multiply(int v) 1553 { 1554 return (v * m_value); 1555 } Multiply(long v)1556 internal override object Multiply(long v) 1557 { 1558 return (v * m_value); 1559 } Multiply(ushort v)1560 internal override object Multiply(ushort v) 1561 { 1562 return (v * m_value); 1563 } Multiply(uint v)1564 internal override object Multiply(uint v) 1565 { 1566 return (v * m_value); 1567 } Multiply(ulong v)1568 internal override object Multiply(ulong v) 1569 { 1570 return (v * m_value); 1571 } Multiply(float v)1572 internal override object Multiply(float v) 1573 { 1574 return (v * m_value); 1575 } Multiply(double v)1576 internal override object Multiply(double v) 1577 { 1578 return (v * m_value); 1579 } Multiply(decimal v)1580 internal override object Multiply(decimal v) 1581 { 1582 return (v * m_value); 1583 } 1584 #endregion 1585 #region Divide Divide(ArithmeticLiteral v)1586 internal override object Divide(ArithmeticLiteral v) 1587 { 1588 return v.Divide(m_value); 1589 } Divide()1590 internal override object Divide() 1591 { 1592 return null; 1593 } Divide(int v)1594 internal override object Divide(int v) 1595 { 1596 return (v / m_value); 1597 } Divide(long v)1598 internal override object Divide(long v) 1599 { 1600 return (v / m_value); 1601 } Divide(ushort v)1602 internal override object Divide(ushort v) 1603 { 1604 return (v / m_value); 1605 } Divide(uint v)1606 internal override object Divide(uint v) 1607 { 1608 return (v / m_value); 1609 } Divide(ulong v)1610 internal override object Divide(ulong v) 1611 { 1612 return (v / m_value); 1613 } Divide(float v)1614 internal override object Divide(float v) 1615 { 1616 return (v / m_value); 1617 } Divide(double v)1618 internal override object Divide(double v) 1619 { 1620 return (v / m_value); 1621 } Divide(decimal v)1622 internal override object Divide(decimal v) 1623 { 1624 return (v / m_value); 1625 } 1626 #endregion 1627 #region Modulus Modulus(ArithmeticLiteral v)1628 internal override object Modulus(ArithmeticLiteral v) 1629 { 1630 return v.Modulus(m_value); 1631 } Modulus()1632 internal override object Modulus() 1633 { 1634 return null; 1635 } Modulus(int v)1636 internal override object Modulus(int v) 1637 { 1638 return (v % m_value); 1639 } Modulus(long v)1640 internal override object Modulus(long v) 1641 { 1642 return (v % m_value); 1643 } Modulus(ushort v)1644 internal override object Modulus(ushort v) 1645 { 1646 return (v % m_value); 1647 } Modulus(uint v)1648 internal override object Modulus(uint v) 1649 { 1650 return (v % m_value); 1651 } Modulus(ulong v)1652 internal override object Modulus(ulong v) 1653 { 1654 return (v % m_value); 1655 } Modulus(float v)1656 internal override object Modulus(float v) 1657 { 1658 return (v % m_value); 1659 } Modulus(double v)1660 internal override object Modulus(double v) 1661 { 1662 return (v % m_value); 1663 } Modulus(decimal v)1664 internal override object Modulus(decimal v) 1665 { 1666 return (v % m_value); 1667 } 1668 #endregion 1669 #region BitAnd BitAnd(ArithmeticLiteral v)1670 internal override object BitAnd(ArithmeticLiteral v) 1671 { 1672 return v.BitAnd(m_value); 1673 } BitAnd()1674 internal override object BitAnd() 1675 { 1676 return null; 1677 } BitAnd(int v)1678 internal override object BitAnd(int v) 1679 { 1680 return (v & m_value); 1681 } BitAnd(long v)1682 internal override object BitAnd(long v) 1683 { 1684 return (v & m_value); 1685 } BitAnd(ushort v)1686 internal override object BitAnd(ushort v) 1687 { 1688 return (v & m_value); 1689 } BitAnd(uint v)1690 internal override object BitAnd(uint v) 1691 { 1692 return (v & m_value); 1693 } BitAnd(ulong v)1694 internal override object BitAnd(ulong v) 1695 { 1696 return (v & m_value); 1697 } 1698 #endregion 1699 #region BitOr BitOr(ArithmeticLiteral v)1700 internal override object BitOr(ArithmeticLiteral v) 1701 { 1702 return v.BitOr(m_value); 1703 } BitOr()1704 internal override object BitOr() 1705 { 1706 return null; 1707 } BitOr(int v)1708 internal override object BitOr(int v) 1709 { 1710 return (v | m_value); 1711 } BitOr(long v)1712 internal override object BitOr(long v) 1713 { 1714 return (v | m_value); 1715 } BitOr(ushort v)1716 internal override object BitOr(ushort v) 1717 { 1718 return (v | m_value); 1719 } BitOr(uint v)1720 internal override object BitOr(uint v) 1721 { 1722 return (v | m_value); 1723 } BitOr(ulong v)1724 internal override object BitOr(ulong v) 1725 { 1726 return (v | m_value); 1727 } 1728 #endregion 1729 } 1730 #endregion 1731 1732 #region UShortArithmeticLiteral Class 1733 internal class UShortArithmeticLiteral : ArithmeticLiteral 1734 { 1735 private ushort m_value; UShortArithmeticLiteral(ushort literalValue)1736 internal UShortArithmeticLiteral(ushort literalValue) 1737 { 1738 m_value = literalValue; 1739 m_type = typeof(ushort); 1740 } 1741 1742 internal override object Value 1743 { 1744 get { return m_value; } 1745 } 1746 #region Add Add(ArithmeticLiteral v)1747 internal override object Add(ArithmeticLiteral v) 1748 { 1749 return v.Add(m_value); 1750 } Add()1751 internal override object Add() 1752 { 1753 return null; 1754 } Add(int v)1755 internal override object Add(int v) 1756 { 1757 return (v + m_value); 1758 } Add(long v)1759 internal override object Add(long v) 1760 { 1761 return (v + m_value); 1762 } Add(char v)1763