diff sema/Symbol.d @ 136:2be29b296081

Lots of changes: - Parsing classes and interfaces - Fixed some seg faults in sema - Supporting "private" to some extend - And a lot of other small fixes
author johnsen@johnsen-laptop
date Fri, 11 Jul 2008 21:47:57 +0200
parents 9869194de9b7
children 57b0b4464a0b
line wrap: on
line diff
--- a/sema/Symbol.d	Wed Jul 09 13:38:11 2008 +0200
+++ b/sema/Symbol.d	Fri Jul 11 21:47:57 2008 +0200
@@ -5,6 +5,8 @@
 
 import sema.DType;
 
+import ast.Decl;
+
 ///
 class Symbol
 {
@@ -49,6 +51,14 @@
         return null;
     }
 
+    /**
+      Get the members of the symbol
+     **/
+    Symbol[] getMembers()
+    {
+        return actual.contained;
+    }
+
     void dump()
     {
         Stdout("Symbol: ");
@@ -61,9 +71,10 @@
     }
 
     /// Create a member with the given name and type
-    Symbol createMember(char[] member, DType type)
+    Symbol createMember(char[] member, DType type, Decl decl)
     {
         auto res = new Symbol(member, type, this);
+        res.decl = decl;
         actual.contained ~= res;
         return res;
     }
@@ -73,15 +84,23 @@
 
       The target symbol can be a member of another symbol
      **/
-    Symbol createAlias(char[] aliasedName, Symbol target)
+    Symbol createAlias(char[] aliasedName, Symbol target, Decl decl)
     {
         auto res = new Symbol(aliasedName, target, this);
+        res.decl = decl;
         actual.contained ~= res;
         return res;
     }
 
     // The type of this symbol
     DType type;
+    // The declaration of this symbol
+    Decl decl;
+    // If the symbol is an alias, this will point to the actual symbol
+    Symbol actual;
+    // If this symbol is contained within a struct or similar this will point
+    // to that symbol
+    Symbol parent;
 
 private:
     // Helper for getMangledFQN - gets the FQN without _D and the type
@@ -114,11 +133,6 @@
 private:
     char[] name;
 
-    // If the symbol is an alias, this will point to the actual symbol
-    Symbol actual;
-    // If this symbol is contained within a struct or similar this will point
-    // to that symbol
-    Symbol parent;
     // All the symbols contained within this symbol
     Symbol[] contained;