d: Use Array::find to get index of element
gcc/d/ChangeLog: * d-codegen.cc (build_frame_type): Use Array::find to get index of element.
This commit is contained in:
parent
4993d0265e
commit
62321ab477
@ -2507,15 +2507,11 @@ build_frame_type (tree ffi, FuncDeclaration *fd)
|
|||||||
{
|
{
|
||||||
VarDeclaration *v = (*fd->parameters)[i];
|
VarDeclaration *v = (*fd->parameters)[i];
|
||||||
/* Remove if already in closureVars so can push to front. */
|
/* Remove if already in closureVars so can push to front. */
|
||||||
for (size_t j = i; j < fd->closureVars.length; j++)
|
size_t j = fd->closureVars.find (v);
|
||||||
{
|
|
||||||
Dsymbol *s = fd->closureVars[j];
|
if (j < fd->closureVars.length)
|
||||||
if (s == v)
|
fd->closureVars.remove (j);
|
||||||
{
|
|
||||||
fd->closureVars.remove (j);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fd->closureVars.insert (i, v);
|
fd->closureVars.insert (i, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2523,15 +2519,11 @@ build_frame_type (tree ffi, FuncDeclaration *fd)
|
|||||||
/* Also add hidden `this' to outer context. */
|
/* Also add hidden `this' to outer context. */
|
||||||
if (fd->vthis)
|
if (fd->vthis)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < fd->closureVars.length; i++)
|
size_t i = fd->closureVars.find (fd->vthis);
|
||||||
{
|
|
||||||
Dsymbol *s = fd->closureVars[i];
|
if (i < fd->closureVars.length)
|
||||||
if (s == fd->vthis)
|
fd->closureVars.remove (i);
|
||||||
{
|
|
||||||
fd->closureVars.remove (i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fd->closureVars.insert (0, fd->vthis);
|
fd->closureVars.insert (0, fd->vthis);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user