diff ast/Decl.d @ 64:91f10c34cd7b new_gen

Fixed some bugs, removed the function gathering pass in codegen and types are created when first referenced
author Anders Halager <halager@gmail.com>
date Tue, 29 Apr 2008 17:56:52 +0200
parents 9f8131676242
children 06dda301ea61
line wrap: on
line diff
--- a/ast/Decl.d	Tue Apr 29 15:13:38 2008 +0200
+++ b/ast/Decl.d	Tue Apr 29 17:56:52 2008 +0200
@@ -98,6 +98,8 @@
                 this.returnType = new Identifier("void");
                 env.find(identifier).type = t;
                 sret = true;
+
+                myType = null;
             }
         }
 
@@ -107,7 +109,7 @@
             stmt.simplify();
     }
 
-    override DType type()
+    override DFunction type()
     {
         if (myType !is null)
             return myType;
@@ -118,6 +120,7 @@
         foreach (a; funcArgs)
             array ~= a.type();
         t.params = array.safe();
+        t.firstParamIsReturnValue = this.sret;
         myType = t;
         return myType;
     }
@@ -126,7 +129,7 @@
     VarDecl[] funcArgs;
     Stmt[] statements;
     bool sret = false;
-    private DType myType;
+    private DFunction myType;
 }
 
 class StructDecl : Decl
@@ -149,7 +152,7 @@
 
     override DType type()
     {
-        return env.find(identifier).type;
+        return env.findType(identifier);
     }
 
     Identifier identifier;