Mercurial > projects > ddmd
annotate dmd/ProtDeclaration.d @ 137:09c858522d55
merge
author | Trass3r |
---|---|
date | Mon, 13 Sep 2010 23:29:00 +0200 |
parents | e28b18c23469 |
children | e3afd1303184 |
rev | line source |
---|---|
0 | 1 module dmd.ProtDeclaration; |
2 | |
114 | 3 import dmd.common; |
0 | 4 import dmd.AttribDeclaration; |
5 import dmd.PROT; | |
6 import dmd.OutBuffer; | |
7 import dmd.HdrGenState; | |
8 import dmd.Scope; | |
9 import dmd.Dsymbol; | |
10 import dmd.Array; | |
11 | |
12 class ProtDeclaration : AttribDeclaration | |
13 { | |
14 PROT protection; | |
15 | |
74
7e0d548de9e6
Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
72
diff
changeset
|
16 this(PROT p, Dsymbols decl) |
0 | 17 { |
18 super(decl); | |
19 | |
20 protection = p; | |
21 //printf("decl = %p\n", decl); | |
22 } | |
23 | |
72 | 24 override Dsymbol syntaxCopy(Dsymbol s) |
0 | 25 { |
49 | 26 ProtDeclaration pd; |
27 | |
28 assert(!s); | |
29 pd = new ProtDeclaration(protection, Dsymbol.arraySyntaxCopy(decl)); | |
30 return pd; | |
0 | 31 } |
79 | 32 |
86 | 33 override void importAll(Scope sc) |
34 { | |
35 Scope newsc = sc; | |
36 if (sc.protection != protection || sc.explicitProtection != 1) | |
37 { | |
38 // create new one for changes | |
39 newsc = sc.clone(); | |
40 newsc.flags &= ~SCOPE.SCOPEfree; | |
41 newsc.protection = protection; | |
42 newsc.explicitProtection = 1; | |
43 } | |
79 | 44 |
86 | 45 foreach (Dsymbol s; decl) |
46 s.importAll(newsc); | |
47 | |
48 if (newsc !is sc) | |
49 newsc.pop(); | |
50 } | |
51 | |
72 | 52 override void setScope(Scope sc) |
0 | 53 { |
54 if (decl) | |
55 { | |
56 setScopeNewSc(sc, sc.stc, sc.linkage, protection, 1, sc.structalign); | |
57 } | |
58 } | |
59 | |
72 | 60 override void semantic(Scope sc) |
0 | 61 { |
62 if (decl) | |
63 { | |
64 semanticNewSc(sc, sc.stc, sc.linkage, protection, 1, sc.structalign); | |
65 } | |
66 } | |
67 | |
72 | 68 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) |
0 | 69 { |
70 assert(false); | |
71 } | |
72 | |
73 static void protectionToCBuffer(OutBuffer buf, PROT protection) | |
74 { | |
75 assert(false); | |
76 } | |
72 | 77 } |