diff sema/ScopeBuilder.d @ 107:189c049cbfcc new_gen

Cleanup of codegen, better support for operators a few bugfixes
author Anders Halager <halager@gmail.com>
date Sun, 25 May 2008 14:40:14 +0200
parents 09b4d74cb3f5
children c0b531362ca6
line wrap: on
line diff
--- a/sema/ScopeBuilder.d	Thu May 08 10:54:29 2008 +0200
+++ b/sema/ScopeBuilder.d	Sun May 25 14:40:14 2008 +0200
@@ -42,14 +42,16 @@
 
     override void visitStructDecl(StructDecl s)
     {
+        super.visitStructDecl(s);
+
         DType[char[]] types;
 
         auto st = s.env.types[s.identifier.get].asStruct;
-        foreach(decl ; s.decls)
-            if(auto varDecl = cast(VarDecl)decl)
+        foreach (decl; s.decls)
+            if (auto varDecl = cast(VarDecl)decl)
                 st.addMember(typeOf(varDecl.varType, varDecl.env), varDecl.identifier.get);
-
-        super.visitStructDecl(s);
+            else if (auto fd = cast(FuncDecl)decl)
+                st.addMember(fd.type, fd.identifier.get);
     }
 
     DType typeOf(Identifier id, Scope sc)