diff src/dil/semantic/Symbols.d @ 820:1d06b4aed7cf

Revised code in the first pass. Added code to handle anonymous unions and structs. Hope the idea will work. Added type to class Aggregate and isAnonymous to some other Symbol classes.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Fri, 14 Mar 2008 15:42:08 +0100
parents bcb74c9b895c
children
line wrap: on
line diff
--- a/src/dil/semantic/Symbols.d	Thu Mar 13 18:59:54 2008 +0100
+++ b/src/dil/semantic/Symbols.d	Fri Mar 14 15:42:08 2008 +0100
@@ -48,6 +48,7 @@
 /// Aggregates have function and field members.
 abstract class Aggregate : ScopeSymbol
 {
+  Type type;
   Function[] funcs;
   Variable[] fields;
 
@@ -74,6 +75,7 @@
   this(Identifier* name, Node classNode)
   {
     super(SYM.Class, name, classNode);
+    this.type = new TypeClass(this);
   }
 }
 
@@ -83,24 +85,31 @@
   this(Identifier* name, Node interfaceNode)
   {
     super(SYM.Interface, name, interfaceNode);
+    this.type = new TypeClass(this);
+  }
+}
+
+/// A struct symbol.
+class Struct : Aggregate
+{
+  bool isAnonymous;
+  this(Identifier* name, Node structNode)
+  {
+    super(SYM.Struct, name, structNode);
+    this.type = new TypeStruct(this);
+    this.isAnonymous = name is null;
   }
 }
 
 /// A union symbol.
 class Union : Aggregate
 {
+  bool isAnonymous;
   this(Identifier* name, Node unionNode)
   {
     super(SYM.Union, name, unionNode);
-  }
-}
-
-/// A struct symbol.
-class Struct : Aggregate
-{
-  this(Identifier* name, Node structNode)
-  {
-    super(SYM.Struct, name, structNode);
+    this.type = new TypeStruct(this);
+    this.isAnonymous = name is null;
   }
 }
 
@@ -108,9 +117,12 @@
 class Enum : ScopeSymbol
 {
   TypeEnum type;
+  bool isAnonymous;
   this(Identifier* name, Node enumNode)
   {
     super(SYM.Enum, name, enumNode);
+    this.type = new TypeEnum(this);
+    this.isAnonymous = name is null;
   }
 
   void setType(TypeEnum type)