comparison dmd/InterfaceDeclaration.d @ 89:37b95c347975

Fixed an obscure bug with i variable being reused
author korDen
date Mon, 30 Aug 2010 23:25:50 +0400
parents b17640f0e4e8
children e28b18c23469
comparison
equal deleted inserted replaced
88:23280d154c5b 89:37b95c347975
52 assert(false); 52 assert(false);
53 } 53 }
54 54
55 override void semantic(Scope sc) 55 override void semantic(Scope sc)
56 { 56 {
57 int i;
58
59 //printf("InterfaceDeclaration.semantic(%s), type = %p\n", toChars(), type); 57 //printf("InterfaceDeclaration.semantic(%s), type = %p\n", toChars(), type);
60 if (inuse) 58 if (inuse)
61 return; 59 return;
62 60
63 if (!sc) 61 if (!sc)
93 { 91 {
94 isdeprecated = true; 92 isdeprecated = true;
95 } 93 }
96 94
97 // Expand any tuples in baseclasses[] 95 // Expand any tuples in baseclasses[]
98 for (i = 0; i < baseclasses.dim; ) 96 for (size_t i = 0; i < baseclasses.dim; )
99 { 97 {
100 BaseClass b = cast(BaseClass)baseclasses.data[0]; 98 BaseClass b = cast(BaseClass)baseclasses.data[0];
101 b.type = b.type.semantic(loc, sc); 99 b.type = b.type.semantic(loc, sc);
102 Type tb = b.type.toBasetype(); 100 Type tb = b.type.toBasetype();
103 101
118 116
119 if (!baseclasses.dim && sc.linkage == LINK.LINKcpp) 117 if (!baseclasses.dim && sc.linkage == LINK.LINKcpp)
120 cpp = 1; 118 cpp = 1;
121 119
122 // Check for errors, handle forward references 120 // Check for errors, handle forward references
123 for (i = 0; i < baseclasses.dim; ) 121 for (size_t i = 0; i < baseclasses.dim; )
124 { 122 {
125 TypeClass tc; 123 TypeClass tc;
126 BaseClass b; 124 BaseClass b;
127 Type tb; 125 Type tb;
128 126
187 185
188 if (vtblOffset()) 186 if (vtblOffset())
189 vtbl.push(cast(void*)this); // leave room at vtbl[0] for classinfo 187 vtbl.push(cast(void*)this); // leave room at vtbl[0] for classinfo
190 188
191 // Cat together the vtbl[]'s from base interfaces 189 // Cat together the vtbl[]'s from base interfaces
192 for (i = 0; i < interfaces_dim; i++) 190 for (size_t i = 0; i < interfaces_dim; i++)
193 { 191 {
194 BaseClass b = interfaces[i]; 192 BaseClass b = interfaces[i];
195 193
196 // Skip if b has already appeared 194 // Skip if b has already appeared
197 for (int k = 0; k < i; k++) 195 for (int k = 0; k < i; k++)
342 return com; 340 return com;
343 } 341 }
344 342
345 override void toObjFile(int multiobj) // compile to .obj file 343 override void toObjFile(int multiobj) // compile to .obj file
346 { 344 {
347 uint i;
348 uint offset; 345 uint offset;
349 Symbol* sinit; 346 Symbol* sinit;
350 SC scclass; 347 SC scclass;
351 348
352 //printf("InterfaceDeclaration.toObjFile('%s')\n", toChars()); 349 //printf("InterfaceDeclaration.toObjFile('%s')\n", toChars());
472 469
473 // Put out vtblInterfaces.data[]. Must immediately follow csym, because 470 // Put out vtblInterfaces.data[]. Must immediately follow csym, because
474 // of the fixup (*) 471 // of the fixup (*)
475 472
476 offset += vtblInterfaces.dim * (4 * PTRSIZE); 473 offset += vtblInterfaces.dim * (4 * PTRSIZE);
477 for (i = 0; i < vtblInterfaces.dim; i++) 474 for (size_t i = 0; i < vtblInterfaces.dim; i++)
478 { 475 {
479 BaseClass b = cast(BaseClass)vtblInterfaces.data[i]; 476 BaseClass b = cast(BaseClass)vtblInterfaces.data[i];
480 ClassDeclaration id = b.base; 477 ClassDeclaration id = b.base;
481 478
482 // ClassInfo 479 // ClassInfo