parser: fix default init for ALabel and ASelfExpr
[nit.git] / src / parser / parser_nodes.nit
index 1c0eb21..1cadb05 100644 (file)
@@ -352,11 +352,17 @@ abstract class Prod
        do
                var res = new Array[AAnnotation]
                var nas = n_annotations
-               if nas == null then return res
-               for na in nas.n_items do
+               if nas != null then for na in nas.n_items do
                        if na.name != name then continue
                        res.add(na)
                end
+               if self isa AClassdef then for na in n_propdefs do
+                       if na isa AAnnotPropdef then
+                               if na.name != name then continue
+                               res.add na
+                       end
+               end
+
                return res
        end
 
@@ -1067,12 +1073,13 @@ class AStdClassdef
        # The extern block code
        var n_extern_code_block: nullable AExternCodeBlock = null is writable
 
-       # The list of super-classes
-       var n_superclasses = new ANodes[ASuperclass](self)
-
        # The `end` keyword
        var n_kwend: TKwend is writable, noinit
 
+       fun n_superclasses: Array[ASuperPropdef] do
+               return [for d in n_propdefs do if d isa ASuperPropdef then d]
+       end
+
        redef fun hot_location do return n_id.location
 end
 
@@ -1148,17 +1155,6 @@ class AFormaldef
        var n_type: nullable AType = null is writable
 end
 
-# A super-class. eg `super X`
-class ASuperclass
-       super Prod
-
-       # The super keyword
-       var n_kwsuper: TKwsuper is writable, noinit
-
-       # The super-class (indicated as a type)
-       var n_type: AType is writable, noinit
-end
-
 # The definition of a property
 abstract class APropdef
        super ADefinition
@@ -1237,6 +1233,23 @@ class AMainMethPropdef
        super AMethPropdef
 end
 
+class AAnnotPropdef
+       super APropdef
+       super AAnnotation
+end
+
+# A super-class. eg `super X`
+class ASuperPropdef
+       super APropdef
+
+       # The super keyword
+       var n_kwsuper: TKwsuper is writable, noinit
+
+       # The super-class (indicated as a type)
+       var n_type: AType is writable, noinit
+end
+
+
 # Declaration of callbacks for extern methods
 class AExternCalls
        super Prod
@@ -1585,7 +1598,7 @@ class ALabel
        var n_kwlabel: TKwlabel is writable, noinit
 
        # The name of the label, if any
-       var n_id: nullable TId is writable
+       var n_id: nullable TId is writable, noinit
 end
 
 # Expression and statements
@@ -2209,7 +2222,7 @@ class ASelfExpr
        super AExpr
 
        # The `self` keyword
-       var n_kwself: nullable TKwself is writable
+       var n_kwself: nullable TKwself = null is writable
 end
 
 # When there is no explicit receiver, `self` is implicit