| ... | @@ -942,6 +942,21 @@ static AstNode *trans_create_bin_op(Context *c, AstNode *block, Expr *lhs, BinOp | ... | @@ -942,6 +942,21 @@ static AstNode *trans_create_bin_op(Context *c, AstNode *block, Expr *lhs, BinOp |
| 942 | return node; | 942 | return node; |
| 943 | } | 943 | } |
| 944 | | 944 | |
| | 945 | static AstNode *trans_create_assign(Context *c, AstNode *block, Expr *lhs, Expr *rhs) { |
| | 946 | AstNode *node = trans_create_node(c, NodeTypeBinOpExpr); |
| | 947 | node->data.bin_op_expr.bin_op = BinOpTypeAssign; |
| | 948 | |
| | 949 | node->data.bin_op_expr.op1 = trans_expr(c, true, block, lhs, TransLValue); |
| | 950 | if (node->data.bin_op_expr.op1 == nullptr) |
| | 951 | return nullptr; |
| | 952 | |
| | 953 | node->data.bin_op_expr.op2 = trans_expr(c, true, block, rhs, TransRValue); |
| | 954 | if (node->data.bin_op_expr.op2 == nullptr) |
| | 955 | return nullptr; |
| | 956 | |
| | 957 | return node; |
| | 958 | } |
| | 959 | |
| 945 | static AstNode *trans_binary_operator(Context *c, bool result_used, AstNode *block, BinaryOperator *stmt) { | 960 | static AstNode *trans_binary_operator(Context *c, bool result_used, AstNode *block, BinaryOperator *stmt) { |
| 946 | switch (stmt->getOpcode()) { | 961 | switch (stmt->getOpcode()) { |
| 947 | case BO_PtrMemD: | 962 | case BO_PtrMemD: |
| ... | @@ -1026,7 +1041,7 @@ static AstNode *trans_binary_operator(Context *c, bool result_used, AstNode *blo | ... | @@ -1026,7 +1041,7 @@ static AstNode *trans_binary_operator(Context *c, bool result_used, AstNode *blo |
| 1026 | emit_warning(c, stmt->getLocStart(), "TODO handle more C binary operators: BO_Assign with result_used"); | 1041 | emit_warning(c, stmt->getLocStart(), "TODO handle more C binary operators: BO_Assign with result_used"); |
| 1027 | return nullptr; | 1042 | return nullptr; |
| 1028 | } | 1043 | } |
| 1029 | return trans_create_bin_op(c, block, stmt->getLHS(), BinOpTypeAssign, stmt->getRHS()); | 1044 | return trans_create_assign(c, block, stmt->getLHS(), stmt->getRHS()); |
| 1030 | case BO_MulAssign: | 1045 | case BO_MulAssign: |
| 1031 | emit_warning(c, stmt->getLocStart(), "TODO handle more C binary operators: BO_MulAssign"); | 1046 | emit_warning(c, stmt->getLocStart(), "TODO handle more C binary operators: BO_MulAssign"); |
| 1032 | return nullptr; | 1047 | return nullptr; |