typing: Add `do_typing` on AExpr
authorFlorian Deljarry <deljarry.florian@gmail.com>
Fri, 10 Apr 2020 14:20:18 +0000 (10:20 -0400)
committerFlorian Deljarry <deljarry.florian@gmail.com>
Mon, 20 Apr 2020 14:56:48 +0000 (10:56 -0400)
Add a way to type `AExpr`.

Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>

src/semantize/typing.nit

index 5d6b5da..7c530c1 100644 (file)
@@ -1032,6 +1032,18 @@ redef class AExpr
                end
                return res
        end
                end
                return res
        end
+
+       # Type the expression as if located in `visited_mpropdef`
+       # `TypeVisitor` and `PostTypingVisitor` will be used to do the typing, see them for more information.
+       #
+       # `visited_mpropdef`: Correspond to the evaluation context in which the expression is located.
+       fun do_typing(modelbuilder: ModelBuilder, visited_mpropdef: MPropDef)
+       do
+               var type_visitor = new TypeVisitor(modelbuilder, visited_mpropdef)
+               type_visitor.visit_stmt(self)
+               var post_visitor = new PostTypingVisitor(type_visitor)
+               post_visitor.enter_visit(self)
+       end
 end
 
 redef class ABlockExpr
 end
 
 redef class ABlockExpr