aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/StatementGen.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/StatementGen.cc')
-rw-r--r--lib/CodeGen/StatementGen.cc9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/CodeGen/StatementGen.cc b/lib/CodeGen/StatementGen.cc
index 2443877..bd1f7c5 100644
--- a/lib/CodeGen/StatementGen.cc
+++ b/lib/CodeGen/StatementGen.cc
@@ -128,10 +128,7 @@ void CodeGen::emitStmt(StmtAST *Stmt) {
return;
}
- Value *Val = emitCoercedExpr(Assign->getExpr(), resolveType(Info->TypeName));
- if (!Val) return;
-
- Builder->CreateStore(Val, Info->Storage);
+ emitAssignment({symbolAddress(*Info), Info->TypeName}, Assign->getExpr(), Info);
return;
}
@@ -296,9 +293,7 @@ void CodeGen::emitStmt(StmtAST *Stmt) {
if (auto *DA = dynamic_cast<DesignatorAssignStmtAST*>(Stmt)) {
LValueInfo LV;
if (!emitLValue(DA->getTarget(), LV)) return;
- Value *Val = emitCoercedExpr(DA->getExpr(), resolveType(LV.TypeName));
- if (!Val) return;
- Builder->CreateStore(Val, LV.Addr);
+ emitAssignment(LV, DA->getExpr());
return;
}
}