JPEXS Free Flash Decompiler Issue Tracker

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.

List of issuesList of issues

#1334 For loops converts automatic to while loops
Author:
Date created:
Type: bug
Visibility: Everybody
Assigned to:
State: closed Help

> What steps will reproduce the problem? I'm trying to make for loops in pcode. But the problem is, it automatic changes to while loops. Here as an example: as3 code: var w:int = 25; var h:int = 25; var x:int = 0; var y:int = 0; for(x = 0; x < w; x++) { for(y = 0; y < h; y++) { trace(x + " " + y); } } pcode for loop: pushbyte 25 convert_i setlocal_1 pushbyte 25 convert_i setlocal_2 pushbyte 0 convert_i setlocal_3 pushbyte 0 convert_i setlocal 4 pushbyte 0 convert_i setlocal_3 jump ofs0073 ofs0042:label pushbyte 0 convert_i setlocal 4 jump ofs0066 ofs004e:label findpropstrict Qname(PackageNamespace(""),"trace") getlocal_3 pushstring " " add getlocal 4 add callproperty Qname(PackageNamespace(""),"trace") 1 pop getlocal 4 increment_i convert_i setlocal 4 ofs0066:getlocal 4 getlocal_2 iflt ofs004e getlocal_3 increment_i convert_i setlocal_3 ofs0073:getlocal_3 getlocal_1 iflt ofs0042 Ends in the other swf as while loops (Doesn't work) y = 0; x = 0; w = 25; h = 25; while(x < w) { y = 0; §§pop(); while(y < h) { continue; §§push(y + 1); } continue; §§push(x + 1); } > What is the expected output? What do you see instead? I want for loops. Because while loops doesn't work for me, it always send out 0. > What version of the product are you using? Is it "nightly build"? Which operating system do you have? FFDEC 10.0.0 Nightly Build 1627 > Please provide any additional information below. If the problem is related to a SWF file, attach it here, otherwise we can't help you.
"I want for loops. Because while loops doesn't work for me, it always send out 0." Then the problem is with your pcode. The for/while loop is only a decompilation of the pcode. Maybe the decompiling is buggy, you are right, but it won't solve your problem if we fix this issue. for(var i:int=0; i<n; i++) { test(); } if fully compatible with: var i:int = 0; while (i<n) { test(); i++; } (and copmatible with: for(var i:int=0; i<n; ) { test(); i++; } etc..) So if you compile both source code I'm sure that the result is the same pcode (at least in release mode). So it is not possible decopile exactly the same AS script which was before the compile in Adobe Flash. Ok, we can assume sometimes that it was a for loop, and we do that (which is maybe buggy as you wrote), but in this case it can happen that a while loop is decompiled as a for loop. It is normal. If your pcode returns 0, it will be the same when we fix the for loop decetion/decompilation. So try to fix your pcode.
I have tried everything. Still returns 0 every time. It's something wrong with the increasing variable.
I am closing this one since we can't probably help you with this and it is a long time - you are not probably even interested.
State: new→closed