Mercurial > projects > ddmd
comparison dmd/TypeTypedef.d @ 72:2e2a5c3f943a
reduced warnings by adding override to the methods
think this also normalizes different line endings used all over the place
author | Trass3r |
---|---|
date | Sat, 28 Aug 2010 16:19:48 +0200 |
parents | f708f0452e81 |
children | ef02e2e203c2 |
comparison
equal
deleted
inserted
replaced
71:8e24ef1dd139 | 72:2e2a5c3f943a |
---|---|
38 { | 38 { |
39 assert(false); | 39 assert(false); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 Type syntaxCopy() | 43 override Type syntaxCopy() |
44 { | 44 { |
45 assert(false); | 45 assert(false); |
46 } | 46 } |
47 | 47 |
48 ulong size(Loc loc) | 48 override ulong size(Loc loc) |
49 { | 49 { |
50 return sym.basetype.size(loc); | 50 return sym.basetype.size(loc); |
51 } | 51 } |
52 | 52 |
53 uint alignsize() | 53 override uint alignsize() |
54 { | 54 { |
55 assert(false); | 55 assert(false); |
56 } | 56 } |
57 | 57 |
58 string toChars() | 58 override string toChars() |
59 { | 59 { |
60 assert(false); | 60 assert(false); |
61 } | 61 } |
62 | 62 |
63 Type semantic(Loc loc, Scope sc) | 63 override Type semantic(Loc loc, Scope sc) |
64 { | 64 { |
65 //printf("TypeTypedef::semantic(%s), sem = %d\n", toChars(), sym->sem); | 65 //printf("TypeTypedef::semantic(%s), sem = %d\n", toChars(), sym->sem); |
66 sym.semantic(sc); | 66 sym.semantic(sc); |
67 return merge(); | 67 return merge(); |
68 } | 68 } |
69 | 69 |
70 Dsymbol toDsymbol(Scope sc) | 70 override Dsymbol toDsymbol(Scope sc) |
71 { | 71 { |
72 return sym; | 72 return sym; |
73 } | 73 } |
74 | 74 |
75 void toDecoBuffer(OutBuffer buf, int flag) | 75 override void toDecoBuffer(OutBuffer buf, int flag) |
76 { | 76 { |
77 Type.toDecoBuffer(buf, flag); | 77 Type.toDecoBuffer(buf, flag); |
78 string name = sym.mangle(); | 78 string name = sym.mangle(); |
79 buf.printf("%s", name); | 79 buf.printf("%s", name); |
80 } | 80 } |
81 | 81 |
82 void toCBuffer2(OutBuffer buf, HdrGenState* hgs, MOD mod) | 82 override void toCBuffer2(OutBuffer buf, HdrGenState* hgs, MOD mod) |
83 { | 83 { |
84 //printf("TypeTypedef.toCBuffer2() '%s'\n", sym.toChars()); | 84 //printf("TypeTypedef.toCBuffer2() '%s'\n", sym.toChars()); |
85 if (mod != this.mod) | 85 if (mod != this.mod) |
86 { | 86 { |
87 toCBuffer3(buf, hgs, mod); | 87 toCBuffer3(buf, hgs, mod); |
89 } | 89 } |
90 | 90 |
91 buf.writestring(sym.toChars()); | 91 buf.writestring(sym.toChars()); |
92 } | 92 } |
93 | 93 |
94 Expression dotExp(Scope sc, Expression e, Identifier ident) | 94 override Expression dotExp(Scope sc, Expression e, Identifier ident) |
95 { | 95 { |
96 version (LOGDOTEXP) { | 96 version (LOGDOTEXP) { |
97 printf("TypeTypedef.dotExp(e = '%s', ident = '%s') '%s'\n", e.toChars(), ident.toChars(), toChars()); | 97 printf("TypeTypedef.dotExp(e = '%s', ident = '%s') '%s'\n", e.toChars(), ident.toChars(), toChars()); |
98 } | 98 } |
99 if (ident is Id.init_) | 99 if (ident is Id.init_) |
101 return Type.dotExp(sc, e, ident); | 101 return Type.dotExp(sc, e, ident); |
102 } | 102 } |
103 return sym.basetype.dotExp(sc, e, ident); | 103 return sym.basetype.dotExp(sc, e, ident); |
104 } | 104 } |
105 | 105 |
106 Expression getProperty(Loc loc, Identifier ident) | 106 override Expression getProperty(Loc loc, Identifier ident) |
107 { | 107 { |
108 version (LOGDOTEXP) { | 108 version (LOGDOTEXP) { |
109 printf("TypeTypedef.getProperty(ident = '%s') '%s'\n", ident.toChars(), toChars()); | 109 printf("TypeTypedef.getProperty(ident = '%s') '%s'\n", ident.toChars(), toChars()); |
110 } | 110 } |
111 if (ident == Id.init_) | 111 if (ident == Id.init_) |
118 bool isbit() | 118 bool isbit() |
119 { | 119 { |
120 assert(false); | 120 assert(false); |
121 } | 121 } |
122 | 122 |
123 bool isintegral() | 123 override bool isintegral() |
124 { | 124 { |
125 //printf("TypeTypedef::isintegral()\n"); | 125 //printf("TypeTypedef::isintegral()\n"); |
126 //printf("sym = '%s'\n", sym->toChars()); | 126 //printf("sym = '%s'\n", sym->toChars()); |
127 //printf("basetype = '%s'\n", sym->basetype->toChars()); | 127 //printf("basetype = '%s'\n", sym->basetype->toChars()); |
128 return sym.basetype.isintegral(); | 128 return sym.basetype.isintegral(); |
129 } | 129 } |
130 | 130 |
131 bool isfloating() | 131 override bool isfloating() |
132 { | 132 { |
133 return sym.basetype.isfloating(); | 133 return sym.basetype.isfloating(); |
134 } | 134 } |
135 | 135 |
136 bool isreal() | 136 override bool isreal() |
137 { | 137 { |
138 return sym.basetype.isreal(); | 138 return sym.basetype.isreal(); |
139 } | 139 } |
140 | 140 |
141 bool isimaginary() | 141 override bool isimaginary() |
142 { | 142 { |
143 return sym.basetype.isimaginary(); | 143 return sym.basetype.isimaginary(); |
144 } | 144 } |
145 | 145 |
146 bool iscomplex() | 146 override bool iscomplex() |
147 { | 147 { |
148 return sym.basetype.iscomplex(); | 148 return sym.basetype.iscomplex(); |
149 } | 149 } |
150 | 150 |
151 bool isscalar() | 151 override bool isscalar() |
152 { | 152 { |
153 return sym.basetype.isscalar(); | 153 return sym.basetype.isscalar(); |
154 } | 154 } |
155 | 155 |
156 bool isunsigned() | 156 override bool isunsigned() |
157 { | 157 { |
158 return sym.basetype.isunsigned(); | 158 return sym.basetype.isunsigned(); |
159 } | 159 } |
160 | 160 |
161 bool checkBoolean() | 161 override bool checkBoolean() |
162 { | 162 { |
163 return sym.basetype.checkBoolean(); | 163 return sym.basetype.checkBoolean(); |
164 } | 164 } |
165 | 165 |
166 int isAssignable() | 166 override int isAssignable() |
167 { | 167 { |
168 return sym.basetype.isAssignable(); | 168 return sym.basetype.isAssignable(); |
169 } | 169 } |
170 | 170 |
171 Type toBasetype() | 171 override Type toBasetype() |
172 { | 172 { |
173 if (sym.inuse) | 173 if (sym.inuse) |
174 { | 174 { |
175 sym.error("circular definition"); | 175 sym.error("circular definition"); |
176 sym.basetype = Type.terror; | 176 sym.basetype = Type.terror; |
181 sym.inuse = 0; | 181 sym.inuse = 0; |
182 t = t.addMod(mod); | 182 t = t.addMod(mod); |
183 return t; | 183 return t; |
184 } | 184 } |
185 | 185 |
186 MATCH implicitConvTo(Type to) | 186 override MATCH implicitConvTo(Type to) |
187 { | 187 { |
188 MATCH m; | 188 MATCH m; |
189 | 189 |
190 //printf("TypeTypedef::implicitConvTo(to = %s) %s\n", to->toChars(), toChars()); | 190 //printf("TypeTypedef::implicitConvTo(to = %s) %s\n", to->toChars(), toChars()); |
191 if (equals(to)) | 191 if (equals(to)) |
199 else | 199 else |
200 m = MATCHnomatch; // no match | 200 m = MATCHnomatch; // no match |
201 return m; | 201 return m; |
202 } | 202 } |
203 | 203 |
204 MATCH constConv(Type to) | 204 override MATCH constConv(Type to) |
205 { | 205 { |
206 if (equals(to)) | 206 if (equals(to)) |
207 return MATCHexact; | 207 return MATCHexact; |
208 if (ty == to.ty && sym == (cast(TypeTypedef)to).sym) | 208 if (ty == to.ty && sym == (cast(TypeTypedef)to).sym) |
209 return sym.basetype.implicitConvTo((cast(TypeTypedef)to).sym.basetype); | 209 return sym.basetype.implicitConvTo((cast(TypeTypedef)to).sym.basetype); |
210 return MATCHnomatch; | 210 return MATCHnomatch; |
211 } | 211 } |
212 | 212 |
213 Expression defaultInit(Loc loc) | 213 override Expression defaultInit(Loc loc) |
214 { | 214 { |
215 Expression e; | 215 Expression e; |
216 Type bt; | 216 Type bt; |
217 | 217 |
218 version (LOGDEFAULTINIT) { | 218 version (LOGDEFAULTINIT) { |
233 bt = tsa.next.toBasetype(); | 233 bt = tsa.next.toBasetype(); |
234 } | 234 } |
235 return e; | 235 return e; |
236 } | 236 } |
237 | 237 |
238 bool isZeroInit(Loc loc) | 238 override bool isZeroInit(Loc loc) |
239 { | 239 { |
240 if (sym.init) | 240 if (sym.init) |
241 { | 241 { |
242 if (sym.init.isVoidInitializer()) | 242 if (sym.init.isVoidInitializer()) |
243 return true; // initialize voids to 0 | 243 return true; // initialize voids to 0 |
257 sym.inuse = 0; | 257 sym.inuse = 0; |
258 | 258 |
259 return result; | 259 return result; |
260 } | 260 } |
261 | 261 |
262 dt_t** toDt(dt_t** pdt) | 262 override dt_t** toDt(dt_t** pdt) |
263 { | 263 { |
264 if (sym.init) | 264 if (sym.init) |
265 { | 265 { |
266 dt_t* dt = sym.init.toDt(); | 266 dt_t* dt = sym.init.toDt(); |
267 | 267 |
273 | 273 |
274 sym.basetype.toDt(pdt); | 274 sym.basetype.toDt(pdt); |
275 return pdt; | 275 return pdt; |
276 } | 276 } |
277 | 277 |
278 MATCH deduceType(Scope sc, Type tparam, TemplateParameters parameters, Objects dedtypes) | 278 override MATCH deduceType(Scope sc, Type tparam, TemplateParameters parameters, Objects dedtypes) |
279 { | 279 { |
280 // Extra check | 280 // Extra check |
281 if (tparam && tparam.ty == Ttypedef) | 281 if (tparam && tparam.ty == Ttypedef) |
282 { | 282 { |
283 TypeTypedef tp = cast(TypeTypedef)tparam; | 283 TypeTypedef tp = cast(TypeTypedef)tparam; |
286 return MATCHnomatch; | 286 return MATCHnomatch; |
287 } | 287 } |
288 return Type.deduceType(sc, tparam, parameters, dedtypes); | 288 return Type.deduceType(sc, tparam, parameters, dedtypes); |
289 } | 289 } |
290 | 290 |
291 TypeInfoDeclaration getTypeInfoDeclaration() | 291 override TypeInfoDeclaration getTypeInfoDeclaration() |
292 { | 292 { |
293 return new TypeInfoTypedefDeclaration(this); | 293 return new TypeInfoTypedefDeclaration(this); |
294 } | 294 } |
295 | 295 |
296 bool hasPointers() | 296 override bool hasPointers() |
297 { | 297 { |
298 return toBasetype().hasPointers(); | 298 return toBasetype().hasPointers(); |
299 } | 299 } |
300 | 300 |
301 Type toHeadMutable() | 301 override Type toHeadMutable() |
302 { | 302 { |
303 assert(false); | 303 assert(false); |
304 } | 304 } |
305 | 305 |
306 version (CPP_MANGLE) { | 306 version (CPP_MANGLE) { |
308 { | 308 { |
309 assert(false); | 309 assert(false); |
310 } | 310 } |
311 } | 311 } |
312 | 312 |
313 type* toCtype() | 313 override type* toCtype() |
314 { | 314 { |
315 return sym.basetype.toCtype(); | 315 return sym.basetype.toCtype(); |
316 } | 316 } |
317 | 317 |
318 type* toCParamtype() | 318 override type* toCParamtype() |
319 { | 319 { |
320 return sym.basetype.toCParamtype(); | 320 return sym.basetype.toCParamtype(); |
321 } | 321 } |
322 } | 322 } |