annotate dmd/InterfaceDeclaration.d @ 0:10317f0c89a5

Initial commit
author korDen
date Sat, 24 Oct 2009 08:42:06 +0400
parents
children 427f8aa74d28 fd4acc376c45
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.InterfaceDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
3 import dmd.ClassDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 import dmd.Loc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5 import dmd.DsymbolTable;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
6 import dmd.STC;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 import dmd.Type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 import dmd.TY;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 import dmd.LINK;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10 import dmd.Argument;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
11 import dmd.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 import dmd.TypeTuple;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13 import dmd.PROT;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14 import dmd.TypeClass;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 import dmd.Identifier;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 import dmd.ArrayTypes;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 import dmd.Dsymbol;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 import dmd.Scope;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19 import dmd.Global;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20 import dmd.BaseClass;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 import dmd.Id;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23 import dmd.backend.Symbol;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24 import dmd.backend.TYM;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
25 import dmd.backend.dt_t;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26 import dmd.backend.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
27 import dmd.codegen.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
28 import dmd.backend.SC;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
29 import dmd.backend.FL;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
30 import dmd.backend.LIST;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31 import dmd.backend.SFL;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
33 class InterfaceDeclaration : ClassDeclaration
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
34 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
35 version (DMDV2) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
36 bool cpp; // true if this is a C++ interface
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
37 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
38 this(Loc loc, Identifier id, BaseClasses baseclasses)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
39 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
40 super(loc, id, baseclasses);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
41
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
42 if (id is Id.IUnknown) // IUnknown is the root of all COM interfaces
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
43 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
44 com = true;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
45 cpp = true; // IUnknown is also a C++ interface
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
46 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
47 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
48
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
49 Dsymbol syntaxCopy(Dsymbol s)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
50 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
51 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
52 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
53
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
54 void semantic(Scope sc)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
55 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
56 int i;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
57
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58 //printf("InterfaceDeclaration.semantic(%s), type = %p\n", toChars(), type);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
59 if (inuse)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
60 return;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
61
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
62 if (!sc)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
63 sc = scope_;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
64 if (!parent && sc.parent && !sc.parent.isModule())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
65 parent = sc.parent;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
66
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
67 type = type.semantic(loc, sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
68 handle = type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
69
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
70 if (!members) // if forward reference
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
71 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
72 //printf("\tinterface '%s' is forward referenced\n", toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
73 return;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
74 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
75 if (symtab) // if already done
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
76 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
77 if (!scope_)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
78 return;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
79 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
80 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
81 symtab = new DsymbolTable();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
82
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
83 Scope scx = null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
84 if (scope_)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
85 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
86 sc = scope_;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
87 scx = scope_; // save so we don't make redundant copies
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
88 scope_ = null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
89 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
90
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
91 if (sc.stc & STC.STCdeprecated)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
92 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
93 isdeprecated = true;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
94 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
95
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
96 // Expand any tuples in baseclasses[]
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
97 for (i = 0; i < baseclasses.dim; )
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
98 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
99 BaseClass b = cast(BaseClass)baseclasses.data[0];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
100 b.type = b.type.semantic(loc, sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
101 Type tb = b.type.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
102
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
103 if (tb.ty == TY.Ttuple)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
104 { TypeTuple tup = cast(TypeTuple)tb;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
105 PROT protection = b.protection;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
106 baseclasses.remove(i);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
107 size_t dim = Argument.dim(tup.arguments);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
108 for (size_t j = 0; j < dim; j++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
109 { Argument arg = Argument.getNth(tup.arguments, j);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
110 b = new BaseClass(arg.type, protection);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
111 baseclasses.insert(i + j, cast(void*)b);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
112 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
113 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
114 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
115 i++;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
116 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
117
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
118 if (!baseclasses.dim && sc.linkage == LINK.LINKcpp)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
119 cpp = 1;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
120
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
121 // Check for errors, handle forward references
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
122 for (i = 0; i < baseclasses.dim; )
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
123 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
124 TypeClass tc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
125 BaseClass b;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
126 Type tb;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
127
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
128 b = cast(BaseClass)baseclasses.data[i];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
129 b.type = b.type.semantic(loc, sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
130 tb = b.type.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
131 if (tb.ty == TY.Tclass)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
132 tc = cast(TypeClass)tb;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
133 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
134 tc = null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
135 if (!tc || !tc.sym.isInterfaceDeclaration())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
136 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
137 error("base type must be interface, not %s", b.type.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
138 baseclasses.remove(i);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
139 continue;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
140 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
141 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
142 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
143 // Check for duplicate interfaces
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
144 for (size_t j = 0; j < i; j++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
145 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
146 BaseClass b2 = cast(BaseClass)baseclasses.data[j];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
147 if (b2.base is tc.sym)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
148 error("inherits from duplicate interface %s", b2.base.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
149 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
150
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
151 b.base = tc.sym;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
152 if (b.base == this || isBaseOf2(b.base))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
153 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
154 error("circular inheritance of interface");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
155 baseclasses.remove(i);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
156 continue;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
157 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
158 if (!b.base.symtab)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
159 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
160 // Try to resolve forward reference
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
161 if (sc.mustsemantic && b.base.scope_)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
162 b.base.semantic(null);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
163 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
164 if (!b.base.symtab || b.base.scope_ || b.base.inuse)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
165 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
166 //error("forward reference of base class %s", baseClass.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
167 // Forward reference of base, try again later
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
168 //printf("\ttry later, forward reference of base %s\n", b.base.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
169 scope_ = scx ? scx : new Scope(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
170 scope_.setNoFree();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
171 scope_.module_.addDeferredSemantic(this);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
172 return;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
173 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
174 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
175 static if (false) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
176 // Inherit const/invariant from base class
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
177 storage_class |= b.base.storage_class & STC.STC_TYPECTOR;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
178 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
179 i++;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
180 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
181
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
182 interfaces_dim = baseclasses.dim;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
183 interfaces = cast(BaseClass*)baseclasses.data;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
184
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
185 interfaceSemantic(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
186
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
187 if (vtblOffset())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
188 vtbl.push(cast(void*)this); // leave room at vtbl[0] for classinfo
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
189
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
190 // Cat together the vtbl[]'s from base interfaces
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
191 for (i = 0; i < interfaces_dim; i++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
192 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
193 BaseClass b = interfaces[i];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
194
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
195 // Skip if b has already appeared
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
196 for (int k = 0; k < i; k++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
197 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
198 if (b == interfaces[i])
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
199 goto Lcontinue;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
200 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
201
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
202 // Copy vtbl[] from base class
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
203 if (b.base.vtblOffset())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
204 { int d = b.base.vtbl.dim;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
205 if (d > 1)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
206 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
207 vtbl.reserve(d - 1);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
208 for (int j = 1; j < d; j++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
209 vtbl.push(b.base.vtbl.data[j]);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
210 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
211 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
212 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
213 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
214 vtbl.append(b.base.vtbl);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
215 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
216
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
217 Lcontinue:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
218 ;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
219 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
220
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
221 protection = sc.protection;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
222 storage_class |= sc.stc & STC.STC_TYPECTOR;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
223
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
224 for (i = 0; i < members.dim; i++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
225 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
226 Dsymbol s = cast(Dsymbol)members.data[i];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
227 s.addMember(sc, this, 1);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
228 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
229
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
230 sc = sc.push(this);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
231 sc.stc &= ~(STC.STCfinal | STC.STCauto | STC.STCscope | STC.STCstatic |
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
232 STC.STCabstract | STC.STCdeprecated | STC.STC_TYPECTOR | STC.STCtls | STC.STCgshared);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
233 sc.stc |= storage_class & STC.STC_TYPECTOR;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
234 sc.parent = this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
235 if (isCOMinterface())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
236 sc.linkage = LINK.LINKwindows;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
237 else if (isCPPinterface())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
238 sc.linkage = LINK.LINKcpp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
239 sc.structalign = 8;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
240 structalign = sc.structalign;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
241 sc.offset = PTRSIZE * 2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
242 inuse++;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
243 for (i = 0; i < members.dim; i++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
244 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
245 Dsymbol s = cast(Dsymbol)members.data[i];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
246 s.semantic(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
247 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
248 inuse--;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
249 //members.print();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
250 sc.pop();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
251 //printf("-InterfaceDeclaration.semantic(%s), type = %p\n", toChars(), type);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
252 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
253
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
254 bool isBaseOf(ClassDeclaration cd, int* poffset)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
255 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
256 uint j;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
257
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
258 //printf("%s.InterfaceDeclaration.isBaseOf(cd = '%s')\n", toChars(), cd.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
259 assert(!baseClass);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
260 for (j = 0; j < cd.interfaces_dim; j++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
261 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
262 BaseClass b = cd.interfaces[j];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
263
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
264 //printf("\tbase %s\n", b.base.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
265 if (this == b.base)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
266 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
267 //printf("\tfound at offset %d\n", b.offset);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
268 if (poffset)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
269 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
270 *poffset = b.offset;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
271 if (j && cd.isInterfaceDeclaration())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
272 *poffset = OFFSET_RUNTIME;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
273 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
274 return true;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
275 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
276 if (isBaseOf(b, poffset))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
277 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
278 if (j && poffset && cd.isInterfaceDeclaration())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
279 *poffset = OFFSET_RUNTIME;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
280 return true;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
281 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
282 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
283
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
284 if (cd.baseClass && isBaseOf(cd.baseClass, poffset))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
285 return true;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
286
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
287 if (poffset)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
288 *poffset = 0;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
289 return false;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
290 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
291
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
292 bool isBaseOf(BaseClass bc, int* poffset)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
293 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
294 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
295 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
296
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
297 string kind()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
298 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
299 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
300 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
301
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
302 /****************************************
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
303 * Determine if slot 0 of the vtbl[] is reserved for something else.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
304 * For class objects, yes, this is where the ClassInfo ptr goes.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
305 * For COM interfaces, no.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
306 * For non-COM interfaces, yes, this is where the Interface ptr goes.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
307 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
308 int vtblOffset()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
309 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
310 if (isCOMinterface() || isCPPinterface())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
311 return 0;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
312 return 1;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
313 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
314
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
315 version (DMDV2) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
316 bool isCPPinterface()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
317 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
318 return cpp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
319 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
320 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
321 bool isCOMinterface()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
322 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
323 return com;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
324 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
325
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
326 void toObjFile(int multiobj) // compile to .obj file
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
327 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
328 uint i;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
329 uint offset;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
330 Symbol* sinit;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
331 SC scclass;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
332
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
333 //printf("InterfaceDeclaration.toObjFile('%s')\n", toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
334
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
335 if (!members)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
336 return;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
337
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
338 if (global.params.symdebug)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
339 toDebug();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
340
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
341 scclass = SCglobal;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
342 if (inTemplateInstance())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
343 scclass = SCcomdat;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
344
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
345 // Put out the members
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
346 for (i = 0; i < members.dim; i++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
347 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
348 Dsymbol member;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
349
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
350 member = cast(Dsymbol)members.data[i];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
351 if (!member.isFuncDeclaration())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
352 member.toObjFile(0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
353 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
354
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
355 // Generate C symbols
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
356 toSymbol();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
357
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
358 //////////////////////////////////////////////
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
359
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
360 // Put out the TypeInfo
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
361 type.getTypeInfo(null);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
362 type.vtinfo.toObjFile(multiobj);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
363
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
364 //////////////////////////////////////////////
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
365
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
366 // Put out the ClassInfo
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
367 csym.Sclass = scclass;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
368 csym.Sfl = FLdata;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
369
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
370 /* The layout is:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
371 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
372 void **vptr;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
373 monitor_t monitor;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
374 byte[] initializer; // static initialization data
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
375 char[] name; // class name
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
376 void *[] vtbl;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
377 Interface[] interfaces;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
378 Object *base; // base class
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
379 void *destructor;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
380 void *invariant; // class invariant
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
381 uint flags;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
382 void *deallocator;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
383 OffsetTypeInfo[] offTi;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
384 void *defaultConstructor;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
385 #if DMDV2
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
386 const(MemberInfo[]) function(string) xgetMembers; // module getMembers() function
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
387 #endif
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
388 TypeInfo typeinfo;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
389 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
390 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
391 dt_t *dt = null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
392
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
393 if (classinfo)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
394 dtxoff(&dt, classinfo.toVtblSymbol(), 0, TYnptr); // vtbl for ClassInfo
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
395 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
396 dtdword(&dt, 0); // BUG: should be an assert()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
397 dtdword(&dt, 0); // monitor
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
398
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
399 // initializer[]
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
400 dtdword(&dt, 0); // size
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
401 dtdword(&dt, 0); // initializer
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
402
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
403 // name[]
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
404 string name = toPrettyChars();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
405 size_t namelen = name.length;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
406 dtdword(&dt, namelen);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
407 dtabytes(&dt, TYnptr, 0, namelen + 1, toStringz(name));
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
408
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
409 // vtbl[]
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
410 dtdword(&dt, 0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
411 dtdword(&dt, 0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
412
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
413 // vtblInterfaces.data[]
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
414 dtdword(&dt, vtblInterfaces.dim);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
415 if (vtblInterfaces.dim)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
416 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
417 if (classinfo)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
418 assert(classinfo.structsize == CLASSINFO_SIZE);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
419 offset = CLASSINFO_SIZE;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
420 dtxoff(&dt, csym, offset, TYnptr); // (*)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
421 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
422 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
423 dtdword(&dt, 0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
424
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
425 // base
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
426 assert(!baseClass);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
427 dtdword(&dt, 0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
428
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
429 // dtor
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
430 dtdword(&dt, 0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
431
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
432 // invariant
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
433 dtdword(&dt, 0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
434
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
435 // flags
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
436 dtdword(&dt, 4 | isCOMinterface() | 32);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
437
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
438 // deallocator
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
439 dtdword(&dt, 0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
440
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
441 // offTi[]
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
442 dtdword(&dt, 0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
443 dtdword(&dt, 0); // null for now, fix later
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
444
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
445 // defaultConstructor
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
446 dtdword(&dt, 0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
447
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
448 version (DMDV2) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
449 // xgetMembers
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
450 dtdword(&dt, 0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
451 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
452
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
453 dtxoff(&dt, type.vtinfo.toSymbol(), 0, TYnptr); // typeinfo
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
454
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
455 //////////////////////////////////////////////
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
456
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
457 // Put out vtblInterfaces.data[]. Must immediately follow csym, because
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
458 // of the fixup (*)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
459
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
460 offset += vtblInterfaces.dim * (4 * PTRSIZE);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
461 for (i = 0; i < vtblInterfaces.dim; i++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
462 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
463 BaseClass b = cast(BaseClass)vtblInterfaces.data[i];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
464 ClassDeclaration id = b.base;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
465
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
466 // ClassInfo
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
467 dtxoff(&dt, id.toSymbol(), 0, TYnptr);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
468
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
469 // vtbl[]
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
470 dtdword(&dt, 0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
471 dtdword(&dt, 0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
472
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
473 // this offset
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
474 dtdword(&dt, b.offset);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
475 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
476
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
477 csym.Sdt = dt;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
478 version (ELFOBJ) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
479 csym.Sseg = CDATA;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
480 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
481 version (MACHOBJ) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
482 csym.Sseg = DATA;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
483 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
484 outdata(csym);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
485 if (isExport())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
486 obj_export(csym,0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
487 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
488
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
489 /*************************************
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
490 * Create the "InterfaceInfo" symbol
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
491 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
492 Symbol* toSymbol()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
493 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
494 if (!csym)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
495 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
496 Symbol *s;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
497
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
498 if (!scc)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
499 scc = fake_classsym(Id.ClassInfo);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
500
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
501 s = toSymbolX("__Interface", SCextern, scc.Stype, "Z");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
502 s.Sfl = FLextern;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
503 s.Sflags |= SFLnodebug;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
504 csym = s;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
505 slist_add(s);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
506 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
507 return csym;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
508 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
509
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
510 InterfaceDeclaration isInterfaceDeclaration() { return this; }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
511 }