If you are looking for the decompiler itself, visit https://github.com/jindrapetrik/jpexs-decompiler
NEW : We have got a new blog where we post some interesting SWF internals info.

#347 AS3 for loop with return decompiled as while inversed
Author:
pepka

Date created:
Type: question
Visibility: Everybody
Assigned to:
JPEXS

Labels: AS3Decompilation
State: closed 

> What is the expected output? What do you see instead?
private function example(param1:int, param2:int):int
{
var var1:Object = null;
var var2:int = -1;
param2--;
for (;;)
{
if (var1.x + var1.y > 0 && param1 < 0)
{
return var2 + 5;
}
}
return var2;
}
is decompiled as
private function example(param1:int, param2:int) : int {
var var1:Object = null;
var var2:* = -1;
param2--;
while(!(var1.x + var1.y > 0 && param1 < 0))
{
}
return var2 + 5;
}
> What version of the product are you using? On what operating system?
1.7.0u1

May I ask you what's the fucking point in attaching the source code instead of the
compiled swf?
Please do not use coarse language here, thanks.
I think it is not a problem in this particular case, because the example is simple and I
can easily compile it myself.
Ok... I took another look on the code now (after 2 years) and found these two codes
equal:
In your code the "return var2" is never reached, so it is is correctly ignored by the
decompiler.
Your for loop breaks only when the if condition is met => (var1.x + var1.y > 0 && param1 <
0)
So in fact, the loop continues when inverse loop is met => !(var1.x + var1.y > 0 && param1
< 0)
Both codes are equivalent and I cannot distingish between them.
If you agree I'll close this issue.
State: new→upgraded
Title: AS3 improper decompilation→AS3 for loop with return decompiled as while inversed
Type: bug→question
Assigned: →
JPEXS
Title: AS3 improper decompilation→AS3 for loop with return decompiled as while inversed
Type: bug→question
Assigned: →

I close this issue due to inactivity. Please create new issue if problem persists.
State: upgraded→closed