src: remove remaining references of subclasses on AMethPropdef
[nit.git] / src / transform.nit
index af19ef6..06bdcb6 100644 (file)
@@ -88,13 +88,14 @@ redef class AVardeclExpr
        #
        # Declarations are only useful for scope rules
        # Once names are associated with real objects, ther declaration become useless
-       # Therefore, if there is no initial value, then just detach it
+       # Therefore, if there is no initial value, then just ignore it
        # Else, replace it with a simple assignment
        redef fun accept_transform_visitor(v)
        do
                var nexpr = n_expr
                if nexpr == null then
-                       detach
+                       # do nothing
+                       # note: not detached because the collection is currently under iteration
                else
                        var nvar = v.builder.make_var_assign(self.variable.as(not null), nexpr)
                        replace_with(nvar)
@@ -128,6 +129,13 @@ redef class AOrExpr
        end
 end
 
+redef class AImpliesExpr
+       redef fun accept_transform_visitor(v)
+       do
+               # TODO
+       end
+end
+
 redef class AAndExpr
        # `x and y` is replaced with `if x then y else x`
        redef fun accept_transform_visitor(v)
@@ -192,6 +200,8 @@ redef class ASuperstringExpr
        #     t.to_s
        redef fun accept_transform_visitor(v)
        do
+               if true then return # FIXME: transformation disabled for the moment
+
                var nblock = v.builder.make_block
 
                var arraytype = v.get_class(self, "Array").get_mtype([v.get_class(self, "Object").mclass_type])
@@ -218,9 +228,7 @@ redef class ACrangeExpr
        redef fun accept_transform_visitor(v)
        do
                var mtype = self.mtype.as(MClassType)
-               var meth = v.get_method(self, "init", mtype.mclass)
-
-               replace_with(v.builder.make_new(mtype, meth, [n_expr, n_expr2]))
+               replace_with(v.builder.make_new(mtype, init_callsite.mproperty, [n_expr, n_expr2]))
        end
 end
 
@@ -229,9 +237,7 @@ redef class AOrangeExpr
        redef fun accept_transform_visitor(v)
        do
                var mtype = self.mtype.as(MClassType)
-               var meth = v.get_method(self, "without_last", mtype.mclass)
-
-               replace_with(v.builder.make_new(mtype, meth, [n_expr, n_expr2]))
+               replace_with(v.builder.make_new(mtype, init_callsite.mproperty, [n_expr, n_expr2]))
        end
 end
 
@@ -282,7 +288,8 @@ redef class AVarReassignExpr
        do
                var variable = self.variable.as(not null)
 
-               var nread = v.builder.make_var_read(variable)
+               var nread = v.builder.make_var_read(variable, read_type.as(not null))
+
                var nnewvalue = v.builder.make_call(nread, reassign_callsite.mproperty, [n_value])
                var nwrite = v.builder.make_var_assign(variable, nnewvalue)