annotate dmd/ScopeDsymbol.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 43073c7c7769
children 60bb0fe4563e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.ScopeDsymbol;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
114
e28b18c23469 added a module dmd.common for commonly used stuff
Trass3r
parents: 79
diff changeset
3 import dmd.common;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 import dmd.Dsymbol;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5 import dmd.Declaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
6 import dmd.Array;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 import dmd.OverloadSet;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 import dmd.Import;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 import dmd.DsymbolTable;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10 import dmd.Identifier;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
11 import dmd.Loc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 import dmd.PROT;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13 import dmd.FuncDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14 import dmd.Scope;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 import dmd.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 import dmd.Id;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 import dmd.expression.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18
79
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
19 import std.stdio : writef;
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
20 //core.stdc.stdlib;
4
d706d958e4e8 Step 2 of restoring GC functionality.
korDen
parents: 2
diff changeset
21 import core.memory;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23 class ScopeDsymbol : Dsymbol
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24 {
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
25 Dsymbols members; // all Dsymbol's in this scope
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26 DsymbolTable symtab; // members[] sorted into table
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
27
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
28 Array imports; // imported ScopeDsymbol's
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
29 PROT* prots; // array of PROT, one for each import
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
30
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31 this()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
33 // do nothing
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
34 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
35
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
36 this(Identifier id)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
37 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
38 super(id);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
39 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
40
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 20
diff changeset
41 override Dsymbol syntaxCopy(Dsymbol s)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
42 {
20
1628b221808d Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents: 4
diff changeset
43 //printf("ScopeDsymbol.syntaxCopy('%s')\n", toChars());
1628b221808d Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents: 4
diff changeset
44
1628b221808d Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents: 4
diff changeset
45 ScopeDsymbol sd;
1628b221808d Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents: 4
diff changeset
46 if (s)
1628b221808d Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents: 4
diff changeset
47 sd = cast(ScopeDsymbol)s;
1628b221808d Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents: 4
diff changeset
48 else
1628b221808d Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents: 4
diff changeset
49 sd = new ScopeDsymbol(ident);
1628b221808d Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents: 4
diff changeset
50 sd.members = arraySyntaxCopy(members);
1628b221808d Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents: 4
diff changeset
51 return sd;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
52 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
53
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 20
diff changeset
54 override Dsymbol search(Loc loc, Identifier ident, int flags)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
55 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
56 //printf("%s.ScopeDsymbol.search(ident='%s', flags=x%x)\n", toChars(), ident.toChars(), flags);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
57 //if (strcmp(ident.toChars(),"c") == 0) *(char*)0=0;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
59 // Look in symbols declared in this module
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
60 Dsymbol s = symtab ? symtab.lookup(ident) : null;
79
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
61 // writef("\ts = %p, imports = %p, %d\n", s, imports, imports ? imports->dim : 0);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
62 if (s)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
63 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
64 //printf("\ts = '%s.%s'\n",toChars(),s.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
65 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
66 else if (imports)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
67 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
68 OverloadSet a = null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
69
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
70 // Look in imported modules
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
71 for (int i = 0; i < imports.dim; i++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
72 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
73 ScopeDsymbol ss = cast(ScopeDsymbol)imports.data[i];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
74 Dsymbol s2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
75
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
76 // If private import, don't search it
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
77 if (flags & 1 && prots[i] == PROT.PROTprivate)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
78 continue;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
79
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
80 //printf("\tscanning import '%s', prots = %d, isModule = %p, isImport = %p\n", ss.toChars(), prots[i], ss.isModule(), ss.isImport());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
81 /* Don't find private members if ss is a module
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
82 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
83 s2 = ss.search(loc, ident, ss.isModule() ? 1 : 0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
84 if (!s)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
85 s = s2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
86 else if (s2 && s != s2)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
87 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
88 if (s.toAlias() == s2.toAlias())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
89 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
90 /* After following aliases, we found the same symbol,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
91 * so it's not an ambiguity.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
92 * But if one alias is deprecated, prefer the other.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
93 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
94 if (s.isDeprecated())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
95 s = s2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
96 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
97 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
98 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
99 /* Two imports of the same module should be regarded as
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
100 * the same.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
101 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
102 Import i1 = s.isImport();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
103 Import i2 = s2.isImport();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
104 if (!(i1 && i2 &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
105 (i1.mod == i2.mod ||
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
106 (!i1.parent.isImport() && !i2.parent.isImport() &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
107 i1.ident.equals(i2.ident))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
108 )
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
109 )
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
110 )
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
111 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
112 /* If both s2 and s are overloadable (though we only
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
113 * need to check s once)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
114 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
115 if (s2.isOverloadable() && (a || s.isOverloadable()))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
116 { if (!a)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
117 a = new OverloadSet();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
118 /* Don't add to a[] if s2 is alias of previous sym
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
119 */
77
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
120 foreach (size_t j, Dsymbol s3; a.a)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
121 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
122 if (s2.toAlias() == s3.toAlias())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
123 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
124 if (s3.isDeprecated())
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
125 a.a[j] = s2;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
126 goto Lcontinue;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
127 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
128 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
129 a.push(s2);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
130 Lcontinue:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
131 continue;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
132 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
133 if (flags & 4) // if return null on ambiguity
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
134 return null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
135 if (!(flags & 2))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
136 ss.multiplyDefined(loc, s, s2);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
137 break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
138 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
139 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
140 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
141 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
142
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
143 /* Build special symbol if we had multiple finds
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
144 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
145 if (a)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
146 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
147 assert(s);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
148 a.push(s);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
149 s = a;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
150 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
151
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
152 if (s)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
153 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
154 Declaration d = s.isDeclaration();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
155 if (d && d.protection == PROT.PROTprivate && !d.parent.isTemplateMixin() && !(flags & 2))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
156 error("%s is private", d.toPrettyChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
157 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
158 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
159 return s;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
160 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
161
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
162 void importScope(ScopeDsymbol s, PROT protection)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
163 {
79
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
164 //writef("%s.ScopeDsymbol.importScope(%s, %d)\n", toChars(), s.toChars(), protection);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
165
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
166 // No circular or redundant import's
79
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
167 if (s !is this)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
168 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
169 if (!imports)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
170 imports = new Array();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
171 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
172 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
173 for (int i = 0; i < imports.dim; i++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
174 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
175 ScopeDsymbol ss = cast(ScopeDsymbol)imports.data[i];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
176 if (ss is s) // if already imported
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
177 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
178 if (protection > prots[i])
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
179 prots[i] = protection; // upgrade access
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
180 return;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
181 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
182 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
183 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
184 imports.push(cast(void*)s);
2
7427ded8caf7 Removed unreferenced modules
korDen
parents: 0
diff changeset
185 prots = cast(PROT*)GC.realloc(prots, imports.dim * prots[0].sizeof);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
186 prots[imports.dim - 1] = protection;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
187 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
188 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
189
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 20
diff changeset
190 override int isforwardRef()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
191 {
79
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
192 return (members is null);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
193 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
194
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 20
diff changeset
195 override void defineRef(Dsymbol s)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
196 {
79
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
197 ScopeDsymbol ss = s.isScopeDsymbol();
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
198 members = ss.members;
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
199 ss.members = null;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
200 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
201
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
202 static void multiplyDefined(Loc loc, Dsymbol s1, Dsymbol s2)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
203 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
204 static if (false) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
205 printf("ScopeDsymbol::multiplyDefined()\n");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
206 printf("s1 = %p, '%s' kind = '%s', parent = %s\n", s1, s1.toChars(), s1.kind(), s1.parent ? s1.parent.toChars() : "");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
207 printf("s2 = %p, '%s' kind = '%s', parent = %s\n", s2, s2.toChars(), s2.kind(), s2.parent ? s2.parent.toChars() : "");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
208 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
209 if (loc.filename)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
210 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
211 .error(loc, "%s at %s conflicts with %s at %s",
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
212 s1.toPrettyChars(),
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
213 s1.locToChars(),
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
214 s2.toPrettyChars(),
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
215 s2.locToChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
216 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
217 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
218 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
219 s1.error(loc, "conflicts with %s %s at %s", s2.kind(), s2.toPrettyChars(), s2.locToChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
220 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
221 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
222
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
223 Dsymbol nameCollision(Dsymbol s)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
224 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
225 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
226 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
227
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 20
diff changeset
228 override string kind()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
229 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
230 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
231 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
232
79
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
233 version(DMDV2)
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
234 {
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
235 /*******************************************
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
236 * Look for member of the form:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
237 * const(MemberInfo)[] getMembers(string);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
238 * Returns NULL if not found
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
239 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
240 FuncDeclaration findGetMembers()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
241 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
242 Dsymbol s = search_function(this, Id.getmembers);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
243 FuncDeclaration fdx = s ? s.isFuncDeclaration() : null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
244
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
245 static if (false) { // Finish
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
246 static __gshared TypeFunction tfgetmembers;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
247
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
248 if (!tfgetmembers)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
249 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
250 Scope sc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
251 Arguments arguments = new Arguments();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
252 Arguments arg = new Argument(STCin, Type.tchar.constOf().arrayOf(), null, null);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
253 arguments.push(arg);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
254
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
255 Type tret = null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
256 tfgetmembers = new TypeFunction(arguments, tret, 0, LINK.LINKd);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
257 tfgetmembers = cast(TypeFunction)tfgetmembers.semantic(0, &sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
258 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
259 if (fdx)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
260 fdx = fdx.overloadExactMatch(tfgetmembers);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
261 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
262 if (fdx && fdx.isVirtual()) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
263 fdx = null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
264 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
265
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
266 return fdx;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
267 }
79
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
268 }
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
269
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
270 Dsymbol symtabInsert(Dsymbol s)
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
271 {
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
272 return symtab.insert(s);
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
273 }
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
274
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
275 void emitMemberComments(Scope sc)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
276 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
277 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
278 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
279
79
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
280 version(DMDV2)
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
281 {
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
282 static size_t dim(Dsymbols members)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
283 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
284 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
285 }
79
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
286
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
287
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
288 static Dsymbol getNth(Dsymbols members, size_t nth, size_t* pn = null)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
289 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
290 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
291 }
79
43073c7c7769 updated to 2.035
Trass3r
parents: 77
diff changeset
292 }
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 20
diff changeset
293 override ScopeDsymbol isScopeDsymbol() { return this; }
20
1628b221808d Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents: 4
diff changeset
294 }