annotate dmd/ScopeDsymbol.d @ 178:e3afd1303184

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