diff sema/SymbolTableBuilder.d @ 63:9f8131676242 new_gen

Now Decl's have a DType type(), and should use varType and returnType to get the old type id
author Anders Halager <halager@gmail.com>
date Tue, 29 Apr 2008 15:13:38 +0200
parents 1d6f4ad38a91
children 91f10c34cd7b
line wrap: on
line diff
--- a/sema/SymbolTableBuilder.d	Tue Apr 29 15:00:11 2008 +0200
+++ b/sema/SymbolTableBuilder.d	Tue Apr 29 15:13:38 2008 +0200
@@ -21,7 +21,7 @@
 
     override void visitFuncDecl(FuncDecl d)
     {
-        visitExp(d.type);
+        visitExp(d.returnType);
         visitExp(d.identifier);
         SmallArray!(DType, 8) arg_types;
         foreach (arg; d.funcArgs)
@@ -33,7 +33,7 @@
             visitStmt(stmt);
 
         auto func_t = new DFunction(d.identifier);
-        func_t.return_type = d.env.findType(d.type);
+        func_t.returnType = d.env.findType(d.returnType);
         func_t.params = arg_types.safe();
 
         auto sym = d.env.find(d.identifier);
@@ -45,8 +45,8 @@
         if (d.init)
             visitExp(d.init);
 
-        d.env.find(d.identifier).type = typeOf(d.type, d.env);
-        visitExp(d.type);
+        d.env.find(d.identifier).type = typeOf(d.varType, d.env);
+        visitExp(d.varType);
         visitExp(d.identifier);
     }
 
@@ -56,9 +56,7 @@
 
         auto st = (cast(DStruct)s.env.types[s.identifier.get]);
         foreach(varDecl ; s.vars)
-        {
-            st.addMember(typeOf(varDecl.type, varDecl.env), varDecl.identifier.get);
-        }
+            st.addMember(typeOf(varDecl.varType, varDecl.env), varDecl.identifier.get);
 
         super.visitStructDecl(s);
     }
@@ -66,13 +64,6 @@
     DType typeOf(Identifier id, Scope sc)
     {
         return sc.findType(id);
-
-        /*
-        if (auto type = id.get in types)
-            return *type;
-        DType res = new DType(id);
-        types[id.get] = res;
-        return res;*/
     }
 }
 
@@ -124,7 +115,7 @@
         auto sym = current().add(d.identifier);
         auto sc = push();
 
-        visitExp(d.type);
+        visitExp(d.returnType);
         visitExp(d.identifier);
         d.env = current();
         sc.parentFunction = d;
@@ -151,7 +142,7 @@
         auto sc = current();
         auto sym = sc.add(d.identifier);
         d.env = sc;
-        visitExp(d.type);
+        visitExp(d.varType);
         visitExp(d.identifier);
     }