annotate dmd/ProtDeclaration.d @ 79:43073c7c7769

updated to 2.035 also implemented a few missing functions still crashes in Import.importAll though
author Trass3r
date Mon, 30 Aug 2010 03:57:51 +0200
parents 7e0d548de9e6
children 50ebb404ddd9 b17640f0e4e8
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
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
3 import dmd.AttribDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 import dmd.PROT;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5 import dmd.OutBuffer;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
6 import dmd.HdrGenState;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 import dmd.Scope;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 import dmd.Dsymbol;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 import dmd.Array;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
11 class ProtDeclaration : AttribDeclaration
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13 PROT protection;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
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
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 super(decl);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19 protection = p;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20 //printf("decl = %p\n", decl);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 49
diff changeset
23 override Dsymbol syntaxCopy(Dsymbol s)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24 {
49
0aa7d1437ada AttribDeclaration.oneMember
korDen
parents: 0
diff changeset
25 ProtDeclaration pd;
0aa7d1437ada AttribDeclaration.oneMember
korDen
parents: 0
diff changeset
26
0aa7d1437ada AttribDeclaration.oneMember
korDen
parents: 0
diff changeset
27 assert(!s);
0aa7d1437ada AttribDeclaration.oneMember
korDen
parents: 0
diff changeset
28 pd = new ProtDeclaration(protection, Dsymbol.arraySyntaxCopy(decl));
0aa7d1437ada AttribDeclaration.oneMember
korDen
parents: 0
diff changeset
29 return pd;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
30 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31
79
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
32 override void importAll(Scope sc)
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
33 {
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
34 Scope newsc = sc;
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
35 if (sc.protection != protection || sc.explicitProtection != 1)
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
36 {
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
37 // create new one for changes
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
38 newsc = new Scope(sc);
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
39 newsc.flags &= ~SCOPE.SCOPEfree;
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
40 newsc.protection = protection;
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
41 newsc.explicitProtection = 1;
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
42 }
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
43
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
44 foreach (Dsymbol s; decl)
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
45 s.importAll(newsc);
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
46
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
47 if (newsc !is sc)
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
48 newsc.pop();
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
49 }
43073c7c7769 updated to 2.035
Trass3r
parents: 74
diff changeset
50
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 49
diff changeset
51 override void setScope(Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
52 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
53 if (decl)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
54 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
55 setScopeNewSc(sc, sc.stc, sc.linkage, protection, 1, sc.structalign);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
56 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
57 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 49
diff changeset
59 override void semantic(Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
60 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
61 if (decl)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
62 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
63 semanticNewSc(sc, sc.stc, sc.linkage, protection, 1, sc.structalign);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
64 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
65 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
66
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 49
diff changeset
67 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
68 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
69 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
70 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
71
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
72 static void protectionToCBuffer(OutBuffer buf, PROT protection)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
73 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
74 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
75 }
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 49
diff changeset
76 }