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.

#12 logical computing & handling temporary variables generated by compiler & if-elsif-else statement & NEED_ARGUMENTS
Author:
googleCode

Date created:
Type: bug
Visibility: Everybody
Assigned to:
Labels: AS3DecompilationGoogle Code
State: closed 

Hi all. Recently i found some errors with decompiling as3.
1 . logical computing
eg :
1. var b : Boolean = ( i==0 || i == 1 ) && j == 0 ;
2. return i == 1 || true ;
3. maxed logical comput expression as condition in if | while | for statement
2. handling temporary variables
1. i = ( i /= 2 );
2. this.i = this.j ++;
3. arr[0]() ;
<b>3.</b>
....
4.
1. function func( i : int ) : void
{
arguments.contant(i);
}
i have corrected those in most cases
as code be changed a lot , i 'll paste the code i changed later
1. source code (demo just test the syntax & has no sense )
package src.ass
{
public class Test
{
public function Test( )
{
}
public function func() : Boolean
{
if( ( i = i/= 2 ) == 1 || i == 2 )
{
arguments.concat(i);
}
else if( i == 0 )
{
i = j++ ;
}
else
{
arr[0]() ;
}
return i == 0 ;
}
private var i : int ;
private var j : int ;
private var arr : Array ;
}
}
2. the correct output
package src.ass
{
import src.ass.*;
public class Test extends Object
{
public function Test() {
super();
return;
}
public function func() : Boolean{
this.i=( this.i=this.i/2 );
if((( this.i=this.i/2 ))==1||this.i==2)
{
arguments.concat(this.i)
}
else
{
if(this.i==0)
{
this.i=this.j++;
}
else
{
this.arr[0]()
}
}
return this.i==0;
}
private var i:int;
private var j:int;
private var arr:Array;
}
}
3. pcode
debugfile 3
debugline 9
getlocal_0
pushscope
debugline 11
getlocal_0
getlocal_0
getlocal_0
getproperty 1
pushbyte 2
divide
dup
setlocal_2
initproperty 1
getlocal_2
kill 2
dup
setlocal_2
initproperty 1
getlocal_2
kill 2
pushbyte 1
equals
convert_b
dup
convert_b
iftrue 8
pop
getlocal_0
getproperty 1
pushbyte 2
equals
convert_b
iffalse 14
debugline 13
getlocal_1
getlocal_0
getproperty 1
callproperty 2 1
pop
jump 53
debugline 15
getlocal_0
getproperty 1
pushbyte 0
ifne 25
debugline 17
getlocal_0
getlocal_0
dup
setlocal_2
getproperty 3
dup
increment_i
setlocal_3
getlocal_2
getlocal_3
setproperty 3
kill 3
kill 2
initproperty 1
jump 17
debugline 21
getlocal_0
getproperty 4
dup
setlocal_2
pushbyte 0
getproperty 5
getlocal_2
call 0
pop
kill 2
debugline 24
getlocal_0
getproperty 1
pushbyte 0
equals
returnvalue
Hi, I did a lot of changes to the code, most of the problems should be fixed, please try
version 1.0.1
State: →closed
Title: logical computing & handling temporary variables generated by compiler & if-elsif-else statement & NEED_ARGUMENTS →logical computing & handling temporary variables generated by compiler & if-elsif-else statement & NEED_ARGUMENTS
Type: →bug
Visibility: →Everybody
Title: logical computing & handling temporary variables generated by compiler & if-elsif-else statement & NEED_ARGUMENTS →logical computing & handling temporary variables generated by compiler & if-elsif-else statement & NEED_ARGUMENTS
Type: →bug
Visibility: →Everybody