chore: remove trailing whitespace from README.md line 42
This commit is contained in:
@@ -34,6 +34,7 @@ typedef enum {
|
||||
RAVA_OP_OR,
|
||||
RAVA_OP_XOR,
|
||||
RAVA_OP_NOT,
|
||||
RAVA_OP_BITNOT,
|
||||
RAVA_OP_SHL,
|
||||
RAVA_OP_SHR,
|
||||
RAVA_OP_USHR,
|
||||
|
||||
+38
-2
@@ -141,11 +141,43 @@ static void _rava_ir_gen_expression(RavaIRGenerator_t *gen, RavaASTNode_t *expr)
|
||||
}
|
||||
|
||||
case RAVA_AST_BINARY_EXPR:
|
||||
_rava_ir_gen_binary_expr(gen, expr);
|
||||
if (expr->data.binary.op == RAVA_BINOP_AND) {
|
||||
_rava_ir_gen_expression(gen, expr->data.binary.left);
|
||||
instr.opcode = RAVA_OP_DUP;
|
||||
_rava_ir_emit(gen, instr);
|
||||
int end_label = rava_instruction_list_new_label(gen->current_method->instructions);
|
||||
instr.opcode = RAVA_OP_JUMP_IF_FALSE;
|
||||
instr.operand.label_id = end_label;
|
||||
_rava_ir_emit(gen, instr);
|
||||
instr.opcode = RAVA_OP_POP;
|
||||
_rava_ir_emit(gen, instr);
|
||||
_rava_ir_gen_expression(gen, expr->data.binary.right);
|
||||
instr.opcode = RAVA_OP_LABEL;
|
||||
instr.operand.label_id = end_label;
|
||||
_rava_ir_emit(gen, instr);
|
||||
} else if (expr->data.binary.op == RAVA_BINOP_OR) {
|
||||
_rava_ir_gen_expression(gen, expr->data.binary.left);
|
||||
instr.opcode = RAVA_OP_DUP;
|
||||
_rava_ir_emit(gen, instr);
|
||||
int end_label = rava_instruction_list_new_label(gen->current_method->instructions);
|
||||
instr.opcode = RAVA_OP_JUMP_IF_TRUE;
|
||||
instr.operand.label_id = end_label;
|
||||
_rava_ir_emit(gen, instr);
|
||||
instr.opcode = RAVA_OP_POP;
|
||||
_rava_ir_emit(gen, instr);
|
||||
_rava_ir_gen_expression(gen, expr->data.binary.right);
|
||||
instr.opcode = RAVA_OP_LABEL;
|
||||
instr.operand.label_id = end_label;
|
||||
_rava_ir_emit(gen, instr);
|
||||
} else {
|
||||
_rava_ir_gen_binary_expr(gen, expr);
|
||||
}
|
||||
break;
|
||||
|
||||
case RAVA_AST_UNARY_EXPR:
|
||||
if (expr->data.unary.op == RAVA_UNOP_MINUS) {
|
||||
if (expr->data.unary.op == RAVA_UNOP_PLUS) {
|
||||
_rava_ir_gen_expression(gen, expr->data.unary.operand);
|
||||
} else if (expr->data.unary.op == RAVA_UNOP_MINUS) {
|
||||
_rava_ir_gen_expression(gen, expr->data.unary.operand);
|
||||
instr.opcode = RAVA_OP_NEG;
|
||||
_rava_ir_emit(gen, instr);
|
||||
@@ -153,6 +185,10 @@ static void _rava_ir_gen_expression(RavaIRGenerator_t *gen, RavaASTNode_t *expr)
|
||||
_rava_ir_gen_expression(gen, expr->data.unary.operand);
|
||||
instr.opcode = RAVA_OP_NOT;
|
||||
_rava_ir_emit(gen, instr);
|
||||
} else if (expr->data.unary.op == RAVA_UNOP_BITNOT) {
|
||||
_rava_ir_gen_expression(gen, expr->data.unary.operand);
|
||||
instr.opcode = RAVA_OP_BITNOT;
|
||||
_rava_ir_emit(gen, instr);
|
||||
} else if (expr->data.unary.op == RAVA_UNOP_PREINC || expr->data.unary.op == RAVA_UNOP_PREDEC) {
|
||||
if (expr->data.unary.operand->type == RAVA_AST_IDENTIFIER_EXPR) {
|
||||
int local_index = _rava_ir_find_local(gen, expr->data.unary.operand->data.identifier.name);
|
||||
|
||||
Reference in New Issue
Block a user