Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/corlib/System/MonoType.cs')
-rw-r--r--mcs/class/corlib/System/MonoType.cs47
1 files changed, 17 insertions, 30 deletions
diff --git a/mcs/class/corlib/System/MonoType.cs b/mcs/class/corlib/System/MonoType.cs
index 395332cf459..a04eeb93877 100644
--- a/mcs/class/corlib/System/MonoType.cs
+++ b/mcs/class/corlib/System/MonoType.cs
@@ -340,26 +340,22 @@ namespace System
name = attr.MemberName;
}
bool ignoreCase = (invokeAttr & BindingFlags.IgnoreCase) != 0;
- bool throwMissingMethodException = false;
- bool throwMissingFieldException = false;
if ((invokeAttr & BindingFlags.InvokeMethod) != 0) {
MethodInfo[] methods = GetMethodsByName (name, invokeAttr, ignoreCase, this);
object state = null;
MethodBase m = binder.BindToMethod (invokeAttr, methods, ref args, modifiers, culture, namedParameters, out state);
- if (m == null) {
- throwMissingMethodException = true;
- } else {
- object result = m.Invoke (target, invokeAttr, binder, args, culture);
- binder.ReorderArgumentArray (ref args, state);
- return result;
- }
+ if (m == null)
+ throw new MissingMethodException ();
+ object result = m.Invoke (target, invokeAttr, binder, args, culture);
+ binder.ReorderArgumentArray (ref args, state);
+ return result;
}
if ((invokeAttr & BindingFlags.GetField) != 0) {
FieldInfo f = GetField (name, invokeAttr);
if (f != null) {
return f.GetValue (target);
} else if ((invokeAttr & BindingFlags.GetProperty) == 0) {
- throwMissingFieldException = true;
+ throw new MissingFieldException ();
}
/* try GetProperty */
} else if ((invokeAttr & BindingFlags.SetField) != 0) {
@@ -368,7 +364,7 @@ namespace System
f.SetValue (target, args [0]);
return null;
} else if ((invokeAttr & BindingFlags.SetProperty) == 0) {
- throwMissingFieldException = true;
+ throw new MissingFieldException ();
}
/* try SetProperty */
}
@@ -388,13 +384,11 @@ namespace System
smethods [count++] = mb;
}
MethodBase m = binder.BindToMethod (invokeAttr, smethods, ref args, modifiers, culture, namedParameters, out state);
- if (m == null) {
- throwMissingFieldException = true;
- } else {
- object result = m.Invoke (target, invokeAttr, binder, args, culture);
- binder.ReorderArgumentArray (ref args, state);
- return result;
- }
+ if (m == null)
+ throw new MissingFieldException ();
+ object result = m.Invoke (target, invokeAttr, binder, args, culture);
+ binder.ReorderArgumentArray (ref args, state);
+ return result;
} else if ((invokeAttr & BindingFlags.SetProperty) != 0) {
PropertyInfo[] properties = GetPropertiesByName (name, invokeAttr, ignoreCase, this);
object state = null;
@@ -411,19 +405,12 @@ namespace System
smethods [count++] = mb;
}
MethodBase m = binder.BindToMethod (invokeAttr, smethods, ref args, modifiers, culture, namedParameters, out state);
- if (m == null) {
- throwMissingFieldException = true;
- } else {
- object result = m.Invoke (target, invokeAttr, binder, args, culture);
- binder.ReorderArgumentArray (ref args, state);
- return result;
- }
+ if (m == null)
+ throw new MissingFieldException ();
+ object result = m.Invoke (target, invokeAttr, binder, args, culture);
+ binder.ReorderArgumentArray (ref args, state);
+ return result;
}
- if (throwMissingMethodException)
- throw new MissingMethodException();
- if (throwMissingFieldException)
- throw new MissingFieldException();
-
return null;
}