Mercurial > projects > dil
diff trunk/src/dil/Declarations.d @ 490:47be6bfe39cd
Refactored code and added new modules.
Added ProtectionDeclaration and changed Parser to make use of it.
Moved class Location to its own module.
Moved some Lexer functions to new module LexerFuncs.
Moved Lexer.getLocation() to struct Token.
Added methods semantic() and error() to class Expression.
Added method error() to class Scope.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Tue, 04 Dec 2007 23:31:20 +0100 |
parents | a7291d3ee9d7 |
children | 9c208925a3d4 |
line wrap: on
line diff
--- a/trunk/src/dil/Declarations.d Mon Dec 03 22:44:27 2007 +0100 +++ b/trunk/src/dil/Declarations.d Tue Dec 04 23:31:20 2007 +0100 @@ -20,8 +20,8 @@ } // Members relevant to semantic phase. - StorageClass stc; - Protection prot; + StorageClass stc; /// The storage class of this declaration. + Protection prot; /// The protection attribute of this declaration. void semantic(Scope sc) { @@ -548,6 +548,38 @@ } } +class ProtectionDeclaration : AttributeDeclaration +{ + this(Protection prot, Declaration decls) + { + super(cast(TOK)0, decls); + mixin(set_kind); + super.prot = prot; + } + + void semantic(Scope scop) + { + /+ + void traverse(Node[] nodes) + { + foreach (node; nodes) + { + if (node.kind == NodeKind.ProtectionDeclaration) + break; + if (node.category == NodeCategory.Declaration) + { + auto decl = cast(Declaration)cast(void*)node; + decl.prot = this.prot; + if (node.children) + traverse(node.children); + } + } + } + traverse([this.decls]); + +/ + } +} + class ExternDeclaration : AttributeDeclaration { Linkage linkage;