modelize_classes: top-level methods are defined in Sys, not Object
authorJean Privat <jean@pryen.org>
Wed, 8 Apr 2015 13:14:19 +0000 (20:14 +0700)
committerJean Privat <jean@pryen.org>
Fri, 10 Apr 2015 10:31:53 +0000 (17:31 +0700)
Signed-off-by: Jean Privat <jean@pryen.org>

src/modelize/modelize_class.nit

index 3c54891..ae4e4c2 100644 (file)
@@ -75,20 +75,21 @@ redef class ModelBuilder
                                names.add(ptname)
                        end
 
-               else if nclassdef isa ATopClassdef then
+               else if nclassdef isa ATopClassdef and nclassdef.n_propdefs.first.as(AMethPropdef).n_methid.collect_text == "sys" then
+                       # Special case to keep `sys` in object.
+                       # Needed to keep working bootstrap and a working java FFI together.
+                       # TODO: remove once safe to remove
                        name = "Object"
                        nkind = null
                        mkind = interface_kind
                        nvisibility = null
                        mvisibility = public_visibility
-               else if nclassdef isa AMainClassdef then
+               else
                        name = "Sys"
                        nkind = null
                        mkind = concrete_kind
                        nvisibility = null
                        mvisibility = public_visibility
-               else
-                       abort
                end
 
                var mclass = try_get_mclass_by_name(nclassdef, mmodule, name)