CSE.Exps.MethodExp.NarrowAllIntTypes C# (CSharp) Method

NarrowAllIntTypes() private static method

Inspects all CseObjects in args and for the literal integral values, it converts their type to the most narrow type that can contain their value. E.g. if the value is a literal 300 (not the value of an identifier as those types aren't changed), then the smallest integral data type that can store that would be a short. This increases the chance that the given args will match a wider method signature.
private static NarrowAllIntTypes ( List &args ) : void
args List Arguments to inspect and convert
return void
		private static void NarrowAllIntTypes(ref List<CseObject> args) {
			if (args == null)
				return;

			for (int i = 0; i < args.Count; i++) {
				CseObject arg = args[i];

				if (LiteralExp.IsIntType(arg) && arg.IsLiteral) {
					args[i] = LiteralExp.NarrowIntType(arg);
					args[i].CompileTimeType = args[i].Value.GetType();
				}
			}
		}