Example #1
0
        public static Instruction Create(string method, int argCount, MethodInfo mi)
        {
            switch (method)
            {
            case "get_HasValue": return(s_hasValue ?? (s_hasValue = new HasValue()));

            case "get_Value": return(s_value ?? (s_value = new GetValue()));

            case "Equals": return(s_equals ?? (s_equals = new EqualsClass()));

            case "GetHashCode": return(s_getHashCode ?? (s_getHashCode = new GetHashCodeClass()));

            case "GetValueOrDefault":
                if (argCount == 0)
                {
                    return(new GetValueOrDefault(mi));
                }
                else
                {
                    return(s_getValueOrDefault1 ?? (s_getValueOrDefault1 = new GetValueOrDefault1()));
                }

            case "ToString": return(s_toString ?? (s_toString = new ToStringClass()));

            default:
                // System.Nullable doesn't have other instance methods
                throw ContractUtils.Unreachable;
            }
        }
Example #2
0
 public void EmitNullableCall(MethodInfo method, ParameterInfo[] parameters)
 {
     Emit(NullableMethodCallInstruction.Create(method.Name, parameters.Length, method));
 }