analysis: add logs for reachable from init analysis
authorJean-Sebastien Gelinas <calestar@gmail.com>
Wed, 21 Oct 2009 19:33:33 +0000 (15:33 -0400)
committerJean Privat <jean@pryen.org>
Mon, 11 Jan 2010 21:52:31 +0000 (16:52 -0500)
Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

src/analysis/analysis.nit
src/analysis/reachable_from_init_method_analysis.nit

index 881cfec..70c8a70 100644 (file)
@@ -96,6 +96,8 @@ redef class Program
                dump_instantiated_types(directory_name)
                dump_not_instantiated_types(directory_name)
                dump_reachable_as_init_methods(directory_name)
+               dump_reachable_methods_from_init(directory_name)
+               dump_unreachable_methods_from_init(directory_name)
        end
 end
 
index ae055d6..9c0f78c 100644 (file)
@@ -24,6 +24,30 @@ import reachable_method_analysis
 redef class Program
        # This attribute is the ReachableFromInitMethodAnalysis results
        readable writable var _rfima: nullable ReachableFromInitMethodAnalysis = null
+
+       # This method will create a file and output the name of all methods reachable
+       # from an init in it
+       fun dump_reachable_methods_from_init(directory_name: String) do
+               var f = new OFStream.open("{directory_name}/{module.name}.reachable_methods_from_init.log")
+               with_each_methods !action(m) do
+                       if rfima.is_method_reachable_from_init(m) then
+                               f.write("{m.full_name}\n")
+                       end
+               end
+               f.close
+       end
+
+       # This method will create a file and output the name of all reachable methods that
+       # can not be reached from an init in it
+       fun dump_unreachable_methods_from_init(directory_name: String) do
+               var f = new OFStream.open("{directory_name}/{module.name}.unreachable_methods_from_init.log")
+               with_each_methods !action(m) do
+                       if not rfima.is_method_reachable_from_init(m) and rma.is_method_reachable(m) then
+                               f.write("{m.full_name}\n")
+                       end
+               end
+               f.close
+       end
 end
 
 # Subclasses of this class would represent an analysis that produces