From: Jean Privat Date: Thu, 18 Jun 2015 01:49:38 +0000 (-0400) Subject: typing: new PostTypingVisitor that is run after the visit X-Git-Tag: v0.7.6~21^2~4 X-Git-Url: http://nitlanguage.org typing: new PostTypingVisitor that is run after the visit Signed-off-by: Jean Privat --- diff --git a/src/semantize/typing.nit b/src/semantize/typing.nit index 4868fc9..ffd68e7 100644 --- a/src/semantize/typing.nit +++ b/src/semantize/typing.nit @@ -748,6 +748,9 @@ redef class AMethPropdef if not v.has_loop or not v.dirty then break end + var post_visitor = new PostTypingVisitor(v) + post_visitor.enter_visit(self) + if not nblock.after_flow_context.is_unreachable and msignature.return_mtype != null then # We reach the end of the function without having a return, it is bad v.error(self, "Error: reached end of function; expected `return` with a value.") @@ -755,6 +758,19 @@ redef class AMethPropdef end end +private class PostTypingVisitor + super Visitor + var type_visitor: TypeVisitor + redef fun visit(n) do + n.visit_all(self) + n.accept_post_typing(type_visitor) + end +end + +redef class ANode + private fun accept_post_typing(v: TypeVisitor) do end +end + redef class AAttrPropdef redef fun do_typing(modelbuilder: ModelBuilder) do