| ... | ... | @@ -2783,7 +2783,12 @@ static AstNode *trans_for_loop(Context *c, TransScope *parent_scope, const ForSt |
| 2783 | 2783 | TransScope *body_scope = trans_stmt(c, &while_scope->base, stmt->getBody(), &body_statement); |
| 2784 | 2784 | if (body_scope == nullptr) |
| 2785 | 2785 | return nullptr; |
| 2786 | | while_scope->node->data.while_expr.body = body_statement; |
| 2786 | |
| 2787 | if (body_statement == nullptr) { |
| 2788 | while_scope->node->data.while_expr.body = trans_create_node(c, NodeTypeBlock); |
| 2789 | } else { |
| 2790 | while_scope->node->data.while_expr.body = body_statement; |
| 2791 | } |
| 2787 | 2792 | |
| 2788 | 2793 | return loop_block_node; |
| 2789 | 2794 | } |
| ... | ... | @@ -3020,6 +3025,7 @@ static int trans_stmt_extra(Context *c, TransScope *scope, const Stmt *stmt, |
| 3020 | 3025 | return trans_local_declaration(c, scope, (const DeclStmt *)stmt, out_node, out_child_scope); |
| 3021 | 3026 | case Stmt::WhileStmtClass: { |
| 3022 | 3027 | AstNode *while_node = trans_while_loop(c, scope, (const WhileStmt *)stmt); |
| 3028 | assert(while_node->type == NodeTypeWhileExpr); |
| 3023 | 3029 | if (while_node->data.while_expr.body == nullptr) { |
| 3024 | 3030 | while_node->data.while_expr.body = trans_create_node(c, NodeTypeBlock); |
| 3025 | 3031 | } |
| ... | ... | @@ -3049,17 +3055,15 @@ static int trans_stmt_extra(Context *c, TransScope *scope, const Stmt *stmt, |
| 3049 | 3055 | trans_unary_expr_or_type_trait_expr(c, scope, (const UnaryExprOrTypeTraitExpr *)stmt)); |
| 3050 | 3056 | case Stmt::DoStmtClass: { |
| 3051 | 3057 | AstNode *while_node = trans_do_loop(c, scope, (const DoStmt *)stmt); |
| 3058 | assert(while_node->type == NodeTypeWhileExpr); |
| 3052 | 3059 | if (while_node->data.while_expr.body == nullptr) { |
| 3053 | 3060 | while_node->data.while_expr.body = trans_create_node(c, NodeTypeBlock); |
| 3054 | 3061 | } |
| 3055 | 3062 | return wrap_stmt(out_node, out_child_scope, scope, while_node); |
| 3056 | 3063 | } |
| 3057 | 3064 | case Stmt::ForStmtClass: { |
| 3058 | | AstNode *while_node = trans_for_loop(c, scope, (const ForStmt *)stmt); |
| 3059 | | if (while_node->data.while_expr.body == nullptr) { |
| 3060 | | while_node->data.while_expr.body = trans_create_node(c, NodeTypeBlock); |
| 3061 | | } |
| 3062 | | return wrap_stmt(out_node, out_child_scope, scope, while_node); |
| 3065 | AstNode *node = trans_for_loop(c, scope, (const ForStmt *)stmt); |
| 3066 | return wrap_stmt(out_node, out_child_scope, scope, node); |
| 3063 | 3067 | } |
| 3064 | 3068 | case Stmt::StringLiteralClass: |
| 3065 | 3069 | return wrap_stmt(out_node, out_child_scope, scope, |