From 0ec385152acaf498c3a5c314f10bffa65e5b3e0b Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Wed, 17 Jun 2015 21:49:38 -0400 Subject: [PATCH] typing: new PostTypingVisitor that is run after the visit Signed-off-by: Jean Privat --- src/semantize/typing.nit | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 -- 1.7.9.5