nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8373962
)
typing: the static type of a blockexpr is the one of the last expression
author
Jean Privat
<jean@pryen.org>
Tue, 13 Aug 2013 16:27:04 +0000
(12:27 -0400)
committer
Jean Privat
<jean@pryen.org>
Tue, 13 Aug 2013 18:01:22 +0000
(14:01 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>
src/typing.nit
patch
|
blob
|
history
diff --git
a/src/typing.nit
b/src/typing.nit
index
5545008
..
45866b7
100644
(file)
--- 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