From 2e6730d94623d8b025a388f7cab53ff9efbc3156 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Tue, 13 Aug 2013 12:27:04 -0400 Subject: [PATCH] typing: the static type of a blockexpr is the one of the last expression Signed-off-by: Jean Privat --- src/typing.nit | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/typing.nit b/src/typing.nit index 5545008..45866b7 100644 --- a/src/typing.nit +++ b/src/typing.nit @@ -559,6 +559,13 @@ redef class ABlockExpr for e in self.n_expr do v.visit_stmt(e) self.is_typed = true end + + # The type of a blockexpr is the one of the last expression (or null if empty) + redef fun mtype + do + if self.n_expr.is_empty then return null + return self.n_expr.last.mtype + end end redef class AVardeclExpr -- 1.7.9.5