mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 00:55:49 +03:00
Fix ICE with closures in member functions.
I chose to fix the problem this way because it increases uniformity between 'this' and normal explicit parameters. Another possibility would be to just change the type determinatin code in DtoCreateNestedContextType to not expect the value to be already present, because it doesn't need it when isVthisPtr is true anyway. GitHub: Fixes #217.
This commit is contained in:
parent
080d0cef0f
commit
9cbfc604c7
2 changed files with 18 additions and 6 deletions
|
@ -755,7 +755,22 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
|
|||
if (f->fty.arg_this) {
|
||||
iarg->setName(".this_arg");
|
||||
fdecl->ir.irFunc->thisArg = iarg;
|
||||
assert(fdecl->ir.irFunc->thisArg);
|
||||
|
||||
VarDeclaration* v = fdecl->vthis;
|
||||
if (v) {
|
||||
// We already build the this argument here if we will need it
|
||||
// later for codegen'ing the function, just as normal
|
||||
// parameters below, because it can be referred to in nested
|
||||
// context types. Will be given storage in DtoDefineFunction.
|
||||
assert(!v->ir.irParam);
|
||||
IrParameter* p = new IrParameter(v);
|
||||
p->isVthis = true;
|
||||
p->value = iarg;
|
||||
p->arg = f->fty.arg_this;
|
||||
|
||||
v->ir.irParam = p;
|
||||
}
|
||||
|
||||
++iarg;
|
||||
}
|
||||
else if (f->fty.arg_nest) {
|
||||
|
@ -904,11 +919,8 @@ void DtoDefineFunction(FuncDeclaration* fd)
|
|||
irfunction->thisArg = thismem;
|
||||
}
|
||||
|
||||
assert(!fd->vthis->ir.irParam);
|
||||
fd->vthis->ir.irParam = new IrParameter(fd->vthis);
|
||||
assert(fd->vthis->ir.irParam->value == thisvar);
|
||||
fd->vthis->ir.irParam->value = thismem;
|
||||
fd->vthis->ir.irParam->arg = f->fty.arg_this;
|
||||
fd->vthis->ir.irParam->isVthis = true;
|
||||
|
||||
DtoDwarfLocalVariable(thismem, fd->vthis);
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c962f5df8cc40fada5e9df72ba1a6daefb82fc96
|
||||
Subproject commit 72fc92aaa49c3ed7c1ad3f3e90cbd56865297354
|
Loading…
Add table
Add a link
Reference in a new issue