- redef meth replace_child(old_child: PNode, new_child: PNode)
- do
- assert old_child != null
- if _n_doc == old_child then
- if new_child != null then
- new_child.parent = self
- assert new_child isa PDoc
- _n_doc = new_child
- else
- _n_doc = null
- end
- return
- end
- if _n_kwredef == old_child then
- if new_child != null then
- new_child.parent = self
- assert new_child isa TKwredef
- _n_kwredef = new_child
- else
- _n_kwredef = null
- end
- return
- end
- if _n_visibility == old_child then
- if new_child != null then
- new_child.parent = self
- assert new_child isa PVisibility
- _n_visibility = new_child
- else
- _n_visibility = null
- end
- return
- end
- if _n_kwinit == old_child then
- if new_child != null then
- new_child.parent = self
- assert new_child isa TKwinit
- _n_kwinit = new_child
- else
- _n_kwinit = null
- end
- return
- end
- if _n_methid == old_child then
- if new_child != null then
- new_child.parent = self
- assert new_child isa PMethid
- _n_methid = new_child
- else
- _n_methid = 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_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_doc != null then
- v.visit(_n_doc)
- end
- if _n_kwredef != null then
- v.visit(_n_kwredef)
- end
- if _n_visibility != null then
- v.visit(_n_visibility)
- end
- if _n_kwinit != null then
- v.visit(_n_kwinit)
- end
- if _n_methid != null then
- v.visit(_n_methid)
- end
- if _n_signature != null then
- v.visit(_n_signature)
- end
- if _n_block != null then
- v.visit(_n_block)
- end
- end
-
- redef meth visit_all_reverse(v: Visitor)
- do
- if _n_doc != null then
- v.visit(_n_doc)
- end
- if _n_kwredef != null then
- v.visit(_n_kwredef)
- end
- if _n_visibility != null then
- v.visit(_n_visibility)
- end
- if _n_kwinit != null then
- v.visit(_n_kwinit)
- end
- if _n_methid != null then
- v.visit(_n_methid)
- end
- if _n_signature != null then
- v.visit(_n_signature)
- end
- if _n_block != null then
- v.visit(_n_block)
- end
- end
-end
-redef class AMainMethPropdef
- redef meth n_kwredef=(n: TKwredef)
- do
- _n_kwredef = n
- if n != null then
- n.parent = self
- end
- end
- redef meth n_block=(n: PExpr)
- do
- _n_block = n
- if n != null then
- n.parent = self
- end
- end
-
- private init empty_init do end
-
- init init_amainmethpropdef (
- n_kwredef: TKwredef ,
- n_block: PExpr
- )
- do
- empty_init
- _n_kwredef = n_kwredef
- if n_kwredef != null then
- n_kwredef.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_kwredef == old_child then
- if new_child != null then
- new_child.parent = self
- assert new_child isa TKwredef
- _n_kwredef = new_child
- else
- _n_kwredef = 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_kwredef != null then
- v.visit(_n_kwredef)
- end
- if _n_block != null then
- v.visit(_n_block)
- end
- end
-
- redef meth visit_all_reverse(v: Visitor)
- do
- if _n_kwredef != null then
- v.visit(_n_kwredef)
- end
- if _n_block != null then
- v.visit(_n_block)
- end
- end
-end
-redef class ATypePropdef
- redef meth n_doc=(n: PDoc)
- do
- _n_doc = n
- if n != null then
- n.parent = self
- end
- end
- redef meth n_kwredef=(n: TKwredef)
- do
- _n_kwredef = n
- if n != null then
- n.parent = self
- end
- end
- redef meth n_visibility=(n: PVisibility)
- do
- _n_visibility = n
- if n != null then
- n.parent = self
- end
- end
- redef meth n_kwtype=(n: TKwtype)
- do
- _n_kwtype = n
- if n != null then
- n.parent = self
- end
- end
- redef meth n_id=(n: TClassid)
- do
- _n_id = n
- if n != null then
- n.parent = self
- end
- end
- redef meth n_type=(n: PType)
- do
- _n_type = n
- if n != null then
- n.parent = self
- end
- end
-
- private init empty_init do end
-
- init init_atypepropdef (
- n_doc: PDoc ,
- n_kwredef: TKwredef ,
- n_visibility: PVisibility ,
- n_kwtype: TKwtype ,
- n_id: TClassid ,
- n_type: PType
- )
- do
- empty_init
- _n_doc = n_doc
- if n_doc != null then
- n_doc.parent = self
- end
- _n_kwredef = n_kwredef
- if n_kwredef != null then
- n_kwredef.parent = self
- end
- _n_visibility = n_visibility
- if n_visibility != null then
- n_visibility.parent = self
- end
- _n_kwtype = n_kwtype
- if n_kwtype != null then
- n_kwtype.parent = self
- end
- _n_id = n_id
- if n_id != null then
- n_id.parent = self
- end
- _n_type = n_type
- if n_type != null then
- n_type.parent = self
+ redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+ do
+ if _n_doc == old_child then
+ n_doc = new_child.as(nullable ADoc)
+ return
+ end
+ if _n_kwredef == old_child then
+ n_kwredef = new_child.as(nullable TKwredef)
+ return
+ end
+ if _n_visibility == old_child then
+ n_visibility = new_child.as(AVisibility)
+ return
+ end
+ if _n_kwinit == old_child then
+ n_kwinit = new_child.as(TKwinit)
+ return
+ end
+ if _n_methid == old_child then
+ n_methid = new_child.as(nullable AMethid)
+ return
+ end
+ if _n_signature == old_child then
+ n_signature = new_child.as(ASignature)
+ return
+ end
+ if _n_annotations == old_child then
+ n_annotations = new_child.as(nullable AAnnotations)
+ return
+ end
+ if _n_block == old_child then
+ n_block = new_child.as(nullable AExpr)
+ return
+ end