# HG changeset patch # User Aziz K?ksal # Date 1201012827 -3600 # Node ID eaf6444b6284d5bc6c33a2557e6ee5b7a90d7318 # Parent 8e38774d562b085e21779e825a520fbdc31942b3 Adding pragma(msg,...) declarations to deferred list. diff -r 8e38774d562b -r eaf6444b6284 trunk/src/dil/semantic/Pass1.d --- 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 }