annotate dmd/ProtDeclaration.d @ 114:e28b18c23469

added a module dmd.common for commonly used stuff it currently holds code for consistency checking of predefined versions also added a VisualD project file
author Trass3r
date Wed, 01 Sep 2010 18:21:58 +0200
parents 23280d154c5b
children e3afd1303184
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
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 class ProtDeclaration : AttribDeclaration
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14 PROT protection;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
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
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 super(decl);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20 protection = p;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 //printf("decl = %p\n", decl);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 49
diff changeset
24 override Dsymbol syntaxCopy(Dsymbol s)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
25 {
49
0aa7d1437ada AttribDeclaration.oneMember
korDen
parents: 0
diff changeset
26 ProtDeclaration pd;
0aa7d1437ada AttribDeclaration.oneMember
korDen
parents: 0
diff changeset
27
0aa7d1437ada AttribDeclaration.oneMember
korDen
parents: 0
diff changeset
28 assert(!s);
0aa7d1437ada AttribDeclaration.oneMember
korDen
parents: 0
diff changeset
29 pd = new ProtDeclaration(protection, Dsymbol.arraySyntaxCopy(decl));
0aa7d1437ada AttribDeclaration.oneMember
korDen
parents: 0
diff changeset
30 return pd;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31 }
79
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
32
86
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
33 override void importAll(Scope sc)
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
34 {
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
35 Scope newsc = sc;
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
36 if (sc.protection != protection || sc.explicitProtection != 1)
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
37 {
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
38 // create new one for changes
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
39 newsc = sc.clone();
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
40 newsc.flags &= ~SCOPE.SCOPEfree;
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
41 newsc.protection = protection;
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
42 newsc.explicitProtection = 1;
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
43 }
79
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
44
86
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
45 foreach (Dsymbol s; decl)
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
46 s.importAll(newsc);
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
47
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
48 if (newsc !is sc)
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
49 newsc.pop();
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
50 }
50ebb404ddd9 fixed Ticket 1
Trass3r
parents: 79
diff changeset
51
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 49
diff changeset
52 override void setScope(Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
53 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
54 if (decl)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
55 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
56 setScopeNewSc(sc, sc.stc, sc.linkage, protection, 1, sc.structalign);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
57 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
59
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 49
diff changeset
60 override void semantic(Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
61 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
62 if (decl)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
63 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
64 semanticNewSc(sc, sc.stc, sc.linkage, protection, 1, sc.structalign);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
65 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
66 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
67
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 49
diff changeset
68 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
69 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
70 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
71 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
72
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
73 static void protectionToCBuffer(OutBuffer buf, PROT protection)
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 }
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 49
diff changeset
77 }