| ... | @@ -3023,12 +3023,19 @@ static int trans_stmt_extra(Context *c, TransScope *scope, const Stmt *stmt, | ... | @@ -3023,12 +3023,19 @@ static int trans_stmt_extra(Context *c, TransScope *scope, const Stmt *stmt, |
| 3023 | trans_unary_operator(c, result_used, scope, (const UnaryOperator *)stmt)); | 3023 | trans_unary_operator(c, result_used, scope, (const UnaryOperator *)stmt)); |
| 3024 | case Stmt::DeclStmtClass: | 3024 | case Stmt::DeclStmtClass: |
| 3025 | return trans_local_declaration(c, scope, (const DeclStmt *)stmt, out_node, out_child_scope); | 3025 | return trans_local_declaration(c, scope, (const DeclStmt *)stmt, out_node, out_child_scope); |
| | 3026 | case Stmt::DoStmtClass: |
| 3026 | case Stmt::WhileStmtClass: { | 3027 | case Stmt::WhileStmtClass: { |
| 3027 | AstNode *while_node = trans_while_loop(c, scope, (const WhileStmt *)stmt); | 3028 | AstNode *while_node = sc == Stmt::DoStmtClass |
| | 3029 | ? trans_do_loop(c, scope, (const DoStmt *)stmt) |
| | 3030 | : trans_while_loop(c, scope, (const WhileStmt *)stmt); |
| | 3031 | |
| | 3032 | if (while_node == nullptr) |
| | 3033 | return ErrorUnexpected; |
| | 3034 | |
| 3028 | assert(while_node->type == NodeTypeWhileExpr); | 3035 | assert(while_node->type == NodeTypeWhileExpr); |
| 3029 | if (while_node->data.while_expr.body == nullptr) { | 3036 | if (while_node->data.while_expr.body == nullptr) |
| 3030 | while_node->data.while_expr.body = trans_create_node(c, NodeTypeBlock); | 3037 | while_node->data.while_expr.body = trans_create_node(c, NodeTypeBlock); |
| 3031 | } | 3038 | |
| 3032 | return wrap_stmt(out_node, out_child_scope, scope, while_node); | 3039 | return wrap_stmt(out_node, out_child_scope, scope, while_node); |
| 3033 | } | 3040 | } |
| 3034 | case Stmt::IfStmtClass: | 3041 | case Stmt::IfStmtClass: |
| ... | @@ -3053,14 +3060,6 @@ static int trans_stmt_extra(Context *c, TransScope *scope, const Stmt *stmt, | ... | @@ -3053,14 +3060,6 @@ static int trans_stmt_extra(Context *c, TransScope *scope, const Stmt *stmt, |
| 3053 | case Stmt::UnaryExprOrTypeTraitExprClass: | 3060 | case Stmt::UnaryExprOrTypeTraitExprClass: |
| 3054 | return wrap_stmt(out_node, out_child_scope, scope, | 3061 | return wrap_stmt(out_node, out_child_scope, scope, |
| 3055 | trans_unary_expr_or_type_trait_expr(c, scope, (const UnaryExprOrTypeTraitExpr *)stmt)); | 3062 | trans_unary_expr_or_type_trait_expr(c, scope, (const UnaryExprOrTypeTraitExpr *)stmt)); |
| 3056 | case Stmt::DoStmtClass: { | | |
| 3057 | AstNode *while_node = trans_do_loop(c, scope, (const DoStmt *)stmt); | | |
| 3058 | assert(while_node->type == NodeTypeWhileExpr); | | |
| 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); | | |
| 3063 | } | | |
| 3064 | case Stmt::ForStmtClass: { | 3063 | case Stmt::ForStmtClass: { |
| 3065 | AstNode *node = trans_for_loop(c, scope, (const ForStmt *)stmt); | 3064 | AstNode *node = trans_for_loop(c, scope, (const ForStmt *)stmt); |
| 3066 | return wrap_stmt(out_node, out_child_scope, scope, node); | 3065 | return wrap_stmt(out_node, out_child_scope, scope, node); |