diff gen/functions.cpp @ 144:a27941d00351 trunk

[svn r149] fixed: a bunch of D-style variadics problems. fixed: GotoDefaultStatement implemented. fixed: some other minor bugs.
author lindquist
date Sat, 26 Jan 2008 17:13:22 +0100
parents 0ab29b838084
children 4c577c2b7229
line wrap: on
line diff
--- a/gen/functions.cpp	Fri Jan 25 01:42:36 2008 +0100
+++ b/gen/functions.cpp	Sat Jan 26 17:13:22 2008 +0100
@@ -321,7 +321,12 @@
     bool declareOnly = false;
     bool templInst = fdecl->parent && DtoIsTemplateInstance(fdecl->parent);
     if (!templInst && fdecl->getModule() != gIR->dmodule)
+    {
+        Logger::println("not template instance, and not in this module. declare only!");
+        Logger::println("current module: %s", gIR->dmodule->ident->toChars());
+        Logger::println("func module: %s", fdecl->getModule()->ident->toChars());
         declareOnly = true;
+    }
     else if (fdecl->llvmInternal == LLVMva_start)
         declareOnly = true;
 
@@ -548,11 +553,15 @@
                     }
                     for (std::set<VarDeclaration*>::iterator i=fd->nestedVars.begin(); i!=fd->nestedVars.end(); ++i) {
                         VarDeclaration* vd = *i;
+                        Logger::println("referenced nested variable %s", vd->toChars());
                         if (!vd->irLocal)
                             vd->irLocal = new IrLocal(vd);
                         vd->irLocal->nestedIndex = j++;
                         if (vd->isParameter()) {
-                            
+                            if (!vd->irLocal->value) {
+                                assert(vd == fd->vthis);
+                                vd->irLocal->value = fd->irFunc->thisVar;
+                            }
                             assert(vd->irLocal->value);
                             nestTypes.push_back(vd->irLocal->value->getType());
                         }