aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-07-13 11:19:26 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-07-13 11:19:26 +0200
commit5d5294ae25c1f7569bd3a7cd894a4ac2b4b99889 (patch)
tree6e044be152ef40033aa6f256873bbf984151df84
parent4181ca7888b9d544c12abb67046c445567b682cf (diff)
remove try/catch from types searches
-rw-r--r--Crow/src/IML/CompilerServices.cs59
1 files changed, 26 insertions, 33 deletions
diff --git a/Crow/src/IML/CompilerServices.cs b/Crow/src/IML/CompilerServices.cs
index 75248505..4ad57009 100644
--- a/Crow/src/IML/CompilerServices.cs
+++ b/Crow/src/IML/CompilerServices.cs
@@ -412,29 +412,24 @@ namespace Crow.IML
{
foundMI = null;
if (assembly == null)
- return false;
- try
- {
-
- foreach (Type t in assembly.GetExportedTypes().Where
- (ty => ty.IsDefined (typeof (ExtensionAttribute), false))) {
- foreach (MethodInfo mi in t.GetMethods
- (BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).Where
- (m=> m.Name == methodName && m.IsDefined (typeof (ExtensionAttribute), false) &&
- m.GetParameters ().Length > 0)) {
- Type curType = extendedType;
- while (curType != null) {
- if (mi.GetParameters () [0].ParameterType == curType) {
- foundMI = mi;
- return true;
- }
- curType = curType.BaseType;
- }
- }
-
- }
- }
- catch (System.Exception) {}
+ return false;
+ foreach (Type t in assembly.GetExportedTypes().Where
+ (ty => ty.IsDefined (typeof (ExtensionAttribute), false))) {
+ foreach (MethodInfo mi in t.GetMethods
+ (BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).Where
+ (m=> m.Name == methodName && m.IsDefined (typeof (ExtensionAttribute), false) &&
+ m.GetParameters ().Length > 0)) {
+ Type curType = extendedType;
+ while (curType != null) {
+ if (mi.GetParameters () [0].ParameterType == curType) {
+ foundMI = mi;
+ return true;
+ }
+ curType = curType.BaseType;
+ }
+ }
+
+ }
return false;
}
/// <summary>
@@ -874,16 +869,14 @@ namespace Crow.IML
knownTypes.Add (strDataType, dataType);
return dataType;
}
- foreach (Assembly a in Interface.crowAssemblies) {
- try {
- foreach (Type expT in a.GetExportedTypes ()) {
- if (expT.Name != strDataType && expT.FullName != strDataType)
- continue;
- if (!knownTypes.ContainsKey(strDataType))
- knownTypes.Add (strDataType, expT);
- return expT;
- }
- }catch{}
+ foreach (Assembly a in Interface.crowAssemblies) {
+ foreach (Type expT in a.GetExportedTypes ()) {
+ if (expT.Name != strDataType && expT.FullName != strDataType)
+ continue;
+ if (!knownTypes.ContainsKey(strDataType))
+ knownTypes.Add (strDataType, expT);
+ return expT;
+ }
}
knownTypes.Add (strDataType, null);
return null;