super Visitor
redef fun visit(node)
do
- path.unshift(node)
node.accept_ast_validation(self)
- path.shift
end
private var path = new List[ANode]
private var seen = new HashSet[ANode]
private fun accept_ast_validation(v: ASTValidationVisitor)
do
var parent = self.parent
+ var path = v.path
- if v.path.length > 1 then
- var path_parent = v.path[1]
+ if path.length > 0 then
+ var path_parent = v.path.first
if parent == null then
self.parent = path_parent
#debug "PARENT: expected parent: {path_parent}"
+ v.seen.add(self)
else if parent != path_parent then
self.parent = path_parent
- debug "PARENT: expected parent: {path_parent}, got {parent}"
+ if v.seen.has(self) then
+ debug "DUPLICATE (NOTATREE): already seen node with parent {parent} now with {path_parent}."
+ else
+ v.seen.add(self)
+ debug "PARENT: expected parent: {path_parent}, got {parent}"
+ end
end
end
- if v.seen.has(self) then
- debug "DUPLICATE: already seen node. NOTATREE"
- end
- v.seen.add(self)
-
- if _location == null then
+ if not isset _location then
#debug "LOCATION: unlocated node {v.path.join(", ")}"
_location = self.parent.location
end
+ path.unshift(self)
visit_all(v)
+ path.shift
end
end
-redef class AAnnotations
+redef class AAnnotation
redef fun accept_ast_validation(v)
do
# Do not enter in annotations
do
super
if mtype == null and not is_typed then
- debug "TYPING: untyped expression"
+ #debug "TYPING: untyped expression"
end
end
end