annotate dmd/ProtDeclaration.d @ 192:eb38fdcb3e62 default tip

updated to compile with dmd2.062
author korDen
date Sat, 02 Mar 2013 01:25:52 -0800
parents b0d41ff5e0df
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.ProtDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
114
e28b18c23469 added a module dmd.common for commonly used stuff
Trass3r
parents: 88
diff changeset
3 import dmd.common;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 import dmd.AttribDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5 import dmd.PROT;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
6 import dmd.OutBuffer;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 import dmd.HdrGenState;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 import dmd.Scope;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 import dmd.Dsymbol;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10 import dmd.Array;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
11
187
b0d41ff5e0df Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents: 178
diff changeset
12 import dmd.DDMDExtensions;
b0d41ff5e0df Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents: 178
diff changeset
13
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14 class ProtDeclaration : AttribDeclaration
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 {
187
b0d41ff5e0df Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents: 178
diff changeset
16 mixin insertMemberExtension!(typeof(this));
b0d41ff5e0df Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents: 178
diff changeset
17
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 PROT protection;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
20 this(PROT p, Dsymbols decl)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 {
178
e3afd1303184 Many small bugs fixed
korDen
parents: 114
diff changeset
22 register();
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23 super(decl);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
25 protection = p;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26 //printf("decl = %p\n", decl);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
27 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
28
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 49
diff changeset
29 override Dsymbol syntaxCopy(Dsymbol s)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
30 {
49
0aa7d1437ada AttribDeclaration.oneMember
korDen
parents: 0
diff changeset
31 ProtDeclaration pd;
0aa7d1437ada AttribDeclaration.oneMember
korDen
parents: 0
diff changeset
32
0aa7d1437ada AttribDeclaration.oneMember
korDen
parents: 0
diff changeset
33 assert(!s);
0aa7d1437ada AttribDeclaration.oneMember
korDen
parents: 0
diff changeset
34 pd = new ProtDeclaration(protection, Dsymbol.arraySyntaxCopy(decl));
0aa7d1437ada AttribDeclaration.oneMember
korDen
parents: 0
diff changeset
35 return pd;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
36 }
79
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
37
86
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
38 override void importAll(Scope sc)
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
39 {
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
40 Scope newsc = sc;
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
41 if (sc.protection != protection || sc.explicitProtection != 1)
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
42 {
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
43 // create new one for changes
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
44 newsc = sc.clone();
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
45 newsc.flags &= ~SCOPE.SCOPEfree;
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
46 newsc.protection = protection;
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
47 newsc.explicitProtection = 1;
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
48 }
79
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
49
86
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
50 foreach (Dsymbol s; decl)
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
51 s.importAll(newsc);
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
52
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
53 if (newsc !is sc)
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
54 newsc.pop();
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
55 }
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
56
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 49
diff changeset
57 override void setScope(Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
59 if (decl)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
60 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
61 setScopeNewSc(sc, sc.stc, sc.linkage, protection, 1, sc.structalign);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
62 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
63 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
64
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 49
diff changeset
65 override void semantic(Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
66 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
67 if (decl)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
68 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
69 semanticNewSc(sc, sc.stc, sc.linkage, protection, 1, sc.structalign);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
70 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
71 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
72
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 49
diff changeset
73 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
74 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
75 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
76 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
77
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
78 static void protectionToCBuffer(OutBuffer buf, PROT protection)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
79 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
80 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
81 }
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 49
diff changeset
82 }