changeset 650:eb490ba8dba0

Made AttributeDeclaration abstract.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Tue, 15 Jan 2008 11:22:55 +0100
parents 3ebe76ad680e
children 2a690956cf1c
files trunk/src/dil/ast/Declarations.d trunk/src/dil/ast/NodesEnum.d trunk/src/dil/parser/Parser.d
diffstat 3 files changed, 11 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/trunk/src/dil/ast/Declarations.d	Tue Jan 15 11:11:03 2008 +0100
+++ b/trunk/src/dil/ast/Declarations.d	Tue Jan 15 11:22:55 2008 +0100
@@ -568,17 +568,13 @@
   }
 }
 
-class AttributeDeclaration : Declaration
+abstract class AttributeDeclaration : Declaration
 {
-  TOK attribute;
   Declaration decls;
-  this(TOK attribute, Declaration decls)
+  this(Declaration decls)
   {
     super.hasBody = true;
-    mixin(set_kind);
     addChild(decls);
-
-    this.attribute = attribute;
     this.decls = decls;
   }
 }
@@ -588,7 +584,7 @@
   Protection prot;
   this(Protection prot, Declaration decls)
   {
-    super(cast(TOK)0, decls);
+    super(decls);
     mixin(set_kind);
     this.prot = prot;
   }
@@ -597,9 +593,9 @@
 class StorageClassDeclaration : AttributeDeclaration
 {
   StorageClass storageClass;
-  this(StorageClass storageClass, TOK tok, Declaration decl)
+  this(StorageClass storageClass, Declaration decl)
   {
-    super(tok, decl);
+    super(decl);
     mixin(set_kind);
 
     this.storageClass = storageClass;
@@ -611,7 +607,7 @@
   LinkageType linkageType;
   this(LinkageType linkageType, Declaration decls)
   {
-    super(TOK.Extern, decls);
+    super(decls);
     mixin(set_kind);
 
     this.linkageType = linkageType;
@@ -623,7 +619,7 @@
   int size;
   this(int size, Declaration decls)
   {
-    super(TOK.Align, decls);
+    super(decls);
     mixin(set_kind);
     this.size = size;
   }
@@ -636,7 +632,7 @@
   this(Identifier* ident, Expression[] args, Declaration decls)
   {
     addOptChildren(args); // Add args before calling super().
-    super(TOK.Pragma, decls);
+    super(decls);
     mixin(set_kind);
 
     this.ident = ident;
--- a/trunk/src/dil/ast/NodesEnum.d	Tue Jan 15 11:11:03 2008 +0100
+++ b/trunk/src/dil/ast/NodesEnum.d	Tue Jan 15 11:22:55 2008 +0100
@@ -43,7 +43,6 @@
   "TemplateDeclaration",
   "NewDeclaration",
   "DeleteDeclaration",
-  "AttributeDeclaration",
   "ProtectionDeclaration",
   "StorageClassDeclaration",
   "LinkageDeclaration",
--- a/trunk/src/dil/parser/Parser.d	Tue Jan 15 11:11:03 2008 +0100
+++ b/trunk/src/dil/parser/Parser.d	Tue Jan 15 11:22:55 2008 +0100
@@ -829,9 +829,8 @@
         else
           stc |= stc_tmp;
 
-        auto tok = token.type;
         nT();
-        decl = new StorageClassDeclaration(stc_tmp, tok, parse());
+        decl = new StorageClassDeclaration(stc_tmp, parse());
         set(decl, begin);
         break;
       case T.Identifier:
@@ -1786,9 +1785,8 @@
         else
           stc |= stc_tmp;
 
-        auto tok = token.type;
         nT();
-        d = new StorageClassDeclaration(stc_tmp, tok, parse());
+        d = new StorageClassDeclaration(stc_tmp, parse());
         break;
       // TODO: allow "scope class", "abstract scope class" in function bodies?
       //case T.Class:
@@ -1822,7 +1820,7 @@
       auto init = parseExpression();
       auto v = new VariableDeclaration(null, [ident], [init]);
       set(v, begin.nextNWS);
-      auto d = new StorageClassDeclaration(StorageClass.Auto, T.Auto, v);
+      auto d = new StorageClassDeclaration(StorageClass.Auto, v);
       set(d, begin);
       variable = new DeclarationStatement(d);
       set(variable, begin);