[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1064402: Quick and dirty patch



All the errors comes down to the modification of for loop variables inside the loop. I don't know much about lua, but this seems to be forbidden, for loop variables being seen as const.

The attached patch is just a quick and dirty correction, that roughly comes down to change this kind of pattern:

for i in thing do
 ...
 i = somethingelse
 ...
 use(i)
 ...
end

into this one:

for i in thing do
 ...
 ii = somethingelse
 ...
 use(ii)
 ...
end

This is thoroughly NOT tested, it just seems to do the trick. I didn't dig at all the context of the code; I just did fix the errors as they keep appearing, until the script could run without error.


Raphaël



2435c2435,2436
<  for i,v in next,t do 
---
>  for i,v in next,t do
>   ind = i
2438c2439
<     i=tables[i]
---
>     ind=tables[i]
2440c2441
<     i=copy(i,tables)
---
>     ind=copy(i,tables)
2444c2445
<    tcopy[i]=v
---
>    tcopy[ind]=v
2446c2447
<    tcopy[i]=tables[v]
---
>    tcopy[ind]=tables[v]
2448c2449
<    tcopy[i]=copy(v,tables)
---
>    tcopy[ind]=copy(v,tables)
12983c12984
<    w=topattern(w,true,true)
---
>    ww=topattern(w,true,true)
12986c12987
<     elseif find(name,w) then
---
>     elseif find(name,ww) then
13555c13556
<     c=topattern(c,true,true)
---
>     cc=topattern(c,true,true)
13557c13558
<      if find(k,c) then
---
>      if find(k,cc) then
14501c14502,14504
<       line=0
---
>       lline=0
>      else
>       lline=line
14503c14506
<      dataset[#dataset+1]={ real,total,count,name,source,line }
---
>      dataset[#dataset+1]={ real,total,count,name,source,lline }
21136,21137c21139,21140
<    s=validate(s)
<    if s then
---
>    ss=validate(s)
>    if ss then
21139c21142
<     t[n]=s
---
>     t[n]=ss

Reply to: