Mercurial > projects > dil
changeset 690:eaf6444b6284
Adding pragma(msg,...) declarations to deferred list.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Tue, 22 Jan 2008 15:40:27 +0100 |
parents | 8e38774d562b |
children | 276e2866f5fd |
files | trunk/src/dil/semantic/Pass1.d |
diffstat | 1 files changed, 21 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/trunk/src/dil/semantic/Pass1.d Tue Jan 22 14:59:12 2008 +0100 +++ b/trunk/src/dil/semantic/Pass1.d Tue Jan 22 15:40:27 2008 +0100 @@ -11,7 +11,7 @@ dil.ast.Statements, dil.ast.Types, dil.ast.Parameters; -import dil.lexer.Identifier; +import dil.lexer.IdTable; import dil.semantic.Symbol, dil.semantic.Symbols, dil.semantic.Types, @@ -132,16 +132,16 @@ uint alignSize; } - // List of mixin and static if declarations. + // List of mixin, static if and pragma(msg,...) declarations. // Their analysis must be deferred because they entail // evaluation of expressions. Deferred[] deferred; - void addDeferred(Node node, ScopeSymbol symbol) + void addDeferred(Node node) { auto d = new Deferred; d.node = node; - d.symbol = symbol; + d.symbol = scop.symbol; d.linkageType = linkageType; d.protection = protection; d.storageClass = storageClass; @@ -320,18 +320,6 @@ D visit(VersionDeclaration) { return null; } - D visit(StaticIfDeclaration d) - { - addDeferred(d, scop.symbol); - return d; - } - - D visit(MixinDeclaration d) - { - addDeferred(d, scop.symbol); - return d; - } - D visit(StaticAssertDeclaration) { return null; } @@ -390,18 +378,28 @@ return d; } - D visit(PragmaDeclaration d) + D visit(StaticIfDeclaration d) { - pragmaSemantic(scop, d.begin, d.ident, d.args); - visitD(d.decls); + addDeferred(d); + return d; + } + + D visit(MixinDeclaration d) + { + addDeferred(d); return d; } - Statement visit(PragmaStatement s) + D visit(PragmaDeclaration d) { - pragmaSemantic(scop, s.begin, s.ident, s.args); - visitS(s.pragmaBody); - return s; + if (d.ident is Ident.msg) + addDeferred(d); + else + { + pragmaSemantic(scop, d.begin, d.ident, d.args); + visitD(d.decls); + } + return d; } } // override }