changeset 572:751d84733e07

Added semantic() to UnionDeclaration.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sat, 29 Dec 2007 23:32:52 +0100
parents 35a8926253c8
children 87c4474a1295
files trunk/src/dil/Declarations.d trunk/src/dil/Symbols.d
diffstat 2 files changed, 19 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/trunk/src/dil/Declarations.d	Sat Dec 29 23:26:25 2007 +0100
+++ b/trunk/src/dil/Declarations.d	Sat Dec 29 23:32:52 2007 +0100
@@ -349,6 +349,20 @@
     addOptChild(tparams);
     addOptChild(decls);
   }
+
+  Union union_; /// The struct symbol for this declaration.
+
+  override void semantic(Scope scop)
+  {
+    if (union_)
+      return;
+    union_ = new Union(name, this);
+    // Create a new scope.
+    scop = scop.push(union_);
+    // Continue semantic analysis.
+    decls && decls.semantic(scop);
+    scop.pop();
+  }
 }
 
 class ConstructorDeclaration : Declaration
--- a/trunk/src/dil/Symbols.d	Sat Dec 29 23:26:25 2007 +0100
+++ b/trunk/src/dil/Symbols.d	Sat Dec 29 23:32:52 2007 +0100
@@ -63,19 +63,21 @@
 
 class Interface : Aggregate
 {
-  this(Identifier* ident, Node interfNode)
+  this(Identifier* ident, Node interfaceNode)
   {
     this.sid = SYM.Interface;
     this.ident = ident;
-    this.node = interfNode;
+    this.node = interfaceNode;
   }
 }
 
 class Union : Aggregate
 {
-  this()
+  this(Identifier* ident, Node unionNode)
   {
     this.sid = SYM.Union;
+    this.ident = ident;
+    this.node = unionNode;
   }
 }