annotate dmd/ScopeDsymbol.d @ 77:ad4792a1cfd6

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