comp: clean AAttrPropdef#compile_to_c
authorJean Privat <jean@pryen.org>
Mon, 21 Jul 2014 19:58:00 +0000 (15:58 -0400)
committerJean Privat <jean@pryen.org>
Tue, 22 Jul 2014 11:58:09 +0000 (07:58 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/abstract_compiler.nit

index 8015a5a..ac308b2 100644 (file)
@@ -2121,11 +2121,15 @@ end
 redef class AAttrPropdef
        redef fun compile_to_c(v, mpropdef, arguments)
        do
-               if arguments.length == 1 then
+               if mpropdef == mreadpropdef then
+                       assert arguments.length == 1
                        var res = v.read_attribute(self.mpropdef.mproperty, arguments.first)
                        v.assign(v.frame.returnvar.as(not null), res)
-               else
+               else if mpropdef == mwritepropdef then
+                       assert arguments.length == 2
                        v.write_attribute(self.mpropdef.mproperty, arguments.first, arguments[1])
+               else
+                       abort
                end
        end