parser: inits uses Collection instead of Array
[nit.git] / src / parser / parser_prod.nit
index 5e312dc..92f9525 100644 (file)
@@ -72,6 +72,9 @@ redef class Prod
                if first_token == null then
                        return "????"
                end
+               if last_token == null then
+                       return "{first_token.locate}--????"
+               end
                var lastpos = last_token.pos + last_token.text.length - 1
                if first_token.line == last_token.line then
                        return "{first_token.locate}--{lastpos}"
@@ -119,10 +122,11 @@ redef class AModule
 
     init init_amodule (
             n_packagedecl: PPackagedecl ,
-            n_imports: Array[Object] , # Should be Array[PImport]
-            n_classdefs: Array[Object]  # Should be Array[PClassdef]
+            n_imports: Collection[Object] , # Should be Collection[PImport]
+            n_classdefs: Collection[Object]  # Should be Collection[PClassdef]
     )
     do
+        empty_init
         _n_packagedecl = n_packagedecl
        if n_packagedecl != null then
                n_packagedecl.parent = self
@@ -245,6 +249,7 @@ redef class APackagedecl
             n_id: TId 
     )
     do
+        empty_init
         _n_doc = n_doc
        if n_doc != null then
                n_doc.parent = self
@@ -351,6 +356,7 @@ redef class AImport
             n_id: TId 
     )
     do
+        empty_init
         _n_visibility = n_visibility
        if n_visibility != null then
                n_visibility.parent = self
@@ -457,6 +463,7 @@ redef class ANoImport
             n_kwend: TKwend 
     )
     do
+        empty_init
         _n_visibility = n_visibility
        if n_visibility != null then
                n_visibility.parent = self
@@ -538,6 +545,7 @@ redef class APublicVisibility
 
     init init_apublicvisibility
     do
+        empty_init
     end
 
     redef meth replace_child(old_child: PNode, new_child: PNode)
@@ -568,6 +576,7 @@ redef class APrivateVisibility
             n_kwprivate: TKwprivate 
     )
     do
+        empty_init
         _n_kwprivate = n_kwprivate
        if n_kwprivate != null then
                n_kwprivate.parent = self
@@ -618,6 +627,7 @@ redef class AProtectedVisibility
             n_kwprotected: TKwprotected 
     )
     do
+        empty_init
         _n_kwprotected = n_kwprotected
        if n_kwprotected != null then
                n_kwprotected.parent = self
@@ -668,6 +678,7 @@ redef class AIntrudeVisibility
             n_kwintrude: TKwintrude 
     )
     do
+        empty_init
         _n_kwintrude = n_kwintrude
        if n_kwintrude != null then
                n_kwintrude.parent = self
@@ -748,11 +759,12 @@ redef class AClassdef
             n_visibility: PVisibility ,
             n_classkind: PClasskind ,
             n_id: TClassid ,
-            n_formaldefs: Array[Object] , # Should be Array[PFormaldef]
-            n_superclasses: Array[Object] , # Should be Array[PSuperclass]
-            n_propdefs: Array[Object]  # Should be Array[PPropdef]
+            n_formaldefs: Collection[Object] , # Should be Collection[PFormaldef]
+            n_superclasses: Collection[Object] , # Should be Collection[PSuperclass]
+            n_propdefs: Collection[Object]  # Should be Collection[PPropdef]
     )
     do
+        empty_init
         _n_doc = n_doc
        if n_doc != null then
                n_doc.parent = self
@@ -957,9 +969,10 @@ redef class ATopClassdef
     private init empty_init do end
 
     init init_atopclassdef (
-            n_propdefs: Array[Object]  # Should be Array[PPropdef]
+            n_propdefs: Collection[Object]  # Should be Collection[PPropdef]
     )
     do
+        empty_init
         _n_propdefs = new List[PPropdef]
        for n in n_propdefs do
                assert n isa PPropdef
@@ -1008,9 +1021,10 @@ redef class AMainClassdef
     private init empty_init do end
 
     init init_amainclassdef (
-            n_propdefs: Array[Object]  # Should be Array[PPropdef]
+            n_propdefs: Collection[Object]  # Should be Collection[PPropdef]
     )
     do
+        empty_init
         _n_propdefs = new List[PPropdef]
        for n in n_propdefs do
                assert n isa PPropdef
@@ -1069,6 +1083,7 @@ redef class AConcreteClasskind
             n_kwclass: TKwclass 
     )
     do
+        empty_init
         _n_kwclass = n_kwclass
        if n_kwclass != null then
                n_kwclass.parent = self
@@ -1127,6 +1142,7 @@ redef class AAbstractClasskind
             n_kwclass: TKwclass 
     )
     do
+        empty_init
         _n_kwabstract = n_kwabstract
        if n_kwabstract != null then
                n_kwabstract.parent = self
@@ -1197,6 +1213,7 @@ redef class AInterfaceClasskind
             n_kwinterface: TKwinterface 
     )
     do
+        empty_init
         _n_kwinterface = n_kwinterface
        if n_kwinterface != null then
                n_kwinterface.parent = self
@@ -1247,6 +1264,7 @@ redef class AUniversalClasskind
             n_kwuniversal: TKwuniversal 
     )
     do
+        empty_init
         _n_kwuniversal = n_kwuniversal
        if n_kwuniversal != null then
                n_kwuniversal.parent = self
@@ -1305,6 +1323,7 @@ redef class AFormaldef
             n_type: PType 
     )
     do
+        empty_init
         _n_id = n_id
        if n_id != null then
                n_id.parent = self
@@ -1383,6 +1402,7 @@ redef class ASuperclass
             n_type: PType 
     )
     do
+        empty_init
         _n_kwspecial = n_kwspecial
        if n_kwspecial != null then
                n_kwspecial.parent = self
@@ -1481,6 +1501,13 @@ redef class AAttrPropdef
            n.parent = self
         end
     end
+    redef meth n_kwvar=(n: TKwvar)
+    do
+        _n_kwvar = n
+        if n != null then
+           n.parent = self
+        end
+    end
     redef meth n_id=(n: TAttrid)
     do
         _n_id = n
