+redef class AWhileExpr
+ super AAbsControl
+ redef fun accept_typing(v)
+ do
+ process_control(v, new EscapableBlock(self), n_label, true)
+ end
+
+ redef fun process_control_inside(v)
+ do
+ var old_flow_ctx = v.flow_ctx
+
+ # Process condition
+ v.enter_visit(n_expr)
+ v.check_conform_expr(n_expr, v.type_bool)
+
+ if n_expr isa ATrueExpr then
+ v.warning(self, "Warning: use 'loop' instead of 'while true do'.")
+ end
+
+ # Prepare inside context (assert cond)
+ v.use_if_true_flow_ctx(n_expr)
+
+ # Process inside
+ v.enter_visit_block(n_block)
+
+ # Compute outside context (assert !cond + all breaks)
+ v.flow_ctx = old_flow_ctx
+ v.use_if_false_flow_ctx(n_expr)
+ escapable.break_flow_contexts.add(v.flow_ctx)
+ end
+end
+
+redef class ALoopExpr
+ super AAbsControl
+ redef fun accept_typing(v)
+ do
+ process_control(v, new EscapableBlock(self), n_label, true)
+ end
+
+ redef fun process_control_inside(v)
+ do
+ # Process inside
+ v.enter_visit_block(n_block)
+
+ # Never automatically reach after the loop
+ v.mark_unreash(self)
+ end
+end
+