# Replace itself with an other node in the AST
fun replace_with(node: ANode)
do
- if (_parent != null) then
+ if _parent != null then
_parent.replace_child(self, node)
end
end
end
# Abstract standard visitor
-class Visitor
+abstract class Visitor
# What the visitor do when a node is visited
# Concrete visitors should redefine this method.
protected fun visit(e: nullable ANode) is abstract
init init_amodule (
n_moduledecl: nullable AModuledecl,
n_imports: Collection[Object], # Should be Collection[AImport]
+ n_extern_code_blocks: Collection[Object], # Should be Collection[AExternCodeBlock]
n_classdefs: Collection[Object] # Should be Collection[AClassdef]
)
do
_n_imports.add(n)
n.parent = self
end
+ for n in n_extern_code_blocks do
+ assert n isa AExternCodeBlock
+ _n_extern_code_blocks.add(n)
+ n.parent = self
+ end
for n in n_classdefs do
assert n isa AClassdef
_n_classdefs.add(n)
return
end
end
+ for i in [0.._n_extern_code_blocks.length[ do
+ if _n_extern_code_blocks[i] == old_child then
+ if new_child != null then
+ assert new_child isa AExternCodeBlock
+ _n_extern_code_blocks[i] = new_child
+ new_child.parent = self
+ else
+ _n_extern_code_blocks.remove_at(i)
+ end
+ return
+ end
+ end
for i in [0.._n_classdefs.length[ do
if _n_classdefs[i] == old_child then
if new_child != null then
for n in _n_imports do
v.enter_visit(n)
end
+ for n in _n_extern_code_blocks do
+ v.enter_visit(n)
+ end
for n in _n_classdefs do
v.enter_visit(n)
end
n_classkind: nullable AClasskind,
n_id: nullable TClassid,
n_formaldefs: Collection[Object], # Should be Collection[AFormaldef]
+ n_extern_code_block: nullable AExternCodeBlock,
n_superclasses: Collection[Object], # Should be Collection[ASuperclass]
n_propdefs: Collection[Object], # Should be Collection[APropdef]
n_kwend: nullable TKwend
_n_formaldefs.add(n)
n.parent = self
end
+ _n_extern_code_block = n_extern_code_block
+ if n_extern_code_block != null then
+ n_extern_code_block.parent = self
+ end
for n in n_superclasses do
assert n isa ASuperclass
_n_superclasses.add(n)
return
end
end
+ if _n_extern_code_block == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa AExternCodeBlock
+ _n_extern_code_block = new_child
+ else
+ _n_extern_code_block = null
+ end
+ return
+ end
for i in [0.._n_superclasses.length[ do
if _n_superclasses[i] == old_child then
if new_child != null then
for n in _n_formaldefs do
v.enter_visit(n)
end
+ if _n_extern_code_block != null then
+ v.enter_visit(_n_extern_code_block.as(not null))
+ end
for n in _n_superclasses do
v.enter_visit(n)
end
private init empty_init do end
init init_aexternclasskind (
- n_kwextern: nullable TKwextern
+ n_kwextern: nullable TKwextern,
+ n_kwclass: nullable TKwclass
)
do
empty_init
_n_kwextern = n_kwextern.as(not null)
n_kwextern.parent = self
+ _n_kwclass = n_kwclass
+ if n_kwclass != null then
+ n_kwclass.parent = self
+ end
end
redef fun replace_child(old_child: ANode, new_child: nullable ANode)
end
return
end
+ if _n_kwclass == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TKwclass
+ _n_kwclass = new_child
+ else
+ _n_kwclass = null
+ end
+ return
+ end
end
redef fun visit_all(v: Visitor)
do
v.enter_visit(_n_kwextern)
+ if _n_kwclass != null then
+ v.enter_visit(_n_kwclass.as(not null))
+ end
end
end
redef class AFormaldef
private init empty_init do end
init init_asuperclass (
- n_kwspecial: nullable TKwspecial,
n_kwsuper: nullable TKwsuper,
n_type: nullable AType
)
do
empty_init
- _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_kwsuper = n_kwsuper.as(not null)
+ n_kwsuper.parent = self
_n_type = n_type.as(not null)
n_type.parent = self
end
redef fun replace_child(old_child: ANode, new_child: nullable ANode)
do
- if _n_kwspecial == old_child then
- if new_child != null then
- new_child.parent = self
- assert new_child isa TKwspecial
- _n_kwspecial = new_child
- else
- _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
+ abort
end
return
end
redef fun visit_all(v: Visitor)
do
- 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_kwsuper)
v.enter_visit(_n_type)
end
end
n_methid: nullable AMethid,
n_signature: nullable ASignature,
n_extern: nullable TString,
- n_extern_calls: nullable AExternCalls
+ n_extern_calls: nullable AExternCalls,
+ n_extern_code_block: nullable AExternCodeBlock
)
do
empty_init
if n_extern_calls != null then
n_extern_calls.parent = self
end
+ _n_extern_code_block = n_extern_code_block
+ if n_extern_code_block != null then
+ n_extern_code_block.parent = self
+ end
end
redef fun replace_child(old_child: ANode, new_child: nullable ANode)
end
return
end
+ if _n_extern_code_block == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa AExternCodeBlock
+ _n_extern_code_block = new_child
+ else
+ _n_extern_code_block = null
+ end
+ return
+ end
end
redef fun visit_all(v: Visitor)
if _n_extern_calls != null then
v.enter_visit(_n_extern_calls.as(not null))
end
+ if _n_extern_code_block != null then
+ v.enter_visit(_n_extern_code_block.as(not null))
+ end
end
end
redef class AConcreteMethPropdef
n_methid: nullable AMethid,
n_signature: nullable ASignature,
n_extern: nullable TString,
- n_extern_calls: nullable AExternCalls
+ n_extern_calls: nullable AExternCalls,
+ n_extern_code_block: nullable AExternCodeBlock
)
do
empty_init
if n_extern_calls != null then
n_extern_calls.parent = self
end
+ _n_extern_code_block = n_extern_code_block
+ if n_extern_code_block != null then
+ n_extern_code_block.parent = self
+ end
end
redef fun replace_child(old_child: ANode, new_child: nullable ANode)
end
return
end
+ if _n_extern_code_block == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa AExternCodeBlock
+ _n_extern_code_block = new_child
+ else
+ _n_extern_code_block = null
+ end
+ return
+ end
end
redef fun visit_all(v: Visitor)
if _n_extern_calls != null then
v.enter_visit(_n_extern_calls.as(not null))
end
+ if _n_extern_code_block != null then
+ v.enter_visit(_n_extern_code_block.as(not null))
+ end
end
end
redef class AMainMethPropdef
private init empty_init do end
init init_asignature (
+ n_opar: nullable TOpar,
n_params: Collection[Object], # Should be Collection[AParam]
+ n_cpar: nullable TCpar,
n_type: nullable AType,
n_closure_decls: Collection[Object] # Should be Collection[AClosureDecl]
)
do
empty_init
+ _n_opar = n_opar
+ if n_opar != null then
+ n_opar.parent = self
+ end
for n in n_params do
assert n isa AParam
_n_params.add(n)
n.parent = self
end
+ _n_cpar = n_cpar
+ if n_cpar != null then
+ n_cpar.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_opar == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TOpar
+ _n_opar = new_child
+ else
+ _n_opar = null
+ end
+ return
+ end
for i in [0.._n_params.length[ do
if _n_params[i] == old_child then
if new_child != null then
return
end
end
+ if _n_cpar == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TCpar
+ _n_cpar = new_child
+ else
+ _n_cpar = null
+ end
+ return
+ end
if _n_type == old_child then
if new_child != null then
new_child.parent = self
redef fun visit_all(v: Visitor)
do
+ if _n_opar != null then
+ v.enter_visit(_n_opar.as(not null))
+ end
for n in _n_params do
v.enter_visit(n)
end
+ if _n_cpar != null then
+ v.enter_visit(_n_cpar.as(not null))
+ end
if _n_type != null then
v.enter_visit(_n_type.as(not null))
end
n_kwnew: nullable TKwnew,
n_type: nullable AType,
n_id: nullable TId,
- n_args: Collection[Object] # Should be Collection[AExpr]
+ n_args: nullable AExprs
)
do
empty_init
if n_id != null then
n_id.parent = self
end
- for n in n_args do
- assert n isa AExpr
- _n_args.add(n)
- n.parent = self
- end
+ _n_args = n_args.as(not null)
+ n_args.parent = self
end
redef fun replace_child(old_child: ANode, new_child: nullable ANode)
end
return
end
- for i in [0.._n_args.length[ do
- if _n_args[i] == old_child then
- if new_child != null then
- assert new_child isa AExpr
- _n_args[i] = new_child
- new_child.parent = self
- else
- _n_args.remove_at(i)
- end
- return
+ if _n_args == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa AExprs
+ _n_args = new_child
+ else
+ abort
end
- end
+ return
+ end
end
redef fun visit_all(v: Visitor)
if _n_id != null then
v.enter_visit(_n_id.as(not null))
end
- for n in _n_args do
- v.enter_visit(n)
- end
+ v.enter_visit(_n_args)
end
end
redef class AAttrExpr
init init_acallexpr (
n_expr: nullable AExpr,
n_id: nullable TId,
- n_args: Collection[Object], # Should be Collection[AExpr]
+ n_args: nullable AExprs,
n_closure_defs: Collection[Object] # Should be Collection[AClosureDef]
)
do
n_expr.parent = self
_n_id = n_id.as(not null)
n_id.parent = self
- for n in n_args do
- assert n isa AExpr
- _n_args.add(n)
- n.parent = self
- end
+ _n_args = n_args.as(not null)
+ n_args.parent = self
for n in n_closure_defs do
assert n isa AClosureDef
_n_closure_defs.add(n)
end
return
end
- for i in [0.._n_args.length[ do
- if _n_args[i] == old_child then
- if new_child != null then
- assert new_child isa AExpr
- _n_args[i] = new_child
- new_child.parent = self
- else
- _n_args.remove_at(i)
- end
- return
+ if _n_args == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa AExprs
+ _n_args = new_child
+ else
+ abort
end
- end
+ return
+ end
for i in [0.._n_closure_defs.length[ do
if _n_closure_defs[i] == old_child then
if new_child != null then
do
v.enter_visit(_n_expr)
v.enter_visit(_n_id)
- for n in _n_args do
- v.enter_visit(n)
- end
+ v.enter_visit(_n_args)
for n in _n_closure_defs do
v.enter_visit(n)
end
init init_acallassignexpr (
n_expr: nullable AExpr,
n_id: nullable TId,
- n_args: Collection[Object], # Should be Collection[AExpr]
+ n_args: nullable AExprs,
n_assign: nullable TAssign,
n_value: nullable AExpr
)
n_expr.parent = self
_n_id = n_id.as(not null)
n_id.parent = self
- for n in n_args do
- assert n isa AExpr
- _n_args.add(n)
- n.parent = self
- end
+ _n_args = n_args.as(not null)
+ n_args.parent = self
_n_assign = n_assign.as(not null)
n_assign.parent = self
_n_value = n_value.as(not null)
end
return
end
- for i in [0.._n_args.length[ do
- if _n_args[i] == old_child then
- if new_child != null then
- assert new_child isa AExpr
- _n_args[i] = new_child
- new_child.parent = self
- else
- _n_args.remove_at(i)
- end
- return
+ if _n_args == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa AExprs
+ _n_args = new_child
+ else
+ abort
end
- end
+ return
+ end
if _n_assign == old_child then
if new_child != null then
new_child.parent = self
do
v.enter_visit(_n_expr)
v.enter_visit(_n_id)
- for n in _n_args do
- v.enter_visit(n)
- end
+ v.enter_visit(_n_args)
v.enter_visit(_n_assign)
v.enter_visit(_n_value)
end
init init_acallreassignexpr (
n_expr: nullable AExpr,
n_id: nullable TId,
- n_args: Collection[Object], # Should be Collection[AExpr]
+ n_args: nullable AExprs,
n_assign_op: nullable AAssignOp,
n_value: nullable AExpr
)
n_expr.parent = self
_n_id = n_id.as(not null)
n_id.parent = self
- for n in n_args do
- assert n isa AExpr
- _n_args.add(n)
- n.parent = self
- end
+ _n_args = n_args.as(not null)
+ n_args.parent = self
_n_assign_op = n_assign_op.as(not null)
n_assign_op.parent = self
_n_value = n_value.as(not null)
end
return
end
- for i in [0.._n_args.length[ do
- if _n_args[i] == old_child then
- if new_child != null then
- assert new_child isa AExpr
- _n_args[i] = new_child
- new_child.parent = self
- else
- _n_args.remove_at(i)
- end
- return
+ if _n_args == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa AExprs
+ _n_args = new_child
+ else
+ abort
end
- end
+ return
+ end
if _n_assign_op == old_child then
if new_child != null then
new_child.parent = self
do
v.enter_visit(_n_expr)
v.enter_visit(_n_id)
- for n in _n_args do
- v.enter_visit(n)
- end
+ v.enter_visit(_n_args)
v.enter_visit(_n_assign_op)
v.enter_visit(_n_value)
end
init init_asuperexpr (
n_qualified: nullable AQualified,
n_kwsuper: nullable TKwsuper,
- n_args: Collection[Object] # Should be Collection[AExpr]
+ n_args: nullable AExprs
)
do
empty_init
end
_n_kwsuper = n_kwsuper.as(not null)
n_kwsuper.parent = self
- for n in n_args do
- assert n isa AExpr
- _n_args.add(n)
- n.parent = self
- end
+ _n_args = n_args.as(not null)
+ n_args.parent = self
end
redef fun replace_child(old_child: ANode, new_child: nullable ANode)
end
return
end
- for i in [0.._n_args.length[ do
- if _n_args[i] == old_child then
- if new_child != null then
- assert new_child isa AExpr
- _n_args[i] = new_child
- new_child.parent = self
- else
- _n_args.remove_at(i)
- end
- return
+ if _n_args == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa AExprs
+ _n_args = new_child
+ else
+ abort
end
- end
+ return
+ end
end
redef fun visit_all(v: Visitor)
v.enter_visit(_n_qualified.as(not null))
end
v.enter_visit(_n_kwsuper)
- for n in _n_args do
- v.enter_visit(n)
- end
+ v.enter_visit(_n_args)
end
end
redef class AInitExpr
init init_ainitexpr (
n_expr: nullable AExpr,
n_kwinit: nullable TKwinit,
- n_args: Collection[Object] # Should be Collection[AExpr]
+ n_args: nullable AExprs
)
do
empty_init
n_expr.parent = self
_n_kwinit = n_kwinit.as(not null)
n_kwinit.parent = self
- for n in n_args do
- assert n isa AExpr
- _n_args.add(n)
- n.parent = self
- end
+ _n_args = n_args.as(not null)
+ n_args.parent = self
end
redef fun replace_child(old_child: ANode, new_child: nullable ANode)
end
return
end
- for i in [0.._n_args.length[ do
- if _n_args[i] == old_child then
- if new_child != null then
- assert new_child isa AExpr
- _n_args[i] = new_child
- new_child.parent = self
- else
- _n_args.remove_at(i)
- end
- return
+ if _n_args == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa AExprs
+ _n_args = new_child
+ else
+ abort
end
- end
+ return
+ end
end
redef fun visit_all(v: Visitor)
do
v.enter_visit(_n_expr)
v.enter_visit(_n_kwinit)
- for n in _n_args do
- v.enter_visit(n)
- end
+ v.enter_visit(_n_args)
end
end
redef class ABraExpr
init init_abraexpr (
n_expr: nullable AExpr,
- n_args: Collection[Object], # Should be Collection[AExpr]
+ n_args: nullable AExprs,
n_closure_defs: Collection[Object] # Should be Collection[AClosureDef]
)
do
empty_init
_n_expr = n_expr.as(not null)
n_expr.parent = self
- for n in n_args do
- assert n isa AExpr
- _n_args.add(n)
- n.parent = self
- end
+ _n_args = n_args.as(not null)
+ n_args.parent = self
for n in n_closure_defs do
assert n isa AClosureDef
_n_closure_defs.add(n)
end
return
end
- for i in [0.._n_args.length[ do
- if _n_args[i] == old_child then
- if new_child != null then
- assert new_child isa AExpr
- _n_args[i] = new_child
- new_child.parent = self
- else
- _n_args.remove_at(i)
- end
- return
+ if _n_args == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa AExprs
+ _n_args = new_child
+ else
+ abort
end
- end
+ return
+ end
for i in [0.._n_closure_defs.length[ do
if _n_closure_defs[i] == old_child then
if new_child != null then
redef fun visit_all(v: Visitor)
do
v.enter_visit(_n_expr)
- for n in _n_args do
- v.enter_visit(n)
- end
+ v.enter_visit(_n_args)
for n in _n_closure_defs do
v.enter_visit(n)
end
init init_abraassignexpr (
n_expr: nullable AExpr,
- n_args: Collection[Object], # Should be Collection[AExpr]
+ n_args: nullable AExprs,
n_assign: nullable TAssign,
n_value: nullable AExpr
)
empty_init
_n_expr = n_expr.as(not null)
n_expr.parent = self
- for n in n_args do
- assert n isa AExpr
- _n_args.add(n)
- n.parent = self
- end
+ _n_args = n_args.as(not null)
+ n_args.parent = self
_n_assign = n_assign.as(not null)
n_assign.parent = self
_n_value = n_value.as(not null)
end
return
end
- for i in [0.._n_args.length[ do
- if _n_args[i] == old_child then
- if new_child != null then
- assert new_child isa AExpr
- _n_args[i] = new_child
- new_child.parent = self
- else
- _n_args.remove_at(i)
- end
- return
+ if _n_args == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa AExprs
+ _n_args = new_child
+ else
+ abort
end
- end
+ return
+ end
if _n_assign == old_child then
if new_child != null then
new_child.parent = self
redef fun visit_all(v: Visitor)
do
v.enter_visit(_n_expr)
- for n in _n_args do
- v.enter_visit(n)
- end
+ v.enter_visit(_n_args)
v.enter_visit(_n_assign)
v.enter_visit(_n_value)
end
init init_abrareassignexpr (
n_expr: nullable AExpr,
- n_args: Collection[Object], # Should be Collection[AExpr]
+ n_args: nullable AExprs,
n_assign_op: nullable AAssignOp,
n_value: nullable AExpr
)
empty_init
_n_expr = n_expr.as(not null)
n_expr.parent = self
- for n in n_args do
- assert n isa AExpr
- _n_args.add(n)
- n.parent = self
- end
+ _n_args = n_args.as(not null)
+ n_args.parent = self
_n_assign_op = n_assign_op.as(not null)
n_assign_op.parent = self
_n_value = n_value.as(not null)
end
return
end
- for i in [0.._n_args.length[ do
- if _n_args[i] == old_child then
- if new_child != null then
- assert new_child isa AExpr
- _n_args[i] = new_child
- new_child.parent = self
- else
- _n_args.remove_at(i)
- end
- return
+ if _n_args == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa AExprs
+ _n_args = new_child
+ else
+ abort
end
- end
+ return
+ end
if _n_assign_op == old_child then
if new_child != null then
new_child.parent = self
redef fun visit_all(v: Visitor)
do
v.enter_visit(_n_expr)
- for n in _n_args do
- v.enter_visit(n)
- end
+ v.enter_visit(_n_args)
v.enter_visit(_n_assign_op)
v.enter_visit(_n_value)
end
init init_aclosurecallexpr (
n_id: nullable TId,
- n_args: Collection[Object], # Should be Collection[AExpr]
+ n_args: nullable AExprs,
n_closure_defs: Collection[Object] # Should be Collection[AClosureDef]
)
do
empty_init
_n_id = n_id.as(not null)
n_id.parent = self
- for n in n_args do
- assert n isa AExpr
- _n_args.add(n)
- n.parent = self
- end
+ _n_args = n_args.as(not null)
+ n_args.parent = self
for n in n_closure_defs do
assert n isa AClosureDef
_n_closure_defs.add(n)
end
return
end
- for i in [0.._n_args.length[ do
- if _n_args[i] == old_child then
- if new_child != null then
- assert new_child isa AExpr
- _n_args[i] = new_child
- new_child.parent = self
- else
- _n_args.remove_at(i)
- end
- return
+ if _n_args == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa AExprs
+ _n_args = new_child
+ else
+ abort
end
- end
+ return
+ end
for i in [0.._n_closure_defs.length[ do
if _n_closure_defs[i] == old_child then
if new_child != null then
redef fun visit_all(v: Visitor)
do
v.enter_visit(_n_id)
- for n in _n_args do
- v.enter_visit(n)
- end
- for n in _n_closure_defs do
+ v.enter_visit(_n_args)
+ for n in _n_closure_defs do
v.enter_visit(n)
end
end
private init empty_init do end
init init_acrangeexpr (
+ n_obra: nullable TObra,
n_expr: nullable AExpr,
- n_expr2: nullable AExpr
+ n_expr2: nullable AExpr,
+ n_cbra: nullable TCbra
)
do
empty_init
+ _n_obra = n_obra.as(not null)
+ n_obra.parent = self
_n_expr = n_expr.as(not null)
n_expr.parent = self
_n_expr2 = n_expr2.as(not null)
n_expr2.parent = self
+ _n_cbra = n_cbra.as(not null)
+ n_cbra.parent = self
end
redef fun replace_child(old_child: ANode, new_child: nullable ANode)
do
+ if _n_obra == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TObra
+ _n_obra = new_child
+ else
+ abort
+ end
+ return
+ end
if _n_expr == old_child then
if new_child != null then
new_child.parent = self
end
return
end
+ if _n_cbra == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TCbra
+ _n_cbra = new_child
+ else
+ abort
+ end
+ return
+ end
end
redef fun visit_all(v: Visitor)
do
+ v.enter_visit(_n_obra)
v.enter_visit(_n_expr)
v.enter_visit(_n_expr2)
+ v.enter_visit(_n_cbra)
end
end
redef class AOrangeExpr
private init empty_init do end
init init_aorangeexpr (
+ n_obra: nullable TObra,
n_expr: nullable AExpr,
- n_expr2: nullable AExpr
+ n_expr2: nullable AExpr,
+ n_cbra: nullable TObra
)
do
empty_init
+ _n_obra = n_obra.as(not null)
+ n_obra.parent = self
_n_expr = n_expr.as(not null)
n_expr.parent = self
_n_expr2 = n_expr2.as(not null)
n_expr2.parent = self
+ _n_cbra = n_cbra.as(not null)
+ n_cbra.parent = self
end
redef fun replace_child(old_child: ANode, new_child: nullable ANode)
do
+ if _n_obra == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TObra
+ _n_obra = new_child
+ else
+ abort
+ end
+ return
+ end
if _n_expr == old_child then
if new_child != null then
new_child.parent = self
end
return
end
+ if _n_cbra == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TObra
+ _n_cbra = new_child
+ else
+ abort
+ end
+ return
+ end
end
redef fun visit_all(v: Visitor)
do
+ v.enter_visit(_n_obra)
v.enter_visit(_n_expr)
v.enter_visit(_n_expr2)
+ v.enter_visit(_n_cbra)
end
end
redef class AArrayExpr
private init empty_init do end
init init_aarrayexpr (
- n_exprs: Collection[Object] # Should be Collection[AExpr]
+ n_exprs: nullable AExprs
)
do
empty_init
- for n in n_exprs do
- assert n isa AExpr
- _n_exprs.add(n)
- n.parent = self
- end
+ _n_exprs = n_exprs.as(not null)
+ n_exprs.parent = self
end
redef fun replace_child(old_child: ANode, new_child: nullable ANode)
do
- for i in [0.._n_exprs.length[ do
- if _n_exprs[i] == old_child then
- if new_child != null then
- assert new_child isa AExpr
- _n_exprs[i] = new_child
- new_child.parent = self
- else
- _n_exprs.remove_at(i)
- end
- return
+ if _n_exprs == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa AExprs
+ _n_exprs = new_child
+ else
+ abort
end
- end
+ return
+ end
end
redef fun visit_all(v: Visitor)
do
- for n in _n_exprs do
- v.enter_visit(n)
- end
+ v.enter_visit(_n_exprs)
end
end
redef class ASelfExpr
private init empty_init do end
init init_aparexpr (
- n_expr: nullable AExpr
+ n_opar: nullable TOpar,
+ n_expr: nullable AExpr,
+ n_cpar: nullable TCpar
)
do
empty_init
+ _n_opar = n_opar.as(not null)
+ n_opar.parent = self
_n_expr = n_expr.as(not null)
n_expr.parent = self
+ _n_cpar = n_cpar.as(not null)
+ n_cpar.parent = self
end
redef fun replace_child(old_child: ANode, new_child: nullable ANode)
do
+ if _n_opar == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TOpar
+ _n_opar = new_child
+ else
+ abort
+ end
+ return
+ end
if _n_expr == old_child then
if new_child != null then
new_child.parent = self
end
return
end
+ if _n_cpar == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TCpar
+ _n_cpar = new_child
+ else
+ abort
+ end
+ return
+ end
end
redef fun visit_all(v: Visitor)
do
+ v.enter_visit(_n_opar)
v.enter_visit(_n_expr)
+ v.enter_visit(_n_cpar)
end
end
redef class AAsCastExpr
init init_aascastexpr (
n_expr: nullable AExpr,
n_kwas: nullable TKwas,
- n_type: nullable AType
+ n_opar: nullable TOpar,
+ n_type: nullable AType,
+ n_cpar: nullable TCpar
)
do
empty_init
n_expr.parent = self
_n_kwas = n_kwas.as(not null)
n_kwas.parent = self
+ _n_opar = n_opar.as(not null)
+ n_opar.parent = self
_n_type = n_type.as(not null)
n_type.parent = self
+ _n_cpar = n_cpar.as(not null)
+ n_cpar.parent = self
end
redef fun replace_child(old_child: ANode, new_child: nullable ANode)
end
return
end
+ if _n_opar == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TOpar
+ _n_opar = new_child
+ else
+ abort
+ end
+ return
+ end
if _n_type == old_child then
if new_child != null then
new_child.parent = self
end
return
end
+ if _n_cpar == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TCpar
+ _n_cpar = new_child
+ else
+ abort
+ end
+ return
+ end
end
redef fun visit_all(v: Visitor)
do
v.enter_visit(_n_expr)
v.enter_visit(_n_kwas)
+ v.enter_visit(_n_opar)
v.enter_visit(_n_type)
+ v.enter_visit(_n_cpar)
end
end
redef class AAsNotnullExpr
init init_aasnotnullexpr (
n_expr: nullable AExpr,
n_kwas: nullable TKwas,
+ n_opar: nullable TOpar,
n_kwnot: nullable TKwnot,
- n_kwnull: nullable TKwnull
+ n_kwnull: nullable TKwnull,
+ n_cpar: nullable TCpar
)
do
empty_init
n_expr.parent = self
_n_kwas = n_kwas.as(not null)
n_kwas.parent = self
+ _n_opar = n_opar.as(not null)
+ n_opar.parent = self
_n_kwnot = n_kwnot.as(not null)
n_kwnot.parent = self
_n_kwnull = n_kwnull.as(not null)
n_kwnull.parent = self
+ _n_cpar = n_cpar.as(not null)
+ n_cpar.parent = self
end
redef fun replace_child(old_child: ANode, new_child: nullable ANode)
end
return
end
+ if _n_opar == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TOpar
+ _n_opar = new_child
+ else
+ abort
+ end
+ return
+ end
if _n_kwnot == old_child then
if new_child != null then
new_child.parent = self
end
return
end
+ if _n_cpar == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TCpar
+ _n_cpar = new_child
+ else
+ abort
+ end
+ return
+ end
end
redef fun visit_all(v: Visitor)
do
v.enter_visit(_n_expr)
v.enter_visit(_n_kwas)
+ v.enter_visit(_n_opar)
v.enter_visit(_n_kwnot)
v.enter_visit(_n_kwnull)
+ v.enter_visit(_n_cpar)
end
end
redef class AIssetAttrExpr
v.enter_visit(_n_id)
end
end
+redef class ADebugTypeExpr
+ private init empty_init do end
+
+ init init_adebugtypeexpr (
+ n_kwdebug: nullable TKwdebug,
+ n_kwtype: nullable TKwtype,
+ n_expr: nullable AExpr,
+ n_type: nullable AType
+ )
+ do
+ empty_init
+ _n_kwdebug = n_kwdebug.as(not null)
+ n_kwdebug.parent = self
+ _n_kwtype = n_kwtype.as(not null)
+ n_kwtype.parent = self
+ _n_expr = n_expr.as(not null)
+ n_expr.parent = self
+ _n_type = n_type.as(not null)
+ n_type.parent = self
+ end
+
+ redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+ do
+ if _n_kwdebug == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TKwdebug
+ _n_kwdebug = new_child
+ else
+ abort
+ end
+ return
+ end
+ if _n_kwtype == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TKwtype
+ _n_kwtype = new_child
+ else
+ abort
+ end
+ return
+ end
+ if _n_expr == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa AExpr
+ _n_expr = new_child
+ else
+ abort
+ end
+ return
+ end
+ if _n_type == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa AType
+ _n_type = new_child
+ else
+ abort
+ end
+ return
+ end
+ end
+
+ redef fun visit_all(v: Visitor)
+ do
+ v.enter_visit(_n_kwdebug)
+ v.enter_visit(_n_kwtype)
+ v.enter_visit(_n_expr)
+ v.enter_visit(_n_type)
+ end
+end
+redef class AListExprs
+ private init empty_init do end
+
+ init init_alistexprs (
+ n_exprs: Collection[Object] # Should be Collection[AExpr]
+ )
+ do
+ empty_init
+ for n in n_exprs do
+ assert n isa AExpr
+ _n_exprs.add(n)
+ n.parent = self
+ end
+ end
+
+ redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+ do
+ for i in [0.._n_exprs.length[ do
+ if _n_exprs[i] == old_child then
+ if new_child != null then
+ assert new_child isa AExpr
+ _n_exprs[i] = new_child
+ new_child.parent = self
+ else
+ _n_exprs.remove_at(i)
+ end
+ return
+ end
+ end
+ end
+
+ redef fun visit_all(v: Visitor)
+ do
+ for n in _n_exprs do
+ v.enter_visit(n)
+ end
+ end
+end
+redef class AParExprs
+ private init empty_init do end
+
+ init init_aparexprs (
+ n_opar: nullable TOpar,
+ n_exprs: Collection[Object], # Should be Collection[AExpr]
+ n_cpar: nullable TCpar
+ )
+ do
+ empty_init
+ _n_opar = n_opar.as(not null)
+ n_opar.parent = self
+ for n in n_exprs do
+ assert n isa AExpr
+ _n_exprs.add(n)
+ n.parent = self
+ end
+ _n_cpar = n_cpar.as(not null)
+ n_cpar.parent = self
+ end
+
+ redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+ do
+ if _n_opar == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TOpar
+ _n_opar = new_child
+ else
+ abort
+ end
+ return
+ end
+ for i in [0.._n_exprs.length[ do
+ if _n_exprs[i] == old_child then
+ if new_child != null then
+ assert new_child isa AExpr
+ _n_exprs[i] = new_child
+ new_child.parent = self
+ else
+ _n_exprs.remove_at(i)
+ end
+ return
+ end
+ end
+ if _n_cpar == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TCpar
+ _n_cpar = new_child
+ else
+ abort
+ end
+ return
+ end
+ end
+
+ redef fun visit_all(v: Visitor)
+ do
+ v.enter_visit(_n_opar)
+ for n in _n_exprs do
+ v.enter_visit(n)
+ end
+ v.enter_visit(_n_cpar)
+ end
+end
+redef class ABraExprs
+ private init empty_init do end
+
+ init init_abraexprs (
+ n_obra: nullable TObra,
+ n_exprs: Collection[Object], # Should be Collection[AExpr]
+ n_cbra: nullable TCbra
+ )
+ do
+ empty_init
+ _n_obra = n_obra.as(not null)
+ n_obra.parent = self
+ for n in n_exprs do
+ assert n isa AExpr
+ _n_exprs.add(n)
+ n.parent = self
+ end
+ _n_cbra = n_cbra.as(not null)
+ n_cbra.parent = self
+ end
+
+ redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+ do
+ if _n_obra == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TObra
+ _n_obra = new_child
+ else
+ abort
+ end
+ return
+ end
+ for i in [0.._n_exprs.length[ do
+ if _n_exprs[i] == old_child then
+ if new_child != null then
+ assert new_child isa AExpr
+ _n_exprs[i] = new_child
+ new_child.parent = self
+ else
+ _n_exprs.remove_at(i)
+ end
+ return
+ end
+ end
+ if _n_cbra == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TCbra
+ _n_cbra = new_child
+ else
+ abort
+ end
+ return
+ end
+ end
+
+ redef fun visit_all(v: Visitor)
+ do
+ v.enter_visit(_n_obra)
+ for n in _n_exprs do
+ v.enter_visit(n)
+ end
+ v.enter_visit(_n_cbra)
+ end
+end
redef class APlusAssignOp
private init empty_init do end
v.enter_visit(_n_kwnullable)
end
end
+redef class AInLanguage
+ private init empty_init do end
+
+ init init_ainlanguage (
+ n_kwin: nullable TKwin,
+ n_string: nullable TString
+ )
+ do
+ empty_init
+ _n_kwin = n_kwin.as(not null)
+ n_kwin.parent = self
+ _n_string = n_string.as(not null)
+ n_string.parent = self
+ end
+
+ redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+ do
+ if _n_kwin == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TKwin
+ _n_kwin = new_child
+ else
+ abort
+ end
+ return
+ end
+ if _n_string == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TString
+ _n_string = new_child
+ else
+ abort
+ end
+ return
+ end
+ end
+
+ redef fun visit_all(v: Visitor)
+ do
+ v.enter_visit(_n_kwin)
+ v.enter_visit(_n_string)
+ end
+end
+redef class AExternCodeBlock
+ private init empty_init do end
+
+ init init_aexterncodeblock (
+ n_in_language: nullable AInLanguage,
+ n_extern_code_segment: nullable TExternCodeSegment
+ )
+ do
+ empty_init
+ _n_in_language = n_in_language
+ if n_in_language != null then
+ n_in_language.parent = self
+ end
+ _n_extern_code_segment = n_extern_code_segment.as(not null)
+ n_extern_code_segment.parent = self
+ end
+
+ redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+ do
+ if _n_in_language == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa AInLanguage
+ _n_in_language = new_child
+ else
+ _n_in_language = null
+ end
+ return
+ end
+ if _n_extern_code_segment == old_child then
+ if new_child != null then
+ new_child.parent = self
+ assert new_child isa TExternCodeSegment
+ _n_extern_code_segment = new_child
+ else
+ abort
+ end
+ return
+ end
+ end
+
+ redef fun visit_all(v: Visitor)
+ do
+ if _n_in_language != null then
+ v.enter_visit(_n_in_language.as(not null))
+ end
+ v.enter_visit(_n_extern_code_segment)
+ end
+end
redef class AQualified
private init empty_init do end
end
redef class Start
- init(
- n_base: nullable AModule,
- n_eof: EOF)
- do
- _n_base = n_base
- _n_eof = n_eof
- end
-
redef fun replace_child(old_child: ANode, new_child: nullable ANode)
do
if _n_base == old_child then