Mercurial > projects > ddmd
annotate dmd/StaticIfDeclaration.d @ 72:2e2a5c3f943a
reduced warnings by adding override to the methods
think this also normalizes different line endings used all over the place
author | Trass3r |
---|---|
date | Sat, 28 Aug 2010 16:19:48 +0200 |
parents | 460959608115 |
children | 7e0d548de9e6 |
rev | line source |
---|---|
0 | 1 module dmd.StaticIfDeclaration; |
2 | |
3 import dmd.ConditionalDeclaration; | |
4 import dmd.ScopeDsymbol; | |
5 import dmd.AttribDeclaration; | |
6 import dmd.Scope; | |
7 import dmd.Condition; | |
8 import dmd.Array; | |
9 import dmd.Dsymbol; | |
10 | |
11 class StaticIfDeclaration : ConditionalDeclaration | |
12 { | |
13 ScopeDsymbol sd; | |
14 int addisdone; | |
15 | |
16 this(Condition condition, Array decl, Array elsedecl) | |
17 { | |
18 super(condition, decl, elsedecl); | |
19 //printf("StaticIfDeclaration::StaticIfDeclaration()\n"); | |
20 } | |
21 | |
72 | 22 override Dsymbol syntaxCopy(Dsymbol s) |
0 | 23 { |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
24 StaticIfDeclaration dd; |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
25 |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
26 assert(!s); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
27 dd = new StaticIfDeclaration(condition.syntaxCopy(), |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
28 Dsymbol.arraySyntaxCopy(decl), |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
29 Dsymbol.arraySyntaxCopy(elsedecl)); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
30 return dd; |
0 | 31 } |
32 | |
72 | 33 override bool addMember(Scope sc, ScopeDsymbol sd, bool memnum) |
0 | 34 { |
35 //printf("StaticIfDeclaration.addMember() '%s'\n",toChars()); | |
36 /* This is deferred until semantic(), so that | |
37 * expressions in the condition can refer to declarations | |
38 * in the same scope, such as: | |
39 * | |
40 * template Foo(int i) | |
41 * { | |
42 * const int j = i + 1; | |
43 * static if (j == 3) | |
44 * const int k; | |
45 * } | |
46 */ | |
47 this.sd = sd; | |
48 bool m = false; | |
49 | |
13 | 50 if (!memnum) |
0 | 51 { |
52 m = AttribDeclaration.addMember(sc, sd, memnum); | |
53 addisdone = 1; | |
54 } | |
55 return m; | |
56 } | |
57 | |
72 | 58 override void semantic(Scope sc) |
0 | 59 { |
60 Array d = include(sc, sd); | |
61 | |
62 //printf("\tStaticIfDeclaration.semantic '%s', d = %p\n",toChars(), d); | |
63 if (d) | |
64 { | |
65 if (!addisdone) | |
66 { | |
13 | 67 AttribDeclaration.addMember(sc, sd, true); |
0 | 68 addisdone = 1; |
69 } | |
70 | |
71 for (uint i = 0; i < d.dim; i++) | |
72 { | |
73 Dsymbol s = cast(Dsymbol)d.data[i]; | |
74 | |
75 s.semantic(sc); | |
76 } | |
77 } | |
78 } | |
79 | |
72 | 80 override string kind() |
0 | 81 { |
82 assert(false); | |
83 } | |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
84 } |