Mercurial > projects > ddmd
comparison dmd/FuncDeclaration.d @ 89:37b95c347975
Fixed an obscure bug with i variable being reused
author | korDen |
---|---|
date | Mon, 30 Aug 2010 23:25:50 +0400 |
parents | 23280d154c5b |
children | 21a53563c840 |
comparison
equal
deleted
inserted
replaced
88:23280d154c5b | 89:37b95c347975 |
---|---|
3160 Symbol* sexit; | 3160 Symbol* sexit; |
3161 | 3161 |
3162 FuncDeclaration func = this; | 3162 FuncDeclaration func = this; |
3163 ClassDeclaration cd = func.parent.isClassDeclaration(); | 3163 ClassDeclaration cd = func.parent.isClassDeclaration(); |
3164 int reverse; | 3164 int reverse; |
3165 int i; | 3165 |
3166 int has_arguments; | 3166 int has_arguments; |
3167 | 3167 |
3168 //printf("FuncDeclaration.toObjFile(%p, %s.%s)\n", func, parent.toChars(), func.toChars()); | 3168 //printf("FuncDeclaration.toObjFile(%p, %s.%s)\n", func, parent.toChars(), func.toChars()); |
3169 static if (false) { | 3169 static if (false) { |
3170 //printf("line = %d\n",func.getWhere() / LINEINC); | 3170 //printf("line = %d\n",func.getWhere() / LINEINC); |
3353 params[pi] = v_arguments.toSymbol(); | 3353 params[pi] = v_arguments.toSymbol(); |
3354 pi += 1; | 3354 pi += 1; |
3355 } | 3355 } |
3356 if (parameters) | 3356 if (parameters) |
3357 { | 3357 { |
3358 foreach (size_t i, Dsymbol s3; parameters) | 3358 size_t i = 0; |
3359 for ( ; i < parameters.dim; ++i) | |
3359 { | 3360 { |
3360 auto v = cast(VarDeclaration)s3; | 3361 auto v = cast(VarDeclaration)parameters[i]; |
3361 debug { | 3362 debug { |
3362 if (v.csym) | 3363 if (v.csym) |
3363 writef("parameter '%s'\n", v.toChars()); | 3364 writef("parameter '%s'\n", v.toChars()); |
3364 } | 3365 } |
3365 assert(!v.csym); | 3366 assert(!v.csym); |
3369 } | 3370 } |
3370 | 3371 |
3371 if (reverse) | 3372 if (reverse) |
3372 { | 3373 { |
3373 // Reverse params[] entries | 3374 // Reverse params[] entries |
3374 for (i = 0; i < pi/2; i++) | 3375 for (size_t i = 0; i < pi/2; i++) |
3375 { | 3376 { |
3376 Symbol* sptmp = params[i]; | 3377 Symbol* sptmp = params[i]; |
3377 params[i] = params[pi - 1 - i]; | 3378 params[i] = params[pi - 1 - i]; |
3378 params[pi - 1 - i] = sptmp; | 3379 params[pi - 1 - i] = sptmp; |
3379 } | 3380 } |
3414 Symbol* sp = params[0]; | 3415 Symbol* sp = params[0]; |
3415 params[0] = params[1]; | 3416 params[0] = params[1]; |
3416 params[1] = sp; | 3417 params[1] = sp; |
3417 } | 3418 } |
3418 | 3419 |
3419 for (i = 0; i < pi; i++) | 3420 for (size_t i = 0; i < pi; i++) |
3420 { | 3421 { |
3421 Symbol *sp = params[i]; | 3422 Symbol *sp = params[i]; |
3422 sp.Sclass = SC.SCparameter; | 3423 sp.Sclass = SC.SCparameter; |
3423 sp.Sflags &= ~SFL.SFLspill; | 3424 sp.Sflags &= ~SFL.SFLspill; |
3424 sp.Sfl = FL.FLpara; | 3425 sp.Sfl = FL.FLpara; |
3576 | 3577 |
3577 if (isExport()) { | 3578 if (isExport()) { |
3578 obj_export(s, Poffset); | 3579 obj_export(s, Poffset); |
3579 } | 3580 } |
3580 | 3581 |
3581 for (i = 0; i < irs.deferToObj.dim; i++) | 3582 for (size_t i = 0; i < irs.deferToObj.dim; i++) |
3582 { | 3583 { |
3583 Dsymbol ss = cast(Dsymbol)irs.deferToObj.data[i]; | 3584 Dsymbol ss = cast(Dsymbol)irs.deferToObj.data[i]; |
3584 ss.toObjFile(0); | 3585 ss.toObjFile(0); |
3585 } | 3586 } |
3586 | 3587 |