Mercurial > projects > ldc
comparison gen/llvmhelpers.cpp @ 639:8aebdf56c455
Move check for access of context for nested class from backend into frontend.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Thu, 02 Oct 2008 23:12:19 +0200 |
parents | df196c8dea26 |
children | 8d850fa25713 |
comparison
equal
deleted
inserted
replaced
638:94b01f15814f | 639:8aebdf56c455 |
---|---|
388 { | 388 { |
389 Logger::println("DtoNestedContext for %s", sym->toPrettyChars()); | 389 Logger::println("DtoNestedContext for %s", sym->toPrettyChars()); |
390 LOG_SCOPE; | 390 LOG_SCOPE; |
391 | 391 |
392 IrFunction* irfunc = gIR->func(); | 392 IrFunction* irfunc = gIR->func(); |
393 | 393 |
394 // if this func has its own vars that are accessed by nested funcs | |
395 // use its own context | |
394 if (irfunc->nestedVar) | 396 if (irfunc->nestedVar) |
395 return irfunc->nestedVar; | 397 return irfunc->nestedVar; |
398 // otherwise, it may have gotten a context from the caller | |
396 else if (irfunc->nestArg) | 399 else if (irfunc->nestArg) |
397 return irfunc->nestArg; | 400 return irfunc->nestArg; |
401 // or just have a this argument | |
398 else if (irfunc->thisArg) | 402 else if (irfunc->thisArg) |
399 { | 403 { |
400 ClassDeclaration* cd = irfunc->decl->isMember2()->isClassDeclaration(); | 404 ClassDeclaration* cd = irfunc->decl->isMember2()->isClassDeclaration(); |
401 if (!cd || !cd->vthis) | 405 if (!cd || !cd->vthis) |
402 return getNullPtr(getVoidPtrType()); | 406 return getNullPtr(getVoidPtrType()); |