The detach method completely remove the node in the parent.

However, sometime, it is useful to keep the emplacement of the removed child.

The standard use case is the insertion of a node between a parent p and a child p.c. To create the new node n, we need to attach the child to it. But, to put n where c was in p, the place has to be remembered.

var p: AExpr
var c = p.c
var h = c.detach_with_placeholder
var n = astbuilder.make_XXX(c)
h.replace_with(n)

Property definitions

nitc :: astbuilder $ AExpr :: detach_with_placeholder
	# The `detach` method completely remove the node in the parent.
	# However, sometime, it is useful to keep the emplacement of the removed child.
	#
	# The standard use case is the insertion of a node between a parent `p` and a child `p.c`.
	# To create the new node `n`, we need to attach the child to it.
	# But, to put `n` where `c` was in `p`, the place has to be remembered.
	#
	# ~~~nitish
	# var p: AExpr
	# var c = p.c
	# var h = c.detach_with_placeholder
	# var n = astbuilder.make_XXX(c)
	# h.replace_with(n)
	# ~~~
	fun detach_with_placeholder: AExpr
	do
		var h = new APlaceholderExpr.make
		self.replace_with(h)
		return h
	end
src/astbuilder.nit:239,2--258,4