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.

#2497 Using swap instruction causes incorrect decompiled execution order
Author:
JPEXS

Date created:
Type: bug
Visibility: Everybody
Assigned to:
State: new 

> What steps will reproduce the problem?
Compile following AS3 p-code:
```
body
maxstack 5
localcount 3
initscopedepth 9
maxscopedepth 10
code
getlocal0
pushscope
getlocal0
constructsuper 0
debug 1, "a", 0, 13
debug 1, "b", 1, 13
pushstring "x"
pushbyte 1
pushstring "y"
pushbyte 2
newobject 2
coerce_a
setlocal1
getlocal1
dup
getproperty
Multiname("x",[PackageNamespace(""),Namespace("http://adobe.com/AS3/2006/builtin"),PackageI
nternalNs(""),PrivateNamespace("TestSwap"),ProtectedNamespace("TestSwap"),StaticProtectedN
s("TestSwap"),PrivateNamespace("TestSwap.as$1")])
swap ; this one is critical
deleteproperty
Multiname("x",[PackageNamespace(""),Namespace("http://adobe.com/AS3/2006/builtin"),PackageI
nternalNs(""),PrivateNamespace("TestSwap"),ProtectedNamespace("TestSwap"),StaticProtectedN
s("TestSwap"),PrivateNamespace("TestSwap.as$1")])
pop
setlocal2
findpropstrict QName(PackageNamespace(""),"trace")
pushstring "result:"
getlocal2
add
callpropvoid QName(PackageNamespace(""),"trace"), 1
returnvoid
end ; code
end ; body
```
> What is the expected output? What do you see instead?
I expect getting property value x should be in code earlier than the property deletion.
Instead there is:
```
super();
var a:* = {
"x":1,
"y":2
};
delete a.x; //this should be later in the code
var b:* = a.x;
trace("result:" + b);
```
Recompiling this won't get the desired execution order.
Original p-code will print 1, this recompiled variant will print undefined
I expect the decompiler would do something like this:
```
super();
var a:* = {
"x":1,
"y":2
};
§§push(a.x);
delete a.x;
var b:* = §§pop();
trace("result:" + b);
```
> What version of the product are you using? Is it "nightly build"? Which operating system
do you have?
24.0.1 nightly 3266, Windows 11.
> Please provide any additional information below. If the problem is related to a SWF
file, attach it here, otherwise we can't help you.
Attaching sample SWF file.
