Moved special casing of 'assert(this, "null this");' generated statements from !ThisExp into !AssertExp.

Fixed filenames for array bounds errors and probably others, fixes #271 .
This commit is contained in:
Tomas Lindquist Olsen
2009-04-27 13:30:48 +02:00
parent ba38e15f0d
commit 95b94935ee
8 changed files with 58 additions and 35 deletions

View File

@@ -128,10 +128,9 @@ void DtoAssert(Module* M, Loc loc, DValue* msg)
// file param
// we might be generating for an imported template function
if (!M->ir.irModule)
M->ir.irModule = new IrModule(M, M->srcfile->toChars());
IrModule* irmod = getIrModule(M);
args.push_back(DtoLoad(M->ir.irModule->fileName));
args.push_back(DtoLoad(irmod->fileName));
// line param
LLConstant* c = DtoConstUint(loc.linnum);
@@ -1399,3 +1398,17 @@ bool hasUnalignedFields(Type* t)
ts->unaligned = 1;
return false;
}
//////////////////////////////////////////////////////////////////////////////////////////
IrModule * getIrModule(Module * M)
{
if (M == NULL)
M = gIR->func()->decl->getModule();
assert(M && "null module");
if (!M->ir.irModule)
M->ir.irModule = new IrModule(M, M->srcfile->toChars());
return M->ir.irModule;
}
//////////////////////////////////////////////////////////////////////////////////////////