changeset 565:184a8d8bad2e

Added semantic() to StructDeclaration.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Fri, 28 Dec 2007 23:22:33 +0100
parents 3c867a683258
children 84fde575a2fe
files trunk/src/dil/Declarations.d trunk/src/dil/Scope.d trunk/src/dil/Symbols.d
diffstat 3 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/trunk/src/dil/Declarations.d	Fri Dec 28 22:32:32 2007 +0100
+++ b/trunk/src/dil/Declarations.d	Fri Dec 28 23:22:33 2007 +0100
@@ -313,6 +313,20 @@
   {
     this.alignSize = alignSize;
   }
+
+  Struct struct_; /// The struct symbol for this declaration.
+
+  override void semantic(Scope scop)
+  {
+    if (struct_)
+      return;
+    struct_ = new Struct(name);
+    // Create a new scope.
+    scop = scop.push(struct_);
+    // Continue semantic analysis.
+    decls.semantic(scop);
+    scop.pop();
+  }
 }
 
 class UnionDeclaration : Declaration
--- a/trunk/src/dil/Scope.d	Fri Dec 28 22:32:32 2007 +0100
+++ b/trunk/src/dil/Scope.d	Fri Dec 28 23:22:33 2007 +0100
@@ -51,11 +51,12 @@
   /++
     Create a new inner scope.
   +/
-  Scope push()
+  Scope push(ScopeSymbol symbol)
   {
     auto sc = new Scope();
     sc.parent = this;
     sc.infoMan = this.infoMan;
+    sc.symbol = symbol;
     return sc;
   }
 
--- a/trunk/src/dil/Symbols.d	Fri Dec 28 22:32:32 2007 +0100
+++ b/trunk/src/dil/Symbols.d	Fri Dec 28 23:22:33 2007 +0100
@@ -78,7 +78,8 @@
 
 class Struct : Aggregate
 {
-  this()
+  Identifier* ident;
+  this(Identifier* ident)
   {
     this.sid = SYM.Struct;
   }