nitgg: use is_toplevel instead of heuristics to not customize top-level methods
authorJean Privat <jean@pryen.org>
Thu, 14 Aug 2014 00:25:12 +0000 (20:25 -0400)
committerJean Privat <jean@pryen.org>
Thu, 14 Aug 2014 00:25:12 +0000 (20:25 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/global_compiler.nit

index 0905ca8..9a82243 100644 (file)
@@ -480,7 +480,8 @@ class GlobalCompilerVisitor
        do
                check_valid_reciever(recvtype)
                #debug("call {m} on {recvtype} on {args.first}:{args.first.mtype}")
-               if m.mclassdef.mclass.name == "Object" and recvtype.ctype == "val*" then
+               if m.mproperty.is_toplevel then
+                       # Do not customize top-level methods
                        recvtype = m.mclassdef.bound_mtype
                end
                return recvtype