Example:
var a = foo # foo gives a A
# Before the while, the base static type of a is set to A
while a isa B do
a.some_b_stuff # OK, since a isa B
a = foo # OK, since 'base' static type of a is A
end
Signed-off-by: Jean Privat <jean@pryen.org>
v.base_variable_ctx = v.variable_ctx
v.variable_ctx = v.variable_ctx.sub(self)
- super
-
+ # Process condition
+ v.visit(n_expr)
v.check_conform_expr(n_expr, v.type_bool)
+
+ # Prepare inside context (assert cond)
+ v.use_if_true_variable_ctx(n_expr)
+
+ # Process inside
+ if n_block != null then
+ v.variable_ctx = v.variable_ctx.sub(n_block)
+ v.visit(n_block)
+ end
+
v.variable_ctx = old_var_ctx
v.base_variable_ctx = old_base_var_ctx
v.escapable_ctx.pop
a.foo(4)
a = a0
while a isa B do
- #alt8#a.foo(5)
+ a.foo(5)
a = new A
#alt5#a.foo(-5)
end
-alt/base_isa_cast2_alt8.nit:50,2--8: Error: Method 'foo' doesn't exists in A.
alt/base_isa_cast2_alt8.nit:62,1--7: Error: Method 'foo' doesn't exists in A.