self
and the root
of the ASTENSURE self == self.root implies result == 0
ENSURE self != self.root implies result == self.parent.depth + 1
# Number of nodes between `self` and the `root` of the AST
# ENSURE `self == self.root implies result == 0 `
# ENSURE `self != self.root implies result == self.parent.depth + 1`
fun depth: Int
do
var n = self
var res = 0
loop
var p = n.parent
if p == null then return res
n = p
res += 1
end
end
src/parser/parser_nodes.nit:100,2--113,4