@@ -1512,11 +1539,13 @@ redef class AAttrPropdef
             n_kwredef: TKwredef ,
             n_visibility: PVisibility ,
             n_kwattr: TKwattr ,
+            n_kwvar: TKwvar ,
             n_id: TAttrid ,
             n_type: PType ,
             n_expr: PExpr 
     )
     do
+        empty_init
         _n_doc = n_doc
        if n_doc != null then
                n_doc.parent = self
@@ -1541,6 +1570,10 @@ redef class AAttrPropdef
        if n_kwattr != null then
                n_kwattr.parent = self
        end
+        _n_kwvar = n_kwvar
+       if n_kwvar != null then
+               n_kwvar.parent = self
+       end
         _n_id = n_id
        if n_id != null then
                n_id.parent = self
@@ -1618,6 +1651,16 @@ redef class AAttrPropdef
             end
             return
        end
+        if _n_kwvar == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TKwvar
+                _n_kwvar = new_child
+           else
+               _n_kwvar = null
+            end
+            return
+       end
         if _n_id == old_child then
             if new_child != null then
                 new_child.parent = self
@@ -1670,6 +1713,9 @@ redef class AAttrPropdef
         if _n_kwattr != null then
             v.visit(_n_kwattr)
         end
+        if _n_kwvar != null then
+            v.visit(_n_kwvar)
+        end
         if _n_id != null then
             v.visit(_n_id)
         end
@@ -1701,6 +1747,9 @@ redef class AAttrPropdef
         if _n_kwattr != null then
             v.visit(_n_kwattr)
         end
+        if _n_kwvar != null then
+            v.visit(_n_kwvar)
+        end
         if _n_id != null then
             v.visit(_n_id)
         end
@@ -1759,6 +1808,7 @@ redef class AMethPropdef
             n_signature: PSignature 
     )
     do
+        empty_init
         _n_doc = n_doc
        if n_doc != null then
                n_doc.parent = self
@@ -1929,6 +1979,7 @@ redef class ADeferredMethPropdef
             n_signature: PSignature 
     )
     do
+        empty_init
         _n_doc = n_doc
        if n_doc != null then
                n_doc.parent = self
@@ -2119,6 +2170,7 @@ redef class AInternMethPropdef
             n_signature: PSignature 
     )
     do
+        empty_init
         _n_doc = n_doc
        if n_doc != null then
                n_doc.parent = self
@@ -2317,6 +2369,7 @@ redef class AExternMethPropdef
             n_extern: TString 
     )
     do
+        empty_init
         _n_doc = n_doc
        if n_doc != null then
                n_doc.parent = self
@@ -2535,6 +2588,7 @@ redef class AConcreteMethPropdef
             n_block: PExpr 
     )
     do
+        empty_init
         _n_doc = n_doc
        if n_doc != null then
                n_doc.parent = self
@@ -2753,6 +2807,7 @@ redef class AConcreteInitPropdef
             n_block: PExpr 
     )
     do
+        empty_init
         _n_doc = n_doc
        if n_doc != null then
                n_doc.parent = self
@@ -2931,6 +2986,7 @@ redef class AMainMethPropdef
             n_block: PExpr 
     )
     do
+        empty_init
         _n_kwredef = n_kwredef
        if n_kwredef != null then
                n_kwredef.parent = self
@@ -3041,6 +3097,7 @@ redef class ATypePropdef
             n_type: PType 
     )
     do
+        empty_init
         _n_doc = n_doc
        if n_doc != null then
                n_doc.parent = self
@@ -3199,6 +3256,7 @@ redef class AReadAble
             n_kwreadable: TKwreadable 
     )
     do
+        empty_init
         _n_kwredef = n_kwredef
        if n_kwredef != null then
                n_kwredef.parent = self
@@ -3277,6 +3335,7 @@ redef class AWriteAble
             n_kwwritable: TKwwritable 
     )
     do
+        empty_init
         _n_kwredef = n_kwredef
        if n_kwredef != null then
                n_kwredef.parent = self
@@ -3347,6 +3406,7 @@ redef class AIdMethid
             n_id: TId 
     )
     do
+        empty_init
         _n_id = n_id
        if n_id != null then
                n_id.parent = self
@@ -3397,6 +3457,7 @@ redef class APlusMethid
             n_plus: TPlus 
     )
     do
+        empty_init
         _n_plus = n_plus
        if n_plus != null then
                n_plus.parent = self
@@ -3447,6 +3508,7 @@ redef class AMinusMethid
             n_minus: TMinus 
     )
     do
+        empty_init
         _n_minus = n_minus
        if n_minus != null then
                n_minus.parent = self
@@ -3497,6 +3559,7 @@ redef class AStarMethid
             n_star: TStar 
     )
     do
+        empty_init
         _n_star = n_star
        if n_star != null then
                n_star.parent = self
@@ -3547,6 +3610,7 @@ redef class ASlashMethid
             n_slash: TSlash 
     )
     do
+        empty_init
         _n_slash = n_slash
        if n_slash != null then
                n_slash.parent = self
@@ -3597,6 +3661,7 @@ redef class APercentMethid
             n_percent: TPercent 
     )
     do
+        empty_init
         _n_percent = n_percent
        if n_percent != null then
                n_percent.parent = self
@@ -3647,6 +3712,7 @@ redef class AEqMethid
             n_eq: TEq 
     )
     do
+        empty_init
         _n_eq = n_eq
        if n_eq != null then
                n_eq.parent = self
@@ -3697,6 +3763,7 @@ redef class ANeMethid
             n_ne: TNe 
     )
     do
+        empty_init
         _n_ne = n_ne
        if n_ne != null then
                n_ne.parent = self
@@ -3747,6 +3814,7 @@ redef class ALeMethid
             n_le: TLe 
     )
     do
+        empty_init
         _n_le = n_le
        if n_le != null then
                n_le.parent = self
