mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-24 16:43:14 +01:00
Cast result of ...AssignExp to type the frontend expects if necessary. Fixes #116.
This commit is contained in:
17
gen/toir.cpp
17
gen/toir.cpp
@@ -537,7 +537,7 @@ DValue* AddExp::toElem(IRState* p)
|
||||
|
||||
DValue* AddAssignExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("AddAssignExp::toElem: %s\n", toChars());
|
||||
Logger::print("AddAssignExp::toElem: %s | %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* l = e1->toElem(p);
|
||||
@@ -558,6 +558,9 @@ DValue* AddAssignExp::toElem(IRState* p)
|
||||
}
|
||||
DtoAssign(loc, l, res);
|
||||
|
||||
if (res->getType() != type)
|
||||
res = DtoCast(loc, res, type);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -631,6 +634,9 @@ DValue* MinAssignExp::toElem(IRState* p)
|
||||
}
|
||||
DtoAssign(loc, l, res);
|
||||
|
||||
if (res->getType() != type)
|
||||
res = DtoCast(loc, res, type);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -670,6 +676,9 @@ DValue* MulAssignExp::toElem(IRState* p)
|
||||
}
|
||||
DtoAssign(loc, l, res);
|
||||
|
||||
if (res->getType() != type)
|
||||
res = DtoCast(loc, res, type);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -709,6 +718,9 @@ DValue* DivAssignExp::toElem(IRState* p)
|
||||
}
|
||||
DtoAssign(loc, l, res);
|
||||
|
||||
if (res->getType() != type)
|
||||
res = DtoCast(loc, res, type);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -738,6 +750,9 @@ DValue* ModAssignExp::toElem(IRState* p)
|
||||
DValue* res = DtoBinRem(l->getType(), l, r);
|
||||
DtoAssign(loc, l, res);
|
||||
|
||||
if (res->getType() != type)
|
||||
res = DtoCast(loc, res, type);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user