mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-02 18:54:44 +00:00
AS3 parser: get/set property stats fix. List of differences from official compiler.
This commit is contained in:
@@ -25,7 +25,6 @@ import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.GetPropertyAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
|
||||
import com.jpexs.decompiler.flash.abc.types.Multiname;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -49,11 +48,13 @@ public class GetPropertyIns extends InstructionDefinition {
|
||||
public int getStackDelta(AVM2Instruction ins, ABC abc) {
|
||||
int ret = -1 + 1;
|
||||
int multinameIndex = ins.operands[0];
|
||||
int kind = abc.constants.getMultiname(multinameIndex).kind;
|
||||
if (kind != Multiname.MULTINAMEL && kind != Multiname.MULTINAMELA) { //FIXME!!!
|
||||
if (abc.constants.getMultiname(multinameIndex).needsName()) {
|
||||
ret--;
|
||||
}
|
||||
//Note: In official compiler, the stack can be wrong(greater) for some MULTINAMEL/A, e.g. increments
|
||||
/*
|
||||
var arr=[1,2,3];
|
||||
return arr[2]++;
|
||||
*/
|
||||
if (abc.constants.getMultiname(multinameIndex).needsName()) {
|
||||
ret--;
|
||||
}
|
||||
if (abc.constants.getMultiname(multinameIndex).needsNs()) {
|
||||
ret--;
|
||||
|
||||
@@ -134,10 +134,11 @@ public class SetPropertyIns extends InstructionDefinition implements SetTypeIns
|
||||
public int getStackDelta(AVM2Instruction ins, ABC abc) {
|
||||
int ret = -2;
|
||||
int multinameIndex = ins.operands[0];
|
||||
int multinameKind = abc.constants.getMultiname(multinameIndex).kind;
|
||||
if (multinameKind == Multiname.MULTINAMEL || multinameKind == Multiname.MULTINAMELA) { //FIXME!!!
|
||||
return 0;
|
||||
}
|
||||
//Note: In official compiler, the stack can be wrong(greater) for some MULTINAMEL/A, e.g. increments
|
||||
/*
|
||||
var arr=[1,2,3];
|
||||
trace(arr[2]++);
|
||||
*/
|
||||
if (abc.constants.getMultiname(multinameIndex).needsName()) {
|
||||
ret--;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
List of differences between FFDec and official compiler
|
||||
--------------------------------------------------------
|
||||
- Maximal stack count in method body can be lower in FFDec as official compiler in some cases calculates it wrong (e.g. increments and set/get property).
|
||||
- In names of type Multiname(L/LA), namespaceset can have namespaces in different order, this is because official compiler generates
|
||||
this based on constructor position inside class
|
||||
@@ -2,5 +2,4 @@ TODO List for AS3 parser/compiler:
|
||||
------------------------------
|
||||
- E4X (XML)
|
||||
- default xml namespace
|
||||
- custom namespace modifiers
|
||||
- fix setproperty, getproperty stats calculation (stack pos)
|
||||
- custom namespace modifiers
|
||||
Reference in New Issue
Block a user