@@ -3797,6 +3865,7 @@ redef class AGeMethid
             n_ge: TGe 
     )
     do
+        empty_init
         _n_ge = n_ge
        if n_ge != null then
                n_ge.parent = self
@@ -3847,6 +3916,7 @@ redef class ALtMethid
             n_lt: TLt 
     )
     do
+        empty_init
         _n_lt = n_lt
        if n_lt != null then
                n_lt.parent = self
@@ -3897,6 +3967,7 @@ redef class AGtMethid
             n_gt: TGt 
     )
     do
+        empty_init
         _n_gt = n_gt
        if n_gt != null then
                n_gt.parent = self
@@ -3955,6 +4026,7 @@ redef class ABraMethid
             n_cbra: TCbra 
     )
     do
+        empty_init
         _n_obra = n_obra
        if n_obra != null then
                n_obra.parent = self
@@ -4025,6 +4097,7 @@ redef class AStarshipMethid
             n_starship: TStarship 
     )
     do
+        empty_init
         _n_starship = n_starship
        if n_starship != null then
                n_starship.parent = self
@@ -4083,6 +4156,7 @@ redef class AAssignMethid
             n_assign: TAssign 
     )
     do
+        empty_init
         _n_id = n_id
        if n_id != null then
                n_id.parent = self
@@ -4169,6 +4243,7 @@ redef class ABraassignMethid
             n_assign: TAssign 
     )
     do
+        empty_init
         _n_obra = n_obra
        if n_obra != null then
                n_obra.parent = self
@@ -4256,10 +4331,12 @@ redef class ASignature
     private init empty_init do end
 
     init init_asignature (
-            n_params: Array[Object] , # Should be Array[PParam]
-            n_type: PType 
+            n_params: Collection[Object] , # Should be Collection[PParam]
+            n_type: PType ,
+            n_closure_decls: Collection[Object]  # Should be Collection[PClosureDecl]
     )
     do
+        empty_init
         _n_params = new List[PParam]
        for n in n_params do
                assert n isa PParam
@@ -4270,6 +4347,12 @@ redef class ASignature
        if n_type != null then
                n_type.parent = self
        end
+        _n_closure_decls = new List[PClosureDecl]
+       for n in n_closure_decls do
+               assert n isa PClosureDecl
+               _n_closure_decls.add(n)
+               n.parent = self
+       end
     end
 
     redef meth replace_child(old_child: PNode, new_child: PNode)
@@ -4297,6 +4380,18 @@ redef class ASignature
             end
             return
        end
+        for i in [0.._n_closure_decls.length[ do
+            if _n_closure_decls[i] == old_child then
+                if new_child != null then
+                   assert new_child isa PClosureDecl
+                    _n_closure_decls[i] = new_child
+                    new_child.parent = self
+                else
+                    _n_closure_decls.remove_at(i)
+                end
+                return
+            end
+        end
     end
 
     redef meth visit_all(v: Visitor)
@@ -4307,6 +4402,9 @@ redef class ASignature
         if _n_type != null then
             v.visit(_n_type)
         end
+            for n in _n_closure_decls do
+                v.visit(n)
+           end
     end
 
     redef meth visit_all_reverse(v: Visitor)
@@ -4321,6 +4419,13 @@ redef class ASignature
         if _n_type != null then
             v.visit(_n_type)
         end
+       do
+           var i = _n_closure_decls.length
+            while i >= 0 do
+                v.visit(_n_closure_decls[i])
+               i = i - 1
+           end
+       end
     end
 end
 redef class AParam
@@ -4354,6 +4459,7 @@ redef class AParam
             n_dotdotdot: TDotdotdot 
     )
     do
+        empty_init
         _n_id = n_id
        if n_id != null then
                n_id.parent = self
@@ -4429,6 +4535,169 @@ redef class AParam
         end
     end
 end
+redef class AClosureDecl
+    redef meth n_kwwith=(n: TKwwith)
+    do
+        _n_kwwith = n
+        if n != null then
+           n.parent = self
+        end
+    end
+    redef meth n_kwbreak=(n: TKwbreak)
+    do
+        _n_kwbreak = n
+        if n != null then
+           n.parent = self
+        end
+    end
+    redef meth n_id=(n: TId)
+    do
+        _n_id = n
+        if n != null then
+           n.parent = self
+        end
+    end
+    redef meth n_signature=(n: PSignature)
+    do
+        _n_signature = n
+        if n != null then
+           n.parent = self
+        end
+    end
+    redef meth n_expr=(n: PExpr)
+    do
+        _n_expr = n
+        if n != null then
+           n.parent = self
+        end
+    end
+
+    private init empty_init do end
+
+    init init_aclosuredecl (
+            n_kwwith: TKwwith ,
+            n_kwbreak: TKwbreak ,
+            n_id: TId ,
+            n_signature: PSignature ,
+            n_expr: PExpr 
+    )
+    do
+        empty_init
+        _n_kwwith = n_kwwith
+       if n_kwwith != null then
+               n_kwwith.parent = self
+       end
+        _n_kwbreak = n_kwbreak
+       if n_kwbreak != null then
+               n_kwbreak.parent = self
+       end
+        _n_id = n_id
+       if n_id != null then
+               n_id.parent = self
+       end
+        _n_signature = n_signature
+       if n_signature != null then
+               n_signature.parent = self
+       end
+        _n_expr = n_expr
+       if n_expr != null then
+               n_expr.parent = self
+       end
+    end
+
+    redef meth replace_child(old_child: PNode, new_child: PNode)
+    do
+        assert old_child != null
+        if _n_kwwith == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TKwwith
+                _n_kwwith = new_child
+           else
+               _n_kwwith = null
+            end
+            return
+       end
+        if _n_kwbreak == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TKwbreak
+                _n_kwbreak = new_child
+           else
+               _n_kwbreak = null
+            end
+            return
+       end
+        if _n_id == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TId
+                _n_id = new_child
+           else
+               _n_id = null
+            end
+            return
+       end
+        if _n_signature == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa PSignature
+                _n_signature = new_child
+           else
+               _n_signature = null
+            end
+            return
+       end
+        if _n_expr == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa PExpr
+                _n_expr = new_child
+           else
+               _n_expr = null
+            end
+            return
+       end
+    end
+
+    redef meth visit_all(v: Visitor)
+    do
+        if _n_kwwith != null then
+            v.visit(_n_kwwith)
+        end
+        if _n_kwbreak != null then
+            v.visit(_n_kwbreak)
+        end
+        if _n_id != null then
+            v.visit(_n_id)
+        end
+        if _n_signature != null then
+            v.visit(_n_signature)
+        end
+        if _n_expr != null then
+            v.visit(_n_expr)
+        end
+    end
+
+    redef meth visit_all_reverse(v: Visitor)
+    do
+        if _n_kwwith != null then
+            v.visit(_n_kwwith)
+        end
+        if _n_kwbreak != null then
+            v.visit(_n_kwbreak)
+        end
+        if _n_id != null then
+            v.visit(_n_id)
+        end
+        if _n_signature != null then
+            v.visit(_n_signature)
+        end
+        if _n_expr != null then
+            v.visit(_n_expr)
+        end
+    end
+end
 redef class AType
     redef meth n_id=(n: TClassid)
     do
@@ -4442,9 +4711,10 @@ redef class AType
 
     init init_atype (
             n_id: TClassid ,
-            n_types: Array[Object]  # Should be Array[PType]
+            n_types: Collection[Object]  # Should be Collection[PType]
     )
     do
+        empty_init
         _n_id = n_id
        if n_id != null then
                n_id.parent = self
@@ -4513,9 +4783,10 @@ redef class ABlockExpr
     private init empty_init do end
 
     init init_ablockexpr (
-            n_expr: Array[Object]  # Should be Array[PExpr]
+            n_expr: Collection[Object]  # Should be Collection[PExpr]
     )
     do
+        empty_init
         _n_expr = new List[PExpr]
        for n in n_expr do
                assert n isa PExpr
@@ -4606,6 +4877,7 @@ redef class AVardeclExpr
             n_expr: PExpr 
     )
     do
+        empty_init
         _n_kwvar = n_kwvar
        if n_kwvar != null then
                n_kwvar.parent = self
@@ -4744,6 +5016,7 @@ redef class AReturnExpr
             n_expr: PExpr 
     )
     do
+        empty_init
         _n_kwreturn = n_kwreturn
        if n_kwreturn != null then
                n_kwreturn.parent = self
@@ -4807,17 +5080,30 @@ redef class ABreakExpr
            n.parent = self
         end
     end
+    redef meth n_expr=(n: PExpr)
+    do
+        _n_expr = n
+        if n != null then
+           n.parent = self
+        end
+    end
 
     private init empty_init do end
 
     init init_abreakexpr (
-            n_kwbreak: TKwbreak 
+            n_kwbreak: TKwbreak ,
+            n_expr: PExpr 
     )
     do
+        empty_init
         _n_kwbreak = n_kwbreak
        if n_kwbreak != null then
                n_kwbreak.parent = self
        end
+        _n_expr = n_expr
+       if n_expr != null then
+               n_expr.parent = self
+       end
     end
 
     redef meth replace_child(old_child: PNode, new_child: PNode)
@@ -4833,6 +5119,16 @@ redef class ABreakExpr
             end
             return
        end
+        if _n_expr == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa PExpr
+                _n_expr = new_child
+           else
+               _n_expr = null
+            end
+            return
+       end
     end
 
     redef meth visit_all(v: Visitor)
@@ -4840,6 +5136,9 @@ redef class ABreakExpr
         if _n_kwbreak != null then
             v.visit(_n_kwbreak)
         end
+        if _n_expr != null then
+            v.visit(_n_expr)
+        end
     end
 
     redef meth visit_all_reverse(v: Visitor)
@@ -4847,6 +5146,9 @@ redef class ABreakExpr
         if _n_kwbreak != null then
             v.visit(_n_kwbreak)
         end
+        if _n_expr != null then
+            v.visit(_n_expr)
+        end
     end
 end
 redef class AAbortExpr
@@ -4864,6 +5166,7 @@ redef class AAbortExpr
             n_kwabort: TKwabort 
     )
     do
+        empty_init
         _n_kwabort = n_kwabort
        if n_kwabort != null then
                n_kwabort.parent = self
@@ -4907,17 +5210,30 @@ redef class AContinueExpr
            n.parent = self
         end
     end
+    redef meth n_expr=(n: PExpr)
+    do
+        _n_expr = n
+        if n != null then
+           n.parent = self
+        end
+    end
 
     private init empty_init do end
 
     init init_acontinueexpr (
-            n_kwcontinue: TKwcontinue 
+            n_kwcontinue: TKwcontinue ,
+            n_expr: PExpr 
     )
     do
+        empty_init
         _n_kwcontinue = n_kwcontinue
        if n_kwcontinue != null then
                n_kwcontinue.parent = self
        end
+        _n_expr = n_expr
+       if n_expr != null then
+               n_expr.parent = self
+       end
     end
 
     redef meth replace_child(old_child: PNode, new_child: PNode)
@@ -4933,6 +5249,16 @@ redef class AContinueExpr
             end
             return
        end
+        if _n_expr == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa PExpr
+                _n_expr = new_child
+           else
+               _n_expr = null
+            end
+            return
+       end
     end
 
     redef meth visit_all(v: Visitor)
@@ -4940,6 +5266,9 @@ redef class AContinueExpr
         if _n_kwcontinue != null then
             v.visit(_n_kwcontinue)
         end
+        if _n_expr != null then
+            v.visit(_n_expr)
+        end
     end
 
     redef meth visit_all_reverse(v: Visitor)
@@ -4947,6 +5276,9 @@ redef class AContinueExpr
         if _n_kwcontinue != null then
             v.visit(_n_kwcontinue)
         end
+        if _n_expr != null then
+            v.visit(_n_expr)
+        end
     end
 end
 redef class ADoExpr
@@ -4972,6 +5304,7 @@ redef class ADoExpr
             n_block: PExpr 
     )
     do
+        empty_init
         _n_kwdo = n_kwdo
        if n_kwdo != null then
                n_kwdo.parent = self
@@ -5066,6 +5399,7 @@ redef class AIfExpr
             n_else: PExpr 
     )
     do
+        empty_init
         _n_kwif = n_kwif
        if n_kwif != null then
                n_kwif.parent = self
@@ -5216,6 +5550,7 @@ redef class AIfexprExpr
             n_else: PExpr 
     )
     do
+        empty_init
         _n_kwif = n_kwif
        if n_kwif != null then
                n_kwif.parent = self
@@ -5390,6 +5725,7 @@ redef class AWhileExpr
             n_block: PExpr 
     )
     do
+        empty_init
         _n_kwwhile = n_kwwhile
        if n_kwwhile != null then
                n_kwwhile.parent = self
@@ -5486,129 +5822,37 @@ redef class AWhileExpr
     end
 end
 redef class AForExpr
-    redef meth n_vardecl=(n: PExpr)
+    redef meth n_kwfor=(n: TKwfor)
     do
-        _n_vardecl = n
+        _n_kwfor = n
         if n != null then
            n.parent = self
         end
     end
-    redef meth n_kwdo=(n: TKwdo)
+    redef meth n_id=(n: TId)
     do
-        _n_kwdo = n
+        _n_id = n
         if n != null then
            n.parent = self
         end
     end
-    redef meth n_block=(n: PExpr)
+    redef meth n_expr=(n: PExpr)
     do
-        _n_block = n
-        if n != null then
-           n.parent = self
-        end
-    end
-
-    private init empty_init do end
-
-    init init_aforexpr (
-            n_vardecl: PExpr ,
-            n_kwdo: TKwdo ,
-            n_block: PExpr 
-    )
-    do
-        _n_vardecl = n_vardecl
-       if n_vardecl != null then
-               n_vardecl.parent = self
-       end
-        _n_kwdo = n_kwdo
-       if n_kwdo != null then
-               n_kwdo.parent = self
-       end
-        _n_block = n_block
-       if n_block != null then
-               n_block.parent = self
-       end
-    end
-
-    redef meth replace_child(old_child: PNode, new_child: PNode)
-    do
-        assert old_child != null
-        if _n_vardecl == old_child then
-            if new_child != null then
-                new_child.parent = self
-               assert new_child isa PExpr
-                _n_vardecl = new_child
-           else
-               _n_vardecl = null
-            end
-            return
-       end
-        if _n_kwdo == old_child then
-            if new_child != null then
-                new_child.parent = self
-               assert new_child isa TKwdo
-                _n_kwdo = new_child
-           else
-               _n_kwdo = null
-            end
-            return
-       end
-        if _n_block == old_child then
-            if new_child != null then
-                new_child.parent = self
-               assert new_child isa PExpr
-                _n_block = new_child
-           else
-               _n_block = null
-            end
-            return
-       end
-    end
-
-    redef meth visit_all(v: Visitor)
-    do
-        if _n_vardecl != null then
-            v.visit(_n_vardecl)
-        end
-        if _n_kwdo != null then
-            v.visit(_n_kwdo)
-        end
-        if _n_block != null then
-            v.visit(_n_block)
-        end
-    end
-
-    redef meth visit_all_reverse(v: Visitor)
-    do
-        if _n_vardecl != null then
-            v.visit(_n_vardecl)
-        end
-        if _n_kwdo != null then
-            v.visit(_n_kwdo)
-        end
-        if _n_block != null then
-            v.visit(_n_block)
-        end
-    end
-end
-redef class AForVardeclExpr
-    redef meth n_kwfor=(n: TKwfor)
-    do
-        _n_kwfor = n
+        _n_expr = n
         if n != null then
            n.parent = self
         end
     end
-    redef meth n_id=(n: TId)
+    redef meth n_kwdo=(n: TKwdo)
     do
-        _n_id = n
+        _n_kwdo = n
         if n != null then
            n.parent = self
         end
     end
-    redef meth n_expr=(n: PExpr)
+    redef meth n_block=(n: PExpr)
     do
-        _n_expr = n
+        _n_block = n
         if n != null then
            n.parent = self
         end
@@ -5616,12 +5860,15 @@ redef class AForVardeclExpr
 
     private init empty_init do end
 
-    init init_aforvardeclexpr (
+    init init_aforexpr (
             n_kwfor: TKwfor ,
             n_id: TId ,
-            n_expr: PExpr 
+            n_expr: PExpr ,
+            n_kwdo: TKwdo ,
+            n_block: PExpr 
     )
     do
+        empty_init
         _n_kwfor = n_kwfor
        if n_kwfor != null then
                n_kwfor.parent = self
@@ -5634,6 +5881,14 @@ redef class AForVardeclExpr
        if n_expr != null then
                n_expr.parent = self
        end
+        _n_kwdo = n_kwdo
+       if n_kwdo != null then
+               n_kwdo.parent = self
+       end
+        _n_block = n_block
+       if n_block != null then
+               n_block.parent = self
+       end
     end
 
     redef meth replace_child(old_child: PNode, new_child: PNode)
@@ -5669,6 +5924,26 @@ redef class AForVardeclExpr
             end
             return
        end
+        if _n_kwdo == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TKwdo
+                _n_kwdo = new_child
+           else
+               _n_kwdo = null
+            end
+            return
+       end
+        if _n_block == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa PExpr
+                _n_block = new_child
+           else
+               _n_block = null
+            end
+            return
+       end
     end
 
     redef meth visit_all(v: Visitor)
@@ -5682,6 +5957,12 @@ redef class AForVardeclExpr
         if _n_expr != null then
             v.visit(_n_expr)
         end
+        if _n_kwdo != null then
+            v.visit(_n_kwdo)
+        end
+        if _n_block != null then
+            v.visit(_n_block)
+        end
     end
 
     redef meth visit_all_reverse(v: Visitor)
@@ -5695,6 +5976,12 @@ redef class AForVardeclExpr
         if _n_expr != null then
             v.visit(_n_expr)
         end
+        if _n_kwdo != null then
+            v.visit(_n_kwdo)
+        end
+        if _n_block != null then
+            v.visit(_n_block)
+        end
     end
 end
 redef class AAssertExpr
@@ -5728,6 +6015,7 @@ redef class AAssertExpr
             n_expr: PExpr 
     )
     do
+        empty_init
         _n_kwassert = n_kwassert
        if n_kwassert != null then
                n_kwassert.parent = self
@@ -5826,6 +6114,7 @@ redef class AOnceExpr
             n_expr: PExpr 
     )
     do
+        empty_init
         _n_kwonce = n_kwonce
        if n_kwonce != null then
                n_kwonce.parent = self
@@ -5896,6 +6185,7 @@ redef class ASendExpr
             n_expr: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -5954,6 +6244,7 @@ redef class ABinopExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -6032,6 +6323,7 @@ redef class AOrExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -6110,6 +6402,7 @@ redef class AAndExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -6188,6 +6481,7 @@ redef class ANotExpr
             n_expr: PExpr 
     )
     do
+        empty_init
         _n_kwnot = n_kwnot
        if n_kwnot != null then
                n_kwnot.parent = self
@@ -6266,6 +6560,7 @@ redef class AEqExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -6344,6 +6639,7 @@ redef class AEeExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -6422,6 +6718,7 @@ redef class ANeExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -6500,6 +6797,7 @@ redef class ALtExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -6578,6 +6876,7 @@ redef class ALeExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -6656,6 +6955,7 @@ redef class AGtExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -6734,6 +7034,7 @@ redef class AGeExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -6812,6 +7113,7 @@ redef class AIsaExpr
             n_type: PType 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -6890,6 +7192,7 @@ redef class APlusExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -6968,6 +7271,7 @@ redef class AMinusExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -7046,6 +7350,7 @@ redef class AStarshipExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -7124,6 +7429,7 @@ redef class AStarExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -7202,6 +7508,7 @@ redef class ASlashExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -7280,6 +7587,7 @@ redef class APercentExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -7358,6 +7666,7 @@ redef class AUminusExpr
             n_expr: PExpr 
     )
     do
+        empty_init
         _n_minus = n_minus
        if n_minus != null then
                n_minus.parent = self
@@ -7442,9 +7751,10 @@ redef class ANewExpr
             n_kwnew: TKwnew ,
             n_type: PType ,
             n_id: TId ,
-            n_args: Array[Object]  # Should be Array[PExpr]
+            n_args: Collection[Object]  # Should be Collection[PExpr]
     )
     do
+        empty_init
         _n_kwnew = n_kwnew
        if n_kwnew != null then
                n_kwnew.parent = self
@@ -7571,6 +7881,7 @@ redef class AAttrExpr
             n_id: TAttrid 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -7665,6 +7976,7 @@ redef class AAttrAssignExpr
             n_value: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -7799,6 +8111,7 @@ redef class AAttrReassignExpr
             n_value: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -7915,9 +8228,11 @@ redef class ACallExpr
     init init_acallexpr (
             n_expr: PExpr ,
             n_id: TId ,
-            n_args: Array[Object]  # Should be Array[PExpr]
+            n_args: Collection[Object] , # Should be Collection[PExpr]
+            n_closure_defs: Collection[Object]  # Should be Collection[PClosureDef]
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -7932,6 +8247,12 @@ redef class ACallExpr
                _n_args.add(n)
                n.parent = self
        end
+        _n_closure_defs = new List[PClosureDef]
+       for n in n_closure_defs do
+               assert n isa PClosureDef
+               _n_closure_defs.add(n)
+               n.parent = self
+       end
     end
 
     redef meth replace_child(old_child: PNode, new_child: PNode)
@@ -7969,6 +8290,18 @@ redef class ACallExpr
                 return
             end
         end
+        for i in [0.._n_closure_defs.length[ do
+            if _n_closure_defs[i] == old_child then
+                if new_child != null then
+                   assert new_child isa PClosureDef
+                    _n_closure_defs[i] = new_child
+                    new_child.parent = self
+                else
+                    _n_closure_defs.remove_at(i)
+                end
+                return
+            end
+        end
     end
 
     redef meth visit_all(v: Visitor)
@@ -7982,6 +8315,9 @@ redef class ACallExpr
             for n in _n_args do
                 v.visit(n)
            end
+            for n in _n_closure_defs do
+                v.visit(n)
+           end
     end
 
     redef meth visit_all_reverse(v: Visitor)
@@ -7999,6 +8335,13 @@ redef class ACallExpr
                i = i - 1
            end
        end
+       do
+           var i = _n_closure_defs.length
+            while i >= 0 do
+                v.visit(_n_closure_defs[i])
+               i = i - 1
+           end
+       end
     end
 end
 redef class ACallAssignExpr
@@ -8036,11 +8379,12 @@ redef class ACallAssignExpr
     init init_acallassignexpr (
             n_expr: PExpr ,
             n_id: TId ,
-            n_args: Array[Object] , # Should be Array[PExpr]
+            n_args: Collection[Object] , # Should be Collection[PExpr]
             n_assign: TAssign ,
             n_value: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -8199,11 +8543,12 @@ redef class ACallReassignExpr
     init init_acallreassignexpr (
             n_expr: PExpr ,
             n_id: TId ,
-            n_args: Array[Object] , # Should be Array[PExpr]
+            n_args: Collection[Object] , # Should be Collection[PExpr]
             n_assign_op: PAssignOp ,
             n_value: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -8348,9 +8693,10 @@ redef class ASuperExpr
     init init_asuperexpr (
             n_qualified: PQualified ,
             n_kwsuper: TKwsuper ,
-            n_args: Array[Object]  # Should be Array[PExpr]
+            n_args: Collection[Object]  # Should be Collection[PExpr]
     )
     do
+        empty_init
         _n_qualified = n_qualified
        if n_qualified != null then
                n_qualified.parent = self
@@ -8455,9 +8801,10 @@ redef class AInitExpr
     init init_ainitexpr (
             n_expr: PExpr ,
             n_kwinit: TKwinit ,
-            n_args: Array[Object]  # Should be Array[PExpr]
+            n_args: Collection[Object]  # Should be Collection[PExpr]
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -8554,9 +8901,11 @@ redef class ABraExpr
 
     init init_abraexpr (
             n_expr: PExpr ,
-            n_args: Array[Object]  # Should be Array[PExpr]
+            n_args: Collection[Object] , # Should be Collection[PExpr]
+            n_closure_defs: Collection[Object]  # Should be Collection[PClosureDef]
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -8567,6 +8916,12 @@ redef class ABraExpr
                _n_args.add(n)
                n.parent = self
        end
+        _n_closure_defs = new List[PClosureDef]
+       for n in n_closure_defs do
+               assert n isa PClosureDef
+               _n_closure_defs.add(n)
+               n.parent = self
+       end
     end
 
     redef meth replace_child(old_child: PNode, new_child: PNode)
@@ -8594,6 +8949,18 @@ redef class ABraExpr
                 return
             end
         end
+        for i in [0.._n_closure_defs.length[ do
+            if _n_closure_defs[i] == old_child then
+                if new_child != null then
+                   assert new_child isa PClosureDef
+                    _n_closure_defs[i] = new_child
+                    new_child.parent = self
+                else
+                    _n_closure_defs.remove_at(i)
+                end
+                return
+            end
+        end
     end
 
     redef meth visit_all(v: Visitor)
@@ -8604,6 +8971,9 @@ redef class ABraExpr
             for n in _n_args do
                 v.visit(n)
            end
+            for n in _n_closure_defs do
+                v.visit(n)
+           end
     end
 
     redef meth visit_all_reverse(v: Visitor)
@@ -8618,6 +8988,13 @@ redef class ABraExpr
                i = i - 1
            end
        end
+       do
+           var i = _n_closure_defs.length
+            while i >= 0 do
+                v.visit(_n_closure_defs[i])
+               i = i - 1
+           end
+       end
     end
 end
 redef class ABraAssignExpr
@@ -8647,11 +9024,12 @@ redef class ABraAssignExpr
 
     init init_abraassignexpr (
             n_expr: PExpr ,
-            n_args: Array[Object] , # Should be Array[PExpr]
+            n_args: Collection[Object] , # Should be Collection[PExpr]
             n_assign: TAssign ,
             n_value: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -8782,11 +9160,12 @@ redef class ABraReassignExpr
 
     init init_abrareassignexpr (
             n_expr: PExpr ,
-            n_args: Array[Object] , # Should be Array[PExpr]
+            n_args: Collection[Object] , # Should be Collection[PExpr]
             n_assign_op: PAssignOp ,
             n_value: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -8905,6 +9284,7 @@ redef class AVarExpr
             n_id: TId 
     )
     do
+        empty_init
         _n_id = n_id
        if n_id != null then
                n_id.parent = self
@@ -8971,6 +9351,7 @@ redef class AVarAssignExpr
             n_value: PExpr 
     )
     do
+        empty_init
         _n_id = n_id
        if n_id != null then
                n_id.parent = self
@@ -9077,6 +9458,7 @@ redef class AVarReassignExpr
             n_value: PExpr 
     )
     do
+        empty_init
         _n_id = n_id
        if n_id != null then
                n_id.parent = self
@@ -9175,6 +9557,7 @@ redef class ARangeExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -9253,6 +9636,7 @@ redef class ACrangeExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -9331,6 +9715,7 @@ redef class AOrangeExpr
             n_expr2: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -9391,9 +9776,10 @@ redef class AArrayExpr
     private init empty_init do end
 
     init init_aarrayexpr (
-            n_exprs: Array[Object]  # Should be Array[PExpr]
+            n_exprs: Collection[Object]  # Should be Collection[PExpr]
     )
     do
+        empty_init
         _n_exprs = new List[PExpr]
        for n in n_exprs do
                assert n isa PExpr
@@ -9452,6 +9838,7 @@ redef class ASelfExpr
             n_kwself: TKwself 
     )
     do
+        empty_init
         _n_kwself = n_kwself
        if n_kwself != null then
                n_kwself.parent = self
@@ -9493,6 +9880,7 @@ redef class AImplicitSelfExpr
 
     init init_aimplicitselfexpr
     do
+        empty_init
     end
 
     redef meth replace_child(old_child: PNode, new_child: PNode)
@@ -9523,6 +9911,7 @@ redef class ATrueExpr
             n_kwtrue: TKwtrue 
     )
     do
+        empty_init
         _n_kwtrue = n_kwtrue
        if n_kwtrue != null then
                n_kwtrue.parent = self
@@ -9573,6 +9962,7 @@ redef class AFalseExpr
             n_kwfalse: TKwfalse 
     )
     do
+        empty_init
         _n_kwfalse = n_kwfalse
        if n_kwfalse != null then
                n_kwfalse.parent = self
@@ -9623,6 +10013,7 @@ redef class ANullExpr
             n_kwnull: TKwnull 
     )
     do
+        empty_init
         _n_kwnull = n_kwnull
        if n_kwnull != null then
                n_kwnull.parent = self
@@ -9673,6 +10064,7 @@ redef class AIntExpr
             n_number: TNumber 
     )
     do
+        empty_init
         _n_number = n_number
        if n_number != null then
                n_number.parent = self
@@ -9723,6 +10115,7 @@ redef class AFloatExpr
             n_float: TFloat 
     )
     do
+        empty_init
         _n_float = n_float
        if n_float != null then
                n_float.parent = self
@@ -9773,6 +10166,7 @@ redef class ACharExpr
             n_char: TChar 
     )
     do
+        empty_init
         _n_char = n_char
        if n_char != null then
                n_char.parent = self
@@ -9823,6 +10217,7 @@ redef class AStringExpr
             n_string: TString 
     )
     do
+        empty_init
         _n_string = n_string
        if n_string != null then
                n_string.parent = self
@@ -9873,6 +10268,7 @@ redef class AStartStringExpr
             n_string: TStartString 
     )
     do
+        empty_init
         _n_string = n_string
        if n_string != null then
                n_string.parent = self
@@ -9923,6 +10319,7 @@ redef class AMidStringExpr
             n_string: TMidString 
     )
     do
+        empty_init
         _n_string = n_string
        if n_string != null then
                n_string.parent = self
@@ -9973,6 +10370,7 @@ redef class AEndStringExpr
             n_string: TEndString 
     )
     do
+        empty_init
         _n_string = n_string
        if n_string != null then
                n_string.parent = self
@@ -10013,9 +10411,10 @@ redef class ASuperstringExpr
     private init empty_init do end
 
     init init_asuperstringexpr (
-            n_exprs: Array[Object]  # Should be Array[PExpr]
+            n_exprs: Collection[Object]  # Should be Collection[PExpr]
     )
     do
+        empty_init
         _n_exprs = new List[PExpr]
        for n in n_exprs do
                assert n isa PExpr
@@ -10074,6 +10473,7 @@ redef class AParExpr
             n_expr: PExpr 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -10140,6 +10540,7 @@ redef class AAsCastExpr
             n_type: PType 
     )
     do
+        empty_init
         _n_expr = n_expr
        if n_expr != null then
                n_expr.parent = self
@@ -10230,6 +10631,7 @@ redef class APlusAssignOp
             n_pluseq: TPluseq 
     )
     do
+        empty_init
         _n_pluseq = n_pluseq
        if n_pluseq != null then
                n_pluseq.parent = self
@@ -10280,6 +10682,7 @@ redef class AMinusAssignOp
             n_minuseq: TMinuseq 
     )
     do
+        empty_init
         _n_minuseq = n_minuseq
        if n_minuseq != null then
                n_minuseq.parent = self
@@ -10315,6 +10718,142 @@ redef class AMinusAssignOp
         end
     end
 end
+redef class AClosureDef
+    redef meth n_kwwith=(n: TKwwith)
+    do
+        _n_kwwith = n
+        if n != null then
+           n.parent = self
+        end
+    end
+    redef meth n_kwdo=(n: TKwdo)
+    do
+        _n_kwdo = n
+        if n != null then
+           n.parent = self
+        end
+    end
+    redef meth n_expr=(n: PExpr)
+    do
+        _n_expr = n
+        if n != null then
+           n.parent = self
+        end
+    end
+
+    private init empty_init do end
+
+    init init_aclosuredef (
+            n_kwwith: TKwwith ,
+            n_id: Collection[Object] , # Should be Collection[TId]
+            n_kwdo: TKwdo ,
+            n_expr: PExpr 
+    )
+    do
+        empty_init
+        _n_kwwith = n_kwwith
+       if n_kwwith != null then
+               n_kwwith.parent = self
+       end
+        _n_id = new List[TId]
+       for n in n_id do
+               assert n isa TId
+               _n_id.add(n)
+               n.parent = self
+       end
+        _n_kwdo = n_kwdo
+       if n_kwdo != null then
+               n_kwdo.parent = self
+       end
+        _n_expr = n_expr
+       if n_expr != null then
+               n_expr.parent = self
+       end
+    end
+
+    redef meth replace_child(old_child: PNode, new_child: PNode)
+    do
+        assert old_child != null
+        if _n_kwwith == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TKwwith
+                _n_kwwith = new_child
+           else
+               _n_kwwith = null
+            end
+            return
+       end
+        for i in [0.._n_id.length[ do
+            if _n_id[i] == old_child then
+                if new_child != null then
+                   assert new_child isa TId
+                    _n_id[i] = new_child
+                    new_child.parent = self
+                else
+                    _n_id.remove_at(i)
+                end
+                return
+            end
+        end
+        if _n_kwdo == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TKwdo
+                _n_kwdo = new_child
+           else
+               _n_kwdo = null
+            end
+            return
+       end
+        if _n_expr == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa PExpr
+                _n_expr = new_child
+           else
+               _n_expr = null
+            end
+            return
+       end
+    end
+
+    redef meth visit_all(v: Visitor)
+    do
+        if _n_kwwith != null then
+            v.visit(_n_kwwith)
+        end
+            for n in _n_id do
+                v.visit(n)
+           end
+        if _n_kwdo != null then
+            v.visit(_n_kwdo)
+        end
+        if _n_expr != null then
+            v.visit(_n_expr)
+        end
+    end
+
+    redef meth visit_all_reverse(v: Visitor)
+    do
+        if _n_kwwith != null then
+            v.visit(_n_kwwith)
+        end
+       do
+           var i = _n_id.length
+            while i >= 0 do
+                v.visit(_n_id[i])
+               i = i - 1
+           end
+       end
+        if _n_kwdo != null then
+            v.visit(_n_kwdo)
+        end
+        if _n_expr != null then
+            v.visit(_n_expr)
+        end
+    end
+end
 redef class AQualified
     redef meth n_classid=(n: TClassid)
     do
@@ -10327,10 +10866,11 @@ redef class AQualified
     private init empty_init do end
 
     init init_aqualified (
-            n_id: Array[Object] , # Should be Array[TId]
+            n_id: Collection[Object] , # Should be Collection[TId]
             n_classid: TClassid 
     )
     do
+        empty_init
         _n_id = new List[TId]
        for n in n_id do
                assert n isa TId
@@ -10399,9 +10939,10 @@ redef class ADoc
     private init empty_init do end
 
     init init_adoc (
-            n_comment: Array[Object]  # Should be Array[TComment]
+            n_comment: Collection[Object]  # Should be Collection[TComment]
     )
     do
+        empty_init
         _n_comment = new List[TComment]
        for n in n_comment do
                assert n isa TComment