Author: spouliot
Date: 2008-02-15 09:36:19 -0500 (Fri, 15 Feb 2008)
New Revision: 95756

Modified:
   trunk/mono-tools/gendarme/framework/Gendarme.Framework/ChangeLog
   trunk/mono-tools/gendarme/framework/Gendarme.Framework/Runner.cs
Log:
2008-02-15  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * Runner.cs: Use Rocks to iterate all methods in a type.



Modified: trunk/mono-tools/gendarme/framework/Gendarme.Framework/ChangeLog
===================================================================
--- trunk/mono-tools/gendarme/framework/Gendarme.Framework/ChangeLog    
2008-02-15 14:34:55 UTC (rev 95755)
+++ trunk/mono-tools/gendarme/framework/Gendarme.Framework/ChangeLog    
2008-02-15 14:36:19 UTC (rev 95756)
@@ -1,3 +1,7 @@
+2008-02-15  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * Runner.cs: Use Rocks to iterate all methods in a type.
+
 2008-02-14  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * AssemblyResolver.cs: Shameless copy of Linker AssemblyResolver

Modified: trunk/mono-tools/gendarme/framework/Gendarme.Framework/Runner.cs
===================================================================
--- trunk/mono-tools/gendarme/framework/Gendarme.Framework/Runner.cs    
2008-02-15 14:34:55 UTC (rev 95755)
+++ trunk/mono-tools/gendarme/framework/Gendarme.Framework/Runner.cs    
2008-02-15 14:36:19 UTC (rev 95756)
@@ -33,6 +33,8 @@
 using Mono.Cecil;
 using Mono.Cecil.Cil;
 
+using Gendarme.Framework.Rocks;
+
 namespace Gendarme.Framework {
 
        abstract public class Runner : IRunner {
@@ -250,20 +252,11 @@
                /// the rule Check* method was called or RuleResult.Success 
otherwise</returns>
                public RuleResult CurrentRuleResult {
                        get {
-                               return (Defects.Count > defectCountBeforeCheck) 
? 
+                               return (Defects.Count > defectCountBeforeCheck) 
?
                                        RuleResult.Failure : RuleResult.Success;
                        }
                }
 
-               // do a single foreach to get both constructors and methods for 
a type
-               private IEnumerable<MethodDefinition> GetMethods 
(TypeDefinition type)
-               {
-                       foreach (MethodDefinition ctor in type.Constructors)
-                               yield return ctor;
-                       foreach (MethodDefinition method in type.Methods)
-                               yield return method;
-               }
-
                /// <summary>
                /// For all assemblies, every modules in each assembly, every 
                /// type in each module, every methods in each type call all
@@ -288,7 +281,7 @@
                                                runner_args.CurrentType = type;
                                                OnType (runner_args);
 
-                                               foreach (MethodDefinition 
method in GetMethods (type)) {
+                                               foreach (MethodDefinition 
method in type.AllMethods()) {
                                                        currentTarget = 
(IMetadataTokenProvider) method;
                                                        
runner_args.CurrentMethod = method;
                                                        OnMethod (runner_args);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to