engines: implement special fall-back to sys
authorJean Privat <jean@pryen.org>
Wed, 8 Apr 2015 13:11:35 +0000 (20:11 +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/compiler/abstract_compiler.nit
src/interpreter/naive_interpreter.nit

index 3956744..059961f 100644 (file)
@@ -2521,6 +2521,13 @@ redef class ASelfExpr
        redef fun expr(v) do return v.frame.arguments.first
 end
 
+redef class AImplicitSelfExpr
+       redef fun expr(v) do
+               if not is_sys then return super
+               return v.new_expr("glob_sys", mtype.as(not null))
+       end
+end
+
 redef class AEscapeExpr
        redef fun stmt(v) do v.add("goto BREAK_{v.escapemark_name(self.escapemark)};")
 end
index 8818874..7e1c9db 100644 (file)
@@ -1321,6 +1321,14 @@ redef class ASelfExpr
        end
 end
 
+redef class AImplicitSelfExpr
+       redef fun expr(v)
+       do
+               if not is_sys then return super
+               return v.mainobj
+       end
+end
+
 redef class AEscapeExpr
        redef fun stmt(v)
        do