mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-08-11 00:40:04 +02:00
D1: Fixed accessing parameters in contracts.
This reverts the changes from commit f7e5245 and implements the
proper fix – in D1, contracts are treated as normal nested functions.
GitHub: Fix #138.
This commit is contained in:
@@ -1562,11 +1562,16 @@ DValue* ThisExp::toElem(IRState* p)
|
||||
LLValue* v;
|
||||
Dsymbol* vdparent = vd->toParent2();
|
||||
Identifier *ident = p->func()->decl->ident;
|
||||
#if DMDV2
|
||||
// In D1, contracts are treated as normal nested methods, 'this' is
|
||||
// just passed in the context struct along with any used parameters.
|
||||
if (ident == Id::ensure || ident == Id::require) {
|
||||
Logger::println("contract this exp");
|
||||
v = p->func()->nestArg;
|
||||
v = DtoBitCast(v, DtoType(type)->getPointerTo());
|
||||
} else if (vdparent != p->func()->decl) {
|
||||
} else
|
||||
#endif
|
||||
if (vdparent != p->func()->decl) {
|
||||
Logger::println("nested this exp");
|
||||
#if STRUCTTHISREF
|
||||
return DtoNestedVariable(loc, type, vd, type->ty == Tstruct);
|
||||
|
||||
Reference in New Issue
Block a user