Mercurial > projects > dil
comparison trunk/src/dil/semantic/Pass1.d @ 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 | e8c09d13f2a5 |
children | d33895f679eb |
comparison
equal
deleted
inserted
replaced
689:8e38774d562b | 690:eaf6444b6284 |
---|---|
9 dil.ast.Declarations, | 9 dil.ast.Declarations, |
10 dil.ast.Expressions, | 10 dil.ast.Expressions, |
11 dil.ast.Statements, | 11 dil.ast.Statements, |
12 dil.ast.Types, | 12 dil.ast.Types, |
13 dil.ast.Parameters; | 13 dil.ast.Parameters; |
14 import dil.lexer.Identifier; | 14 import dil.lexer.IdTable; |
15 import dil.semantic.Symbol, | 15 import dil.semantic.Symbol, |
16 dil.semantic.Symbols, | 16 dil.semantic.Symbols, |
17 dil.semantic.Types, | 17 dil.semantic.Types, |
18 dil.semantic.Scope, | 18 dil.semantic.Scope, |
19 dil.semantic.Module, | 19 dil.semantic.Module, |
130 Protection protection; | 130 Protection protection; |
131 StorageClass storageClass; | 131 StorageClass storageClass; |
132 uint alignSize; | 132 uint alignSize; |
133 } | 133 } |
134 | 134 |
135 // List of mixin and static if declarations. | 135 // List of mixin, static if and pragma(msg,...) declarations. |
136 // Their analysis must be deferred because they entail | 136 // Their analysis must be deferred because they entail |
137 // evaluation of expressions. | 137 // evaluation of expressions. |
138 Deferred[] deferred; | 138 Deferred[] deferred; |
139 | 139 |
140 void addDeferred(Node node, ScopeSymbol symbol) | 140 void addDeferred(Node node) |
141 { | 141 { |
142 auto d = new Deferred; | 142 auto d = new Deferred; |
143 d.node = node; | 143 d.node = node; |
144 d.symbol = symbol; | 144 d.symbol = scop.symbol; |
145 d.linkageType = linkageType; | 145 d.linkageType = linkageType; |
146 d.protection = protection; | 146 d.protection = protection; |
147 d.storageClass = storageClass; | 147 d.storageClass = storageClass; |
148 d.alignSize = alignSize; | 148 d.alignSize = alignSize; |
149 deferred ~= d; | 149 deferred ~= d; |
318 D visit(DebugDeclaration) | 318 D visit(DebugDeclaration) |
319 { return null; } | 319 { return null; } |
320 D visit(VersionDeclaration) | 320 D visit(VersionDeclaration) |
321 { return null; } | 321 { return null; } |
322 | 322 |
323 D visit(StaticIfDeclaration d) | |
324 { | |
325 addDeferred(d, scop.symbol); | |
326 return d; | |
327 } | |
328 | |
329 D visit(MixinDeclaration d) | |
330 { | |
331 addDeferred(d, scop.symbol); | |
332 return d; | |
333 } | |
334 | |
335 D visit(StaticAssertDeclaration) | 323 D visit(StaticAssertDeclaration) |
336 { return null; } | 324 { return null; } |
337 | 325 |
338 D visit(TemplateDeclaration d) | 326 D visit(TemplateDeclaration d) |
339 { | 327 { |
388 visitD(d.decls); | 376 visitD(d.decls); |
389 alignSize = saved; // Restore. | 377 alignSize = saved; // Restore. |
390 return d; | 378 return d; |
391 } | 379 } |
392 | 380 |
381 D visit(StaticIfDeclaration d) | |
382 { | |
383 addDeferred(d); | |
384 return d; | |
385 } | |
386 | |
387 D visit(MixinDeclaration d) | |
388 { | |
389 addDeferred(d); | |
390 return d; | |
391 } | |
392 | |
393 D visit(PragmaDeclaration d) | 393 D visit(PragmaDeclaration d) |
394 { | 394 { |
395 pragmaSemantic(scop, d.begin, d.ident, d.args); | 395 if (d.ident is Ident.msg) |
396 visitD(d.decls); | 396 addDeferred(d); |
397 return d; | 397 else |
398 } | 398 { |
399 | 399 pragmaSemantic(scop, d.begin, d.ident, d.args); |
400 Statement visit(PragmaStatement s) | 400 visitD(d.decls); |
401 { | 401 } |
402 pragmaSemantic(scop, s.begin, s.ident, s.args); | 402 return d; |
403 visitS(s.pragmaBody); | |
404 return s; | |
405 } | 403 } |
406 } // override | 404 } // override |
407 } | 405 } |