Ejemplo n.º 1
0
        public override void visit_return_statement(ReturnStatement stmt)
        {
            stmt.accept_children(this);

            if (unreachable(stmt))
            {
                return;
            }

            current_block.add_node(stmt);

            if (stmt.return_expression != null)
            {
                handle_errors(stmt.return_expression);
            }

            for (int i = jump_stack.Count - 1; i >= 0; i--)
            {
                var jump_target = jump_stack[i];
                if (jump_target.is_return_target)
                {
                    current_block.connect(jump_target.basic_block);
                    mark_unreachable();
                    return;
                }
                else if (jump_target.is_finally_clause)
                {
                    current_block.connect(jump_target.basic_block);
                    current_block = jump_target.last_block;
                }
            }

            Report.error(stmt.source_reference, "no enclosing loop found");
            stmt.error = true;
        }
Ejemplo n.º 2
0
 public override void visit_return_statement(ReturnStatement stmt)
 {
     stmt.accept_children(this);
 }