diff gen/toobj.c @ 15:37a4fdab33fc trunk

[svn r19] * Added support for reassigning 'this' inside class constructors. * Added preliminary support for UnrolledLoopStatement. That is foreach on a tuple.
author lindquist
date Wed, 03 Oct 2007 04:56:32 +0200
parents 0e86428ee567
children 6c6cd097bcdf
line wrap: on
line diff
--- a/gen/toobj.c	Wed Oct 03 02:15:12 2007 +0200
+++ b/gen/toobj.c	Wed Oct 03 04:56:32 2007 +0200
@@ -665,9 +665,20 @@
         // function definition
         if (allow_fbody && fbody != 0)
         {
+            gIR->funcdecls.push_back(this);
+
             // first make absolutely sure the type is up to date
             f->llvmType = llvmValue->getType()->getContainedType(0);
 
+            // this handling
+            if (f->llvmUsesThis) {
+                if (f->llvmRetInPtr)
+                    llvmThisVar = ++func->arg_begin();
+                else
+                    llvmThisVar = func->arg_begin();
+                assert(llvmThisVar != 0);
+            }
+
             if (isMain())
                 gIR->emitMain = true;
 
@@ -716,6 +727,8 @@
                 // possibly assert(lastbb->getNumPredecessors() == 0); ??? try it out sometime ...
                 new llvm::UnreachableInst(lastbb);
             }
+
+            gIR->funcdecls.pop_back();
         }
     }
 }