syntax: "super" is a synonym of "special"
[nit.git] / src / parser / parser_prod.nit
index e356c4c..8c6edcf 100644 (file)
@@ -863,12 +863,19 @@ redef class ASuperclass
 
     init init_asuperclass (
             n_kwspecial: nullable TKwspecial,
+            n_kwsuper: nullable TKwsuper,
             n_type: nullable AType
     )
     do
         empty_init
-        _n_kwspecial = n_kwspecial.as(not null)
-       n_kwspecial.parent = self
+        _n_kwspecial = n_kwspecial
+       if n_kwspecial != null then
+               n_kwspecial.parent = self
+       end
+        _n_kwsuper = n_kwsuper
+       if n_kwsuper != null then
+               n_kwsuper.parent = self
+       end
         _n_type = n_type.as(not null)
        n_type.parent = self
     end
@@ -881,7 +888,17 @@ redef class ASuperclass
                assert new_child isa TKwspecial
                 _n_kwspecial = new_child
            else
-               abort
+               _n_kwspecial = null
+            end
+            return
+       end
+        if _n_kwsuper == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TKwsuper
+                _n_kwsuper = new_child
+           else
+               _n_kwsuper = null
             end
             return
        end
@@ -899,7 +916,12 @@ redef class ASuperclass
 
     redef fun visit_all(v: Visitor)
     do
-        v.enter_visit(_n_kwspecial)
+        if _n_kwspecial != null then
+            v.enter_visit(_n_kwspecial.as(not null))
+        end
+        if _n_kwsuper != null then
+            v.enter_visit(_n_kwsuper.as(not null))
+        end
         v.enter_visit(_n_type)
     end
 end