tools: add a function to go through every classes in the program
authorJean-Sebastien Gelinas <calestar@gmail.com>
Fri, 18 Sep 2009 20:47:02 +0000 (16:47 -0400)
committerJean Privat <jean@pryen.org>
Mon, 11 Jan 2010 21:52:25 +0000 (16:52 -0500)
Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

src/program.nit

index 07c5277..63572e3 100644 (file)
@@ -208,6 +208,16 @@ class Program
                end
        end
 
+       # This function will call the attached block for each live local classes
+       # in this program
+       fun with_each_live_local_classes
+               !action(m: MMLocalClass)
+       do
+               for c in module.local_classes do
+                       action(c)
+               end
+       end
+
        init(m: MMModule, toolcontext: ToolContext) do
                _module = m
                _tc = toolcontext