engines: the entry point is `sys.run` or else `sys.main`
[nit.git] / src / rapid_type_analysis.nit
index b2683c2..bb11a4c 100644 (file)
@@ -88,7 +88,7 @@ class RapidTypeAnalysis
                var mtype = callsite.recv
                var anchor = callsite.anchor
                if anchor != null then mtype = mtype.anchor_to(callsite.mmodule, anchor)
-               if mtype isa MNullableType then mtype = mtype.mtype
+               mtype = mtype.as_notnullable
                assert mtype isa MClassType
                mtype = mtype.mclass.intro.bound_mtype
                var mproperty = callsite.mproperty
@@ -190,7 +190,8 @@ class RapidTypeAnalysis
                if initprop != null then
                        add_send(maintype, initprop)
                end
-               var mainprop = mainmodule.try_get_primitive_method("main", maintype.mclass)
+               var mainprop = mainmodule.try_get_primitive_method("run", maintype.mclass) or else
+                       mainmodule.try_get_primitive_method("main", maintype.mclass)
                if mainprop != null then
                        add_send(maintype, mainprop)
                end
@@ -457,7 +458,7 @@ class RapidTypeVisitor
        do
                mtype = mtype.anchor_to(self.analysis.mainmodule, self.receiver)
                if mtype isa MNullType then return null
-               if mtype isa MNullableType then mtype = mtype.mtype
+               mtype = mtype.as_notnullable
                assert mtype isa MClassType
                assert not mtype.need_anchor
                return mtype