analysis: fix RTA to say that at least primitive types are always instantiated (even...
authorJean-Sebastien Gelinas <calestar@gmail.com>
Mon, 21 Sep 2009 21:10:06 +0000 (17:10 -0400)
committerJean Privat <jean@pryen.org>
Mon, 11 Jan 2010 21:52:27 +0000 (16:52 -0500)
Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

src/analysis/rta_analysis.nit

index 04473fd..000510e 100644 (file)
@@ -161,7 +161,15 @@ class RtaBuilder
 
        # Build the context associated with this builder
        fun work do
-               if program.main_method == null then return
+               if program.main_method == null then
+                       # Add primitive type (so that compiling works)
+                       for t in ["Int","Char","Bool"] do
+                               if program.module.has_global_class_named(t.to_symbol) then
+                                       add_instantiated_class(program.module.class_by_name(t.to_symbol))
+                               end
+                       end
+                       return
+               end
 
                add_instantiated_class(program.main_class.as(not null))
                add_reachable_iroutine(program.main_method.as(not null).iroutine)