Update binop codegen
This commit is contained in:
parent
0ea13482bf
commit
7f57098eb3
@ -132,14 +132,16 @@ namespace AST {
|
||||
|
||||
codegen::StackValue BinaryOperationExpression::codegen(codegen::Builder& builder, codegen::Scope& scope, codegen::StackAllocator& allocator) {
|
||||
auto lvalued = scope.with_lvalue();
|
||||
auto lhs = this->m_lhs->codegen(builder, this->m_binop == types::BinOp::Assignment ? lvalued : scope, allocator);
|
||||
auto rhs = this->m_rhs->codegen(builder, scope, allocator);
|
||||
try {
|
||||
|
||||
auto binop = types::find_binop(
|
||||
scope.binops,
|
||||
lhs.ty,
|
||||
this->m_lhs->get_codegen_type(scope),
|
||||
this->m_binop,
|
||||
rhs.ty);
|
||||
this->m_rhs->get_codegen_type(scope));
|
||||
|
||||
auto lhs = this->m_lhs->codegen(builder, binop->lhs_lvalue ? lvalued : scope, allocator);
|
||||
auto rhs = this->m_rhs->codegen(builder, scope, allocator);
|
||||
try {
|
||||
if (binop) {
|
||||
return codegen::StackValue{
|
||||
binop->codegen(builder, lhs.value, rhs.value),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user