Mercurial > projects > dil
changeset 149:37e2e0d06013
- Removed ProtectionDeclaration.
- Using a general class AttributeDeclaration for all attributes.
author | aziz |
---|---|
date | Thu, 12 Jul 2007 14:55:00 +0000 |
parents | e3e4d3314166 |
children | 753bc07bf3a0 |
files | trunk/src/Declarations.d trunk/src/Parser.d |
diffstat | 2 files changed, 30 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/trunk/src/Declarations.d Thu Jul 12 14:31:02 2007 +0000 +++ b/trunk/src/Declarations.d Thu Jul 12 14:55:00 2007 +0000 @@ -305,52 +305,46 @@ } } -class ExternDeclaration : Declaration +class AttributeDeclaration : Declaration { - string linkage; + TOK attribute; Declaration[] decls; - this(string linkage, Declaration[] decls) + this(TOK attribute, Declaration[] decls) { super(true); - this.linkage = linkage; - this.decls = decls; - } -} - -class AlignDeclaration : Declaration -{ - int size; - Declaration[] decls; - this(int size, Declaration[] decls) - { - super(true); - this.size = size; + this.attribute = attribute; this.decls = decls; } } -class PragmaDeclaration : Declaration +class ExternDeclaration : AttributeDeclaration +{ + string linkage; + this(string linkage, Declaration[] decls) + { + super(TOK.Extern, decls); + this.linkage = linkage; + } +} + +class AlignDeclaration : AttributeDeclaration +{ + int size; + this(int size, Declaration[] decls) + { + super(TOK.Align, decls); + this.size = size; + } +} + +class PragmaDeclaration : AttributeDeclaration { string ident; Expression[] args; - Declaration[] decls; this(string ident, Expression[] args, Declaration[] decls) { - super(true); + super(TOK.Pragma, decls); this.ident = ident; this.args = args; - this.decls = decls; } } - -class ProtectionDeclaration : Declaration -{ - TOK protection; - Declaration[] decls; - this(TOK protection, Declaration[] decls) - { - super(true); - this.protection = protection; - this.decls = decls; - } -}
--- a/trunk/src/Parser.d Thu Jul 12 14:31:02 2007 +0000 +++ b/trunk/src/Parser.d Thu Jul 12 14:55:00 2007 +0000 @@ -292,13 +292,13 @@ decl = new PragmaDeclaration(ident, args, decls); break; + // Protection attributes case T.Private: case T.Package: case T.Protected: case T.Public: case T.Export: - decl = new ProtectionDeclaration(token.type, parseDeclarationsBlock()); - break; + // StorageClass attributes case T.Override: case T.Deprecated: case T.Abstract: @@ -307,6 +307,8 @@ case T.Const: case T.Auto: case T.Scope: + decl = new AttributeDeclaration(token.type, parseDeclarationsBlock()); + break; default: assert(0); }