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