# HG changeset patch # User Aziz K?ksal # Date 1200392575 -3600 # Node ID eb490ba8dba0a107c09726c34144ae46b1e4f340 # Parent 3ebe76ad680eca7f4f945d80d54b6371fa3bb483 Made AttributeDeclaration abstract. diff -r 3ebe76ad680e -r eb490ba8dba0 trunk/src/dil/ast/Declarations.d --- 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; diff -r 3ebe76ad680e -r eb490ba8dba0 trunk/src/dil/ast/NodesEnum.d --- 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", diff -r 3ebe76ad680e -r eb490ba8dba0 trunk/src/dil/parser/Parser.d --- 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);