diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java index b7abb9d5f..5db4e745d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java @@ -822,7 +822,7 @@ public class ABC { if (t instanceof TraitSlotConst) { TraitSlotConst s = ((TraitSlotConst) t); if (s.isNamespace()) { - DottedChain key = constants.getNamespace(s.value_index).getName(constants, true); // assume not null + DottedChain key = constants.getNamespace(s.value_index).getName(constants); // assume not null DottedChain val = constants.getMultiname(s.name_index).getNameWithNamespace(constants); map.put(key, val); } @@ -1037,10 +1037,15 @@ public class ABC { return findMethodBodyByName(classId, methodName); } + public int findClassByName(DottedChain name) { + String str = name == null ? null : name.toRawString(); + return findClassByName(str); + } + public int findClassByName(String name) { for (int c = 0; c < instance_info.size(); c++) { DottedChain s = constants.getMultiname(instance_info.get(c).name_index).getNameWithNamespace(constants); - if (name.equals(s.toString())) { + if (name.equals(s.toRawString())) { return c; } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java index 0db060517..2b138d447 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java @@ -89,7 +89,7 @@ public class ScriptPack extends AS3ClassTreeItem { Multiname name = abc.script_info.get(scriptIndex).traits.traits.get(t).getName(abc); Namespace ns = name.getNamespace(abc.constants); if ((ns.kind == Namespace.KIND_PACKAGE) || (ns.kind == Namespace.KIND_PACKAGE_INTERNAL)) { - packageName = ns.getName(abc.constants, false); // assume not null + packageName = ns.getName(abc.constants); // assume not null } } return packageName; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Deobfuscation.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Deobfuscation.java index 13ba6d063..9e5473d59 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Deobfuscation.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Deobfuscation.java @@ -56,6 +56,10 @@ public class AVM2Deobfuscation { private final Map usageTypesCount = new HashMap<>(); + public static final DottedChain FLASH_PROXY = new DottedChain("flash", "utils", "flash_proxy"); + + public static final DottedChain BUILTIN = new DottedChain("-"); + public AVM2Deobfuscation(AVM2ConstantPool constants) { this.constants = constants; } @@ -104,10 +108,10 @@ public class AVM2Deobfuscation { return null; } if (ns.equals("http://www.adobe.com/2006/actionscript/flash/proxy")) { - return new DottedChain("flash", "utils", "flash_proxy"); + return FLASH_PROXY; } if (ns.equals("http://adobe.com/AS3/2006/builtin")) { - return new DottedChain("-"); + return BUILTIN; } return null; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceSIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceSIns.java index bd856cf3d..dc8ae1403 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceSIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceSIns.java @@ -57,6 +57,6 @@ public class CoerceSIns extends InstructionDefinition implements CoerceOrConvert @Override public GraphTargetItem getTargetType(AVM2ConstantPool constants, AVM2Instruction ins, List fullyQualifiedNames) { - return new TypeItem(new DottedChain("String")); + return new TypeItem(DottedChain.STRING); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java index a328724dd..14f61aa42 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java @@ -67,6 +67,6 @@ public class ConvertBIns extends InstructionDefinition implements CoerceOrConver @Override public GraphTargetItem getTargetType(AVM2ConstantPool constants, AVM2Instruction ins, List fullyQualifiedNames) { - return new TypeItem(new DottedChain("Boolean")); + return new TypeItem(DottedChain.BOOLEAN); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertDIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertDIns.java index 3dfbf2908..d34924b91 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertDIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertDIns.java @@ -75,6 +75,6 @@ public class ConvertDIns extends InstructionDefinition implements CoerceOrConver @Override public GraphTargetItem getTargetType(AVM2ConstantPool constants, AVM2Instruction ins, List fullyQualifiedNames) { - return new TypeItem(new DottedChain("Number")); + return new TypeItem(DottedChain.NUMBER); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertIIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertIIns.java index 9d4fe21da..594d1e1c1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertIIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertIIns.java @@ -73,6 +73,6 @@ public class ConvertIIns extends InstructionDefinition implements CoerceOrConver @Override public GraphTargetItem getTargetType(AVM2ConstantPool constants, AVM2Instruction ins, List fullyQualifiedNames) { - return new TypeItem(new DottedChain("int")); + return new TypeItem(DottedChain.INT); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertOIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertOIns.java index 968661991..67f948da6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertOIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertOIns.java @@ -56,6 +56,6 @@ public class ConvertOIns extends InstructionDefinition implements CoerceOrConver @Override public GraphTargetItem getTargetType(AVM2ConstantPool constants, AVM2Instruction ins, List fullyQualifiedNames) { - return new TypeItem(new DottedChain("Object")); + return new TypeItem(DottedChain.OBJECT); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertSIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertSIns.java index 59a46683c..fac1d9ace 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertSIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertSIns.java @@ -57,6 +57,6 @@ public class ConvertSIns extends InstructionDefinition implements CoerceOrConver @Override public GraphTargetItem getTargetType(AVM2ConstantPool constants, AVM2Instruction ins, List fullyQualifiedNames) { - return new TypeItem(new DottedChain("String")); + return new TypeItem(DottedChain.STRING); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertUIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertUIns.java index a16eb0db8..0f5f53604 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertUIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertUIns.java @@ -56,6 +56,6 @@ public class ConvertUIns extends InstructionDefinition implements CoerceOrConver @Override public GraphTargetItem getTargetType(AVM2ConstantPool constants, AVM2Instruction ins, List fullyQualifiedNames) { - return new TypeItem(new DottedChain("uint")); + return new TypeItem(DottedChain.UINT); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AlchemyLoadAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AlchemyLoadAVM2Item.java index a414c99cc..d9acc90a8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AlchemyLoadAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AlchemyLoadAVM2Item.java @@ -87,9 +87,9 @@ public class AlchemyLoadAVM2Item extends AVM2Item { public GraphTargetItem returnType() { switch (type) { case 'i': - return new TypeItem(new DottedChain("int")); + return new TypeItem(DottedChain.INT); case 'f': - return new TypeItem(new DottedChain("Number")); + return new TypeItem(DottedChain.NUMBER); } return TypeItem.UNBOUNDED; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AlchemySignExtendAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AlchemySignExtendAVM2Item.java index 991bf68e1..ea770a025 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AlchemySignExtendAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AlchemySignExtendAVM2Item.java @@ -53,7 +53,7 @@ public class AlchemySignExtendAVM2Item extends AVM2Item { @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("int")); + return new TypeItem(DottedChain.INT); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/FindDefAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/FindDefAVM2Item.java index 1600d9270..47cc7867e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/FindDefAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/FindDefAVM2Item.java @@ -34,7 +34,7 @@ public class FindDefAVM2Item extends AVM2Item { @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) { - return writer.append(propertyName.getNamespace(localData.constantsAvm2).getName(localData.constantsAvm2, false).toPrintableString(true)); //assume not null name + return writer.append(propertyName.getNamespace(localData.constantsAvm2).getName(localData.constantsAvm2).toPrintableString(true)); //assume not null name } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java index 03d0b4ccb..7d678a69f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java @@ -73,7 +73,7 @@ public class FullMultinameAVM2Item extends AVM2Item { } else { Namespace ns = constants.getMultiname(multinameIndex).getNamespace(constants); if ((ns != null) && (ns.name_index != 0)) { - cns = ns.getName(constants, false).toPrintableString(true); + cns = ns.getName(constants).toPrintableString(true); } } return cname.equals("XML") && cns.isEmpty(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/IntegerValueAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/IntegerValueAVM2Item.java index 03599e588..f86c63e09 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/IntegerValueAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/IntegerValueAVM2Item.java @@ -74,7 +74,7 @@ public class IntegerValueAVM2Item extends NumberValueAVM2Item implements Integer @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("int")); + return new TypeItem(DottedChain.INT); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NanAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NanAVM2Item.java index da5cbe5db..7ea68e9fd 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NanAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NanAVM2Item.java @@ -49,7 +49,7 @@ public class NanAVM2Item extends AVM2Item { @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("Number")); + return new TypeItem(DottedChain.NUMBER); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java index a554381a4..dd6391799 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java @@ -98,7 +98,7 @@ public class NewFunctionAVM2Item extends AVM2Item { @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("Function")); + return new TypeItem(DottedChain.FUNCTION); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NewObjectAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NewObjectAVM2Item.java index 82694d8e8..5be4b4f32 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NewObjectAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NewObjectAVM2Item.java @@ -64,7 +64,7 @@ public class NewObjectAVM2Item extends AVM2Item { @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("Object")); + return new TypeItem(DottedChain.OBJECT); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NullAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NullAVM2Item.java index 3c2b441a4..637d7fdcb 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NullAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NullAVM2Item.java @@ -61,7 +61,7 @@ public class NullAVM2Item extends AVM2Item { @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("null")); + return new TypeItem(DottedChain.NULL); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/UndefinedAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/UndefinedAVM2Item.java index 6505d6ef1..c488463ef 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/UndefinedAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/UndefinedAVM2Item.java @@ -54,7 +54,7 @@ public class UndefinedAVM2Item extends AVM2Item { @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("Undefined")); + return new TypeItem(DottedChain.UNDEFINED); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/XMLAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/XMLAVM2Item.java index 123ff0405..f97b007f1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/XMLAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/XMLAVM2Item.java @@ -51,7 +51,7 @@ public class XMLAVM2Item extends AVM2Item { @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("XML")); + return new TypeItem(DottedChain.XML); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/DeclarationAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/DeclarationAVM2Item.java index 7800ad516..177fd8791 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/DeclarationAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/DeclarationAVM2Item.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.model.SetLocalAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.SetSlotAVM2Item; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.helpers.hilight.HighlightData; +import com.jpexs.decompiler.graph.DottedChain; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.LocalData; @@ -58,7 +59,7 @@ public class DeclarationAVM2Item extends AVM2Item { HighlightData srcData = getSrcData(); srcData.localName = localName; srcData.declaration = true; - srcData.declaredType = "*"; + srcData.declaredType = DottedChain.ALL; writer.append("var "); writer.append(localName); return writer; @@ -69,7 +70,7 @@ public class DeclarationAVM2Item extends AVM2Item { HighlightData srcData = getSrcData(); srcData.localName = sti.getNameAsStr(localData); srcData.declaration = true; - srcData.declaredType = "*"; + srcData.declaredType = DottedChain.ALL; writer.append("var "); sti.getName(writer, localData); return writer; @@ -89,7 +90,7 @@ public class DeclarationAVM2Item extends AVM2Item { if (lti.value instanceof ConvertAVM2Item) { coerType = ((ConvertAVM2Item) lti.value).type; } - srcData.declaredType = (coerType instanceof TypeItem) ? ((TypeItem) coerType).fullTypeName.toPrintableString(true) : "*"; + srcData.declaredType = (coerType instanceof TypeItem) ? ((TypeItem) coerType).fullTypeName : DottedChain.ALL; writer.append("var "); writer.append(localName); writer.append(":"); @@ -102,7 +103,7 @@ public class DeclarationAVM2Item extends AVM2Item { HighlightData srcData = getSrcData(); srcData.localName = ssti.getNameAsStr(localData); srcData.declaration = true; - srcData.declaredType = (type instanceof TypeItem) ? ((TypeItem) type).fullTypeName.toPrintableString(true) : "*"; + srcData.declaredType = (type instanceof TypeItem) ? ((TypeItem) type).fullTypeName : DottedChain.ALL; writer.append("var "); ssti.getName(writer, localData); writer.append(":"); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/TryAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/TryAVM2Item.java index 877ea7b1a..32ed9eaa6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/TryAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/TryAVM2Item.java @@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.helpers.hilight.HighlightData; import com.jpexs.decompiler.flash.helpers.hilight.HighlightSpecialType; import com.jpexs.decompiler.graph.Block; import com.jpexs.decompiler.graph.CompilationException; +import com.jpexs.decompiler.graph.DottedChain; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -92,7 +93,7 @@ public class TryAVM2Item extends AVM2Item implements Block { int eti = catchExceptions.get(e).type_index; - data.declaredType = eti <= 0 ? "*" : localData.constantsAvm2.constant_multiname.get(eti).getNameWithNamespace(localData.constantsAvm2).toPrintableString(true); + data.declaredType = eti <= 0 ? DottedChain.ALL : localData.constantsAvm2.constant_multiname.get(eti).getNameWithNamespace(localData.constantsAvm2); writer.hilightSpecial(localName, HighlightSpecialType.TRY_NAME, e, data); writer.append(":"); writer.hilightSpecial(catchExceptions.get(e).getTypeName(localData.constantsAvm2, localData.fullyQualifiedNames), HighlightSpecialType.TRY_TYPE, e); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DeletePropertyAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DeletePropertyAVM2Item.java index 3a61b1943..fc2a76564 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DeletePropertyAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DeletePropertyAVM2Item.java @@ -88,7 +88,7 @@ public class DeletePropertyAVM2Item extends AVM2Item { @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("Boolean")); + return new TypeItem(DottedChain.BOOLEAN); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/EqAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/EqAVM2Item.java index 42f364bec..99a31e159 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/EqAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/EqAVM2Item.java @@ -69,6 +69,6 @@ public class EqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("Boolean")); + return new TypeItem(DottedChain.BOOLEAN); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java index 86e31fb50..73f353ace 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java @@ -75,6 +75,6 @@ public class GeAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("Boolean")); + return new TypeItem(DottedChain.BOOLEAN); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java index 4dc3bec1f..f2d51939e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java @@ -68,6 +68,6 @@ public class GtAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("Boolean")); + return new TypeItem(DottedChain.BOOLEAN); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InAVM2Item.java index df7edf1e5..1e901e867 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InAVM2Item.java @@ -43,6 +43,6 @@ public class InAVM2Item extends BinaryOpItem { @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("Boolean")); + return new TypeItem(DottedChain.BOOLEAN); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InstanceOfAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InstanceOfAVM2Item.java index b472c97d5..a98653559 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InstanceOfAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InstanceOfAVM2Item.java @@ -43,6 +43,6 @@ public class InstanceOfAVM2Item extends BinaryOpItem { @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("Boolean")); + return new TypeItem(DottedChain.BOOLEAN); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java index 7bf7e70ed..4034f4311 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java @@ -43,6 +43,6 @@ public class IsTypeAVM2Item extends BinaryOpItem { @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("Boolean")); + return new TypeItem(DottedChain.BOOLEAN); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java index e65d2482b..ae2062b04 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java @@ -75,6 +75,6 @@ public class LeAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("Boolean")); + return new TypeItem(DottedChain.BOOLEAN); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java index a8b50a278..4b0d55c83 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java @@ -68,6 +68,6 @@ public class LtAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("Boolean")); + return new TypeItem(DottedChain.BOOLEAN); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NeqAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NeqAVM2Item.java index 344c4c8f0..518020d09 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NeqAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NeqAVM2Item.java @@ -70,6 +70,6 @@ public class NeqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfCondit @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("Boolean")); + return new TypeItem(DottedChain.BOOLEAN); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java index ac1ddc789..315489125 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java @@ -72,6 +72,6 @@ public class StrictEqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfC @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("Boolean")); + return new TypeItem(DottedChain.BOOLEAN); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java index 1024c1150..80bf7e953 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java @@ -73,6 +73,6 @@ public class StrictNeqAVM2Item extends BinaryOpItem implements LogicalOpItem, If @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("Boolean")); + return new TypeItem(DottedChain.BOOLEAN); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java index 77edde533..5cdca82f4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java @@ -1200,7 +1200,7 @@ public class AVM2SourceGenerator implements SourceGenerator { localData.currentClass = name; localData.pkg = pkg; if (extendsVal == null && !isInterface) { - extendsVal = new TypeItem(new DottedChain("Object")); + extendsVal = new TypeItem(DottedChain.OBJECT); } ParsedSymbol s = null; @@ -1898,7 +1898,7 @@ public class AVM2SourceGenerator implements SourceGenerator { if (t instanceof TraitSlotConst) { if (((TraitSlotConst) t).isNamespace()) { Namespace ns = a.constants.getNamespace(((TraitSlotConst) t).value_index); - return abc.constants.getNamespaceId(new Namespace(ns.kind, abc.constants.getStringId(ns.getName(a.constants, true), true)), 0, true); + return abc.constants.getNamespaceId(new Namespace(ns.kind, abc.constants.getStringId(ns.getName(a.constants), true)), 0, true); } } } @@ -2218,7 +2218,7 @@ public class AVM2SourceGenerator implements SourceGenerator { abc.constants.getMultinameId( new Multiname(Multiname.QNAME, abc.constants.getStringId(superName.getName(a.constants, null, true), true), - abc.constants.getNamespaceId(new Namespace(superName.getNamespace(a.constants).kind, abc.constants.getStringId(superName.getNamespace(a.constants).getName(a.constants, true), true)), 0, true), 0, 0, new ArrayList<>()), true) + abc.constants.getNamespaceId(new Namespace(superName.getNamespace(a.constants).kind, abc.constants.getStringId(superName.getNamespace(a.constants).getName(a.constants), true)), 0, true), 0, 0, new ArrayList<>()), true) ); } } @@ -2245,7 +2245,7 @@ public class AVM2SourceGenerator implements SourceGenerator { } } if (t instanceof TraitFunction) { - return new TypeItem(new DottedChain("Function")); + return new TypeItem(DottedChain.FUNCTION); } return TypeItem.UNBOUNDED; } @@ -2259,11 +2259,11 @@ public class AVM2SourceGenerator implements SourceGenerator { continue; } for (Trait t : ii.traits.traits) { - if (Objects.equals(pkg, t.getName(abc).getNamespace(abc.constants).getName(abc.constants, true))) { + if (Objects.equals(pkg, t.getName(abc).getNamespace(abc.constants).getName(abc.constants))) { if (propertyName.equals(t.getName(abc).getName(abc.constants, null, true))) { outName.setVal(obj); outNs.setVal(pkg); - outPropNs.setVal(t.getName(abc).getNamespace(abc.constants).getName(abc.constants, true)); + outPropNs.setVal(t.getName(abc).getNamespace(abc.constants).getName(abc.constants)); outPropNsKind.setVal(t.getName(abc).getNamespace(abc.constants).kind); outPropNsIndex.setVal(abc.constants.getNamespaceSubIndex(t.getName(abc).namespace_index)); outPropType.setVal(getTraitReturnType(abc, t)); @@ -2284,7 +2284,7 @@ public class AVM2SourceGenerator implements SourceGenerator { } Multiname clsName = ii.getName(abc.constants); if (obj.equals(clsName.getName(abc.constants, null, true))) { - if (Objects.equals(pkg, clsName.getNamespace(abc.constants).getName(abc.constants, true))) { + if (Objects.equals(pkg, clsName.getNamespace(abc.constants).getName(abc.constants))) { //class found for (Trait t : ii.instance_traits.traits) { @@ -2294,7 +2294,7 @@ public class AVM2SourceGenerator implements SourceGenerator { if (propertyName.equals(t.getName(abc).getName(abc.constants, null, true))) { outName.setVal(obj); outNs.setVal(pkg); - outPropNs.setVal(t.getName(abc).getNamespace(abc.constants).getName(abc.constants, true)); + outPropNs.setVal(t.getName(abc).getNamespace(abc.constants).getName(abc.constants)); outPropNsKind.setVal(t.getName(abc).getNamespace(abc.constants).kind); outPropNsIndex.setVal(abc.constants.getNamespaceSubIndex(t.getName(abc).namespace_index)); outPropType.setVal(getTraitReturnType(abc, t)); @@ -2314,7 +2314,7 @@ public class AVM2SourceGenerator implements SourceGenerator { if (propertyName.equals(t.getName(abc).getName(abc.constants, null, true))) { outName.setVal(obj); outNs.setVal(pkg); - outPropNs.setVal(t.getName(abc).getNamespace(abc.constants).getName(abc.constants, true)); + outPropNs.setVal(t.getName(abc).getNamespace(abc.constants).getName(abc.constants)); outPropNsKind.setVal(t.getName(abc).getNamespace(abc.constants).kind); outPropNsIndex.setVal(abc.constants.getNamespaceSubIndex(t.getName(abc).namespace_index)); outPropType.setVal(getTraitReturnType(abc, t)); @@ -2329,7 +2329,7 @@ public class AVM2SourceGenerator implements SourceGenerator { Multiname superName = abc.constants.constant_multiname.get(ii.super_index); if (superName != null) { - return searchPrototypeChain(instanceOnly, abcs, superName.getNamespace(abc.constants).getName(abc.constants, true), superName.getName(abc.constants, null, true), propertyName, outName, outNs, outPropNs, outPropNsKind, outPropNsIndex, outPropType, outPropValue); + return searchPrototypeChain(instanceOnly, abcs, superName.getNamespace(abc.constants).getName(abc.constants), superName.getName(abc.constants, null, true), propertyName, outName, outNs, outPropNs, outPropNsKind, outPropNsIndex, outPropType, outPropValue); } else { return false; } @@ -2343,7 +2343,7 @@ public class AVM2SourceGenerator implements SourceGenerator { public static void parentNames(ABC abc, List allABCs, int name_index, List indices, List names, List namespaces, List outABCs) { indices.add(name_index); names.add(abc.constants.constant_multiname.get(name_index).getName(abc.constants, null, true)); - namespaces.add(abc.constants.constant_multiname.get(name_index).getNamespace(abc.constants).getName(abc.constants, true).toRawString()); + namespaces.add(abc.constants.constant_multiname.get(name_index).getNamespace(abc.constants).getName(abc.constants).toRawString()); Multiname mname = abc.constants.constant_multiname.get(name_index); outABCs.add(abc); @@ -2357,7 +2357,7 @@ public class AVM2SourceGenerator implements SourceGenerator { Multiname m = a.constants.constant_multiname.get(a.instance_info.get(i).name_index); if (m.getName(a.constants, null, true).equals(mname.getName(abc.constants, null, true))) { - if (m.getNamespace(a.constants).hasName(mname.getNamespace(abc.constants).getName(abc.constants, true).toRawString(), a.constants)) { + if (m.getNamespace(a.constants).hasName(mname.getNamespace(abc.constants).getName(abc.constants).toRawString(), a.constants)) { //Multiname superName = a.constants.constant_multiname.get(a.instance_info.get(i).super_index); abcs.remove(a); if (a.instance_info.get(i).super_index != 0) { @@ -2458,7 +2458,7 @@ public class AVM2SourceGenerator implements SourceGenerator { for (int i = 1; i < abc.constants.constant_multiname.size(); i++) { Multiname mname = abc.constants.constant_multiname.get(i); if (mname != null && name.equals(mname.getName(abc.constants, null, true))) { - if (mname.getNamespace(abc.constants) != null && pkg.equals(mname.getNamespace(abc.constants).getName(abc.constants, true))) { + if (mname.getNamespace(abc.constants) != null && pkg.equals(mname.getNamespace(abc.constants).getName(abc.constants))) { name_index = i; break; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java index 780dc013b..03441596c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java @@ -164,7 +164,7 @@ public class ActionScript3Parser { if (s.type == SymbolType.MULTIPLY) { return new UnboundedTypeItem(); } else if (s.type == SymbolType.VOID) { - return new TypeItem(new DottedChain("void")); + return new TypeItem(DottedChain.VOID); } else { lexer.pushback(s); } @@ -824,7 +824,7 @@ public class ActionScript3Parser { lexer.pushback(s); } - ConstAVM2Item ns = new ConstAVM2Item(pkg, customAccess, true, namespace, nname, new TypeItem(new DottedChain("Namespace")), new StringAVM2Item(null, nval), lexer.yyline()); + ConstAVM2Item ns = new ConstAVM2Item(pkg, customAccess, true, namespace, nname, new TypeItem(DottedChain.NAMESPACE), new StringAVM2Item(null, nval), lexer.yyline()); traits.add(ns); break; case CONST: diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/FunctionAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/FunctionAVM2Item.java index d6df407d8..070117f0e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/FunctionAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/FunctionAVM2Item.java @@ -86,7 +86,7 @@ public class FunctionAVM2Item extends AVM2Item { @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("Function")); + return new TypeItem(DottedChain.FUNCTION); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespacedAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespacedAVM2Item.java index 85fc5bb56..a264d8cfc 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespacedAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespacedAVM2Item.java @@ -117,10 +117,10 @@ public class NamespacedAVM2Item extends AssignableAVM2Item { */ if (name != null) { return toSourceMerge(localData, generator, - ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem(new DottedChain("Namespace"))), + ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem(DottedChain.NAMESPACE)), ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAME, g.abc.constants.getStringId(name, true), 0, 0, 0, new ArrayList<>()), true)), dupSetTemp(localData, generator, name_temp), - ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem(new DottedChain("Namespace"))), + ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem(DottedChain.NAMESPACE)), dupSetTemp(localData, generator, ns_temp), //Start get original //getTemp(localData, generator, ns_temp), generateCoerce(generator, "Namespace"), ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAME, g.abc.constants.getStringId(variableName, true), 0, 0, 0, new ArrayList()), true)), @@ -169,8 +169,8 @@ public class NamespacedAVM2Item extends AssignableAVM2Item { if (name == null) { if (assignedValue != null) { return toSourceMerge(localData, generator, - obj == null ? ns : null, obj == null ? NameAVM2Item.generateCoerce(localData, generator, new TypeItem(new DottedChain("Namespace"))) : null, nameItem, ins(new ConvertSIns()), obj != null ? obj : ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAMEL, 0, 0, 0, 0, new ArrayList<>()), true)), - ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem(new DottedChain("Namespace"))), nameItem, ins(new ConvertSIns()), assignedValue, + obj == null ? ns : null, obj == null ? NameAVM2Item.generateCoerce(localData, generator, new TypeItem(DottedChain.NAMESPACE)) : null, nameItem, ins(new ConvertSIns()), obj != null ? obj : ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAMEL, 0, 0, 0, 0, new ArrayList<>()), true)), + ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem(DottedChain.NAMESPACE)), nameItem, ins(new ConvertSIns()), assignedValue, needsReturn ? dupSetTemp(localData, generator, ret_temp) : null, ins(new SetPropertyIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAMEL, 0, 0, 0, 0, new ArrayList<>()), true)), needsReturn ? getTemp(localData, generator, ret_temp) : null, @@ -178,9 +178,9 @@ public class NamespacedAVM2Item extends AssignableAVM2Item { ); } else { return toSourceMerge(localData, generator, - obj == null ? ns : null, obj == null ? NameAVM2Item.generateCoerce(localData, generator, new TypeItem(new DottedChain("Namespace"))) : null, nameItem, ins(new ConvertSIns()), obj != null ? obj : ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAMEL, 0, 0, 0, 0, new ArrayList<>()), true)), + obj == null ? ns : null, obj == null ? NameAVM2Item.generateCoerce(localData, generator, new TypeItem(DottedChain.NAMESPACE)) : null, nameItem, ins(new ConvertSIns()), obj != null ? obj : ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAMEL, 0, 0, 0, 0, new ArrayList<>()), true)), call ? dupSetTemp(localData, generator, obj_temp) : null, - ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem(new DottedChain("Namespace"))), nameItem, ins(new ConvertSIns()), + ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem(DottedChain.NAMESPACE)), nameItem, ins(new ConvertSIns()), construct ? callargs : null, ins(construct ? new ConstructPropIns() : delete ? new DeletePropertyIns() : new GetPropertyIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAMEL, 0, 0, 0, 0, new ArrayList<>()), true), construct ? callargs.size() : null), call ? getTemp(localData, generator, obj_temp) : null, @@ -193,8 +193,8 @@ public class NamespacedAVM2Item extends AssignableAVM2Item { } else { if (assignedValue != null) { return toSourceMerge(localData, generator, - obj == null ? ns : null, obj == null ? NameAVM2Item.generateCoerce(localData, generator, new TypeItem(new DottedChain("Namespace"))) : null, obj != null ? obj : ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(attr ? Multiname.RTQNAMEA : Multiname.RTQNAME, g.abc.constants.getStringId(name, true), 0, 0, 0, new ArrayList<>()), true)), - ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem(new DottedChain("Namespace"))), assignedValue, + obj == null ? ns : null, obj == null ? NameAVM2Item.generateCoerce(localData, generator, new TypeItem(DottedChain.NAMESPACE)) : null, obj != null ? obj : ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(attr ? Multiname.RTQNAMEA : Multiname.RTQNAME, g.abc.constants.getStringId(name, true), 0, 0, 0, new ArrayList<>()), true)), + ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem(DottedChain.NAMESPACE)), assignedValue, needsReturn ? dupSetTemp(localData, generator, ret_temp) : null, ins(new SetPropertyIns(), g.abc.constants.getMultinameId(new Multiname(attr ? Multiname.RTQNAMEA : Multiname.RTQNAME, g.abc.constants.getStringId(name, true), 0, 0, 0, new ArrayList<>()), true)), needsReturn ? getTemp(localData, generator, ret_temp) : null, @@ -202,9 +202,9 @@ public class NamespacedAVM2Item extends AssignableAVM2Item { ); } else { return toSourceMerge(localData, generator, - obj == null ? ns : null, obj == null ? NameAVM2Item.generateCoerce(localData, generator, new TypeItem(new DottedChain("Namespace"))) : null, obj != null ? obj : ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(attr ? Multiname.RTQNAMEA : Multiname.RTQNAME, g.abc.constants.getStringId(name, true), 0, 0, 0, new ArrayList<>()), true)), + obj == null ? ns : null, obj == null ? NameAVM2Item.generateCoerce(localData, generator, new TypeItem(DottedChain.NAMESPACE)) : null, obj != null ? obj : ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(attr ? Multiname.RTQNAMEA : Multiname.RTQNAME, g.abc.constants.getStringId(name, true), 0, 0, 0, new ArrayList<>()), true)), call ? dupSetTemp(localData, generator, obj_temp) : null, - ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem(new DottedChain("Namespace"))), + ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem(DottedChain.NAMESPACE)), construct ? callargs : null, ins(construct ? new ConstructPropIns() : delete ? new DeletePropertyIns() : new GetPropertyIns(), g.abc.constants.getMultinameId(new Multiname(attr ? Multiname.RTQNAMEA : Multiname.RTQNAME, g.abc.constants.getStringId(name, true), 0, 0, 0, new ArrayList<>()), true), construct ? callargs.size() : null), call ? getTemp(localData, generator, obj_temp) : null, diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java index fe6df1767..0385f7151 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java @@ -227,7 +227,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item { Reference outPropNsIndex = new Reference<>(0); Reference outPropType = new Reference<>(null); Reference outPropValue = new Reference<>(null); - if (AVM2SourceGenerator.searchPrototypeChain(false, abcs, m.getNamespace(a.constants).getName(a.constants, true), m.getName(a.constants, null, true), propertyName, outName, outNs, outPropNs, outPropNsKind, outPropNsIndex, outPropType, outPropValue)) { + if (AVM2SourceGenerator.searchPrototypeChain(false, abcs, m.getNamespace(a.constants).getName(a.constants), m.getName(a.constants, null, true), propertyName, outName, outNs, outPropNs, outPropNsKind, outPropNsIndex, outPropType, outPropValue)) { objType = new TypeItem("".equals(outNs.getVal()) ? outName.getVal() : outNs.getVal() + "." + outName.getVal()); propType = outPropType.getVal(); propIndex = abc.constants.getMultinameId(new Multiname(Multiname.QNAME, @@ -250,7 +250,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item { if (t.getName(abc).getName(abc.constants, null, true).equals(propertyName)) { if (t instanceof TraitSlotConst) { TraitSlotConst tsc = (TraitSlotConst) t; - objType = new TypeItem(new DottedChain("Function")); + objType = new TypeItem(DottedChain.FUNCTION); propType = multinameToType(tsc.type_index, abc.constants); propIndex = tsc.name_index; if (!localData.traitUsages.containsKey(b)) { @@ -266,7 +266,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item { for (int i = 0; i < openedNamespaces.size(); i++) { int nsindex = openedNamespaces.get(i); int nsKind = abc.constants.constant_namespace.get(openedNamespaces.get(i)).kind; - DottedChain nsname = abc.constants.constant_namespace.get(openedNamespaces.get(i)).getName(abc.constants, true); + DottedChain nsname = abc.constants.constant_namespace.get(openedNamespaces.get(i)).getName(abc.constants); int name_index = 0; for (int m = 1; m < abc.constants.constant_multiname.size(); m++) { Multiname mname = abc.constants.constant_multiname.get(m); @@ -312,7 +312,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item { } for (Trait t : si.traits.traits) { if (t.name_index == name_index) { - objType = new TypeItem(new DottedChain("Object")); + objType = new TypeItem(DottedChain.OBJECT); propType = AVM2SourceGenerator.getTraitReturnType(abc, t); propIndex = t.name_index; if (t instanceof TraitSlotConst) { @@ -336,7 +336,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item { continue; } Multiname n = a.constants.constant_multiname.get(ii.name_index); - if (n.getNamespace(a.constants).kind == Namespace.KIND_PACKAGE && n.getNamespace(a.constants).getName(a.constants, true).equals(nsname)) { + if (n.getNamespace(a.constants).kind == Namespace.KIND_PACKAGE && n.getNamespace(a.constants).getName(a.constants).equals(nsname)) { Reference outName = new Reference<>(""); Reference outNs = new Reference<>(DottedChain.EMPTY); Reference outPropNs = new Reference<>(DottedChain.EMPTY); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/UnresolvedAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/UnresolvedAVM2Item.java index 4d3014aa1..9d71abbf7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/UnresolvedAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/UnresolvedAVM2Item.java @@ -382,7 +382,7 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item { continue; } if ((a.instance_info.get(c).getName(a.constants) != null && a == abc && a.instance_info.get(c).getName(a.constants).namespace_index == ni) - || (ons.kind != Namespace.KIND_PRIVATE && a.instance_info.get(c).getName(a.constants) != null && a.instance_info.get(c).getName(a.constants).getNamespace(a.constants) != null && a.instance_info.get(c).getName(a.constants).getNamespace(a.constants).hasName(ons.getName(abc.constants, true).toRawString(), a.constants))) { + || (ons.kind != Namespace.KIND_PRIVATE && a.instance_info.get(c).getName(a.constants) != null && a.instance_info.get(c).getName(a.constants).getNamespace(a.constants) != null && a.instance_info.get(c).getName(a.constants).getNamespace(a.constants).hasName(ons.getName(abc.constants).toRawString(), a.constants))) { String cname = a.instance_info.get(c).getName(a.constants).getName(a.constants, null, true); if (name.get(0).equals(cname)) { if (!subtypes.isEmpty() && name.size() > 1) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/XMLAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/XMLAVM2Item.java index 169dda052..f76d5d811 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/XMLAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/XMLAVM2Item.java @@ -55,7 +55,7 @@ public class XMLAVM2Item extends AVM2Item { @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("XML")); + return new TypeItem(DottedChain.XML); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/XMLFilterAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/XMLFilterAVM2Item.java index b0b3eec3b..e3a240292 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/XMLFilterAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/XMLFilterAVM2Item.java @@ -56,7 +56,7 @@ public class XMLFilterAVM2Item extends AVM2Item { @Override public GraphTargetItem returnType() { - return new TypeItem(new DottedChain("String")); + return new TypeItem(DottedChain.STRING); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java index dda32b07e..2756f6f1f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java @@ -309,9 +309,9 @@ public class MethodInfo { if (i > 0) { writer.appendNoHilight(", "); } - String ptype = "*"; + DottedChain ptype = DottedChain.ALL; if (param_types[i] > 0) { - ptype = constants.getMultiname(param_types[i]).getNameWithNamespace(constants).toPrintableString(true); + ptype = constants.getMultiname(param_types[i]).getNameWithNamespace(constants); } HighlightData pdata = new HighlightData(); @@ -356,7 +356,7 @@ public class MethodInfo { HighlightData pdata = new HighlightData(); pdata.declaration = true; - pdata.declaredType = "*"; + pdata.declaredType = DottedChain.ALL; pdata.localName = restName; writer.append(restAdd); writer.hilightSpecial(restName, HighlightSpecialType.FLAG_NEED_REST, 0, pdata); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Multiname.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Multiname.java index 477451686..e770a2cc4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Multiname.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Multiname.java @@ -188,7 +188,7 @@ public class Multiname { } int type = constants.getNamespace(index).kind; int name_index = constants.getNamespace(index).name_index; - String name = name_index == 0 ? null : constants.getNamespace(index).getName(constants, true).toRawString(); + String name = name_index == 0 ? null : constants.getNamespace(index).getName(constants).toRawString(); int sub = -1; for (int n = 1; n < constants.getNamespaceCount(); n++) { if (constants.getNamespace(n).kind == type && constants.getNamespace(n).name_index == name_index) { @@ -305,7 +305,7 @@ public class Multiname { Namespace ns = getNamespace(constants); String name = getName(constants, null, true); if (ns != null) { - return ns.getName(constants, true).add(name); + return ns.getName(constants).add(name); } return new DottedChain(name); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Namespace.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Namespace.java index 3c9556e68..b345e8f78 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Namespace.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Namespace.java @@ -94,7 +94,7 @@ public class Namespace { } public String toString(AVM2ConstantPool constants) { - return getName(constants, false).toPrintableString(true); + return getName(constants).toPrintableString(true); } public String getNameWithKind(AVM2ConstantPool constants) { @@ -114,7 +114,7 @@ public class Namespace { return kindStr; } - public DottedChain getName(AVM2ConstantPool constants, boolean raw) { + public DottedChain getName(AVM2ConstantPool constants) { if (name_index == 0) { return DottedChain.EMPTY; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java index b1c95340a..4b7c59119 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java @@ -73,7 +73,7 @@ public class ScriptInfo { Namespace ns = name.getNamespace(abc.constants); if ((ns.kind == Namespace.KIND_PACKAGE_INTERNAL) || (ns.kind == Namespace.KIND_PACKAGE)) { - DottedChain packageName = ns.getName(abc.constants, false); // assume not null package + DottedChain packageName = ns.getName(abc.constants); // assume not null package String objectName = name.getName(abc.constants, null, false); List traitIndices = new ArrayList<>(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ValueKind.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ValueKind.java index 9993a2bb6..7021972d7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ValueKind.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ValueKind.java @@ -157,7 +157,7 @@ public class ValueKind { case CONSTANT_ExplicitNamespace: case CONSTANT_StaticProtectedNs: case CONSTANT_PrivateNs: - ret = "\"" + constants.getNamespace(value_index).getName(constants, true).toRawString() + "\""; //assume not null name + ret = "\"" + constants.getNamespace(value_index).getName(constants).toRawString() + "\""; //assume not null name break; } return ret; @@ -199,7 +199,7 @@ public class ValueKind { case CONSTANT_ExplicitNamespace: case CONSTANT_StaticProtectedNs: case CONSTANT_PrivateNs: - ret = constants.getNamespace(value_index).getKindStr() + "(\"" + constants.getNamespace(value_index).getName(constants, true) + "\")"; //assume not null name + ret = constants.getNamespace(value_index).getKindStr() + "(\"" + constants.getNamespace(value_index).getName(constants).toRawString() + "\")"; //assume not null name break; } return ret; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java index 23c90a3ec..1308fbd00 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java @@ -79,7 +79,7 @@ public abstract class Trait implements Cloneable, Serializable { if (m.namespace_index == -1) { break; } - DottedChain dc = abcTag.getABC().nsValueToName(abc.constants.getNamespace(m.namespace_index).getName(abc.constants, true)); + DottedChain dc = abcTag.getABC().nsValueToName(abc.constants.getNamespace(m.namespace_index).getName(abc.constants)); nsname = dc.getLast(); if (nsname == null) { @@ -140,7 +140,7 @@ public abstract class Trait implements Cloneable, Serializable { public GraphTextWriter toStringPackaged(Trait parent, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException { Namespace ns = abc.constants.getMultiname(name_index).getNamespace(abc.constants); if ((ns.kind == Namespace.KIND_PACKAGE) || (ns.kind == Namespace.KIND_PACKAGE_INTERNAL)) { - String nsname = ns.getName(abc.constants, false).toPrintableString(true); + String nsname = ns.getName(abc.constants).toPrintableString(true); writer.appendNoHilight("package"); if (!nsname.isEmpty()) { writer.appendNoHilight(" " + nsname); //assume not null name @@ -156,7 +156,7 @@ public abstract class Trait implements Cloneable, Serializable { public void convertPackaged(Trait parent, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException { Namespace ns = abc.constants.getMultiname(name_index).getNamespace(abc.constants); if ((ns.kind == Namespace.KIND_PACKAGE) || (ns.kind == Namespace.KIND_PACKAGE_INTERNAL)) { - String nsname = ns.getName(abc.constants, false).toPrintableString(true); + String nsname = ns.getName(abc.constants).toPrintableString(true); convert(parent, path + nsname, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel); } } @@ -183,7 +183,7 @@ public abstract class Trait implements Cloneable, Serializable { public ClassPath getPath(ABC abc) { Multiname name = getName(abc); Namespace ns = name.getNamespace(abc.constants); - DottedChain packageName = ns.getName(abc.constants, false); + DottedChain packageName = ns.getName(abc.constants); String objectName = name.getName(abc.constants, null, true); return new ClassPath(packageName, objectName); //assume not null name } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java index 6d38d1080..870966d97 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java @@ -102,7 +102,7 @@ public class TraitClass extends Trait implements TraitWithSlot { name = "*"; } boolean raw = ns.kind == Namespace.KIND_NAMESPACE; - DottedChain newimport = ns.getName(abc.constants, raw); + DottedChain newimport = ns.getName(abc.constants); /*if ((ns.kind != Namespace.KIND_PACKAGE) && (ns.kind != Namespace.KIND_NAMESPACE) && (ns.kind != Namespace.KIND_STATIC_PROTECTED)) { @@ -167,7 +167,7 @@ public class TraitClass extends Trait implements TraitWithSlot { if (name.isEmpty()) { name = "*"; } - DottedChain newimport = ns.getName(abc.constants, false); + DottedChain newimport = ns.getName(abc.constants); if (parseUsagesFromNS(abc, imports, uses, namespace_index, ignorePackage, name)) { return; } else if ((ns.kind != Namespace.KIND_PACKAGE) && (ns.kind != Namespace.KIND_PACKAGE_INTERNAL)) { @@ -334,7 +334,7 @@ public class TraitClass extends Trait implements TraitWithSlot { ClassInfo classInfo = abc.class_info.get(class_info); InstanceInfo instanceInfo = abc.instance_info.get(class_info); - DottedChain packageName = instanceInfo.getName(abc.constants).getNamespace(abc.constants).getName(abc.constants, false); //assume not null name + DottedChain packageName = instanceInfo.getName(abc.constants).getNamespace(abc.constants).getName(abc.constants); //assume not null name parseImportsUsagesFromMultiname(abc, imports, uses, abc.constants.getMultiname(instanceInfo.name_index), packageName, fullyQualifiedNames); @@ -375,7 +375,7 @@ public class TraitClass extends Trait implements TraitWithSlot { InstanceInfo instanceInfo = abc.instance_info.get(class_info); Multiname instanceInfoMultiname = instanceInfo.getName(abc.constants); String instanceInfoName = instanceInfoMultiname.getName(abc.constants, fullyQualifiedNames, false); - DottedChain packageName = instanceInfoMultiname.getNamespace(abc.constants).getName(abc.constants, false); //assume not null name + DottedChain packageName = instanceInfoMultiname.getNamespace(abc.constants).getName(abc.constants); //assume not null name List namesInThisPackage = new ArrayList<>(); for (ABCContainerTag tag : abc.getAbcTags()) { for (ScriptInfo si : tag.getABC().script_info) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/hilight/HighlightData.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/hilight/HighlightData.java index 3733e2360..817b533e7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/hilight/HighlightData.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/hilight/HighlightData.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.helpers.hilight; +import com.jpexs.decompiler.graph.DottedChain; import java.io.Serializable; /** @@ -26,7 +27,7 @@ public class HighlightData implements Cloneable, Serializable { public boolean declaration; - public String declaredType; + public DottedChain declaredType; public String localName; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/DottedChain.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/DottedChain.java index adc809f6d..ae2a47ffb 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/DottedChain.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/DottedChain.java @@ -32,58 +32,102 @@ public class DottedChain implements Serializable { public static final DottedChain EMPTY = new DottedChain(); + public static final DottedChain BOOLEAN = new DottedChain("Boolean"); + + public static final DottedChain STRING = new DottedChain("String"); + + public static final DottedChain ARRAY = new DottedChain("Array"); + + public static final DottedChain NUMBER = new DottedChain("Number"); + + public static final DottedChain OBJECT = new DottedChain("Object"); + + public static final DottedChain INT = new DottedChain("int"); + + public static final DottedChain UINT = new DottedChain("uint"); + + public static final DottedChain UNDEFINED = new DottedChain("Undefined"); + + public static final DottedChain XML = new DottedChain("XML"); + + public static final DottedChain NULL = new DottedChain("null"); + + public static final DottedChain FUNCTION = new DottedChain("Function"); + + public static final DottedChain VOID = new DottedChain("void"); + + public static final DottedChain NAMESPACE = new DottedChain("Namespace"); + + public static final DottedChain ALL = new DottedChain("*"); + private final String[] parts; + private final int length; + private final int hash; public DottedChain(List parts) { - this.parts = parts.toArray(new String[parts.size()]); + length = parts.size(); + this.parts = parts.toArray(new String[length]); hash = calcHash(); } public DottedChain(String... parts) { + length = parts.length; + this.parts = parts; + hash = calcHash(); + } + + private DottedChain(String[] parts, int length) { + this.length = length; this.parts = parts; hash = calcHash(); } public boolean isEmpty() { - return parts.length == 0; + return length == 0; } public int size() { - return parts.length; + return length; } public String get(int index) { + if (index >= length) { + throw new ArrayIndexOutOfBoundsException(); + } + return parts[index]; } public DottedChain subChain(int count) { - String[] nparts = Arrays.copyOfRange(parts, 0, count); - return new DottedChain(nparts); + if (count > length) { + throw new ArrayIndexOutOfBoundsException(); + } + + return new DottedChain(parts, count); } public String getLast() { - if (parts.length == 0) { + if (length == 0) { return ""; } else { - return parts[parts.length - 1]; + return parts[length - 1]; } } public DottedChain getWithoutLast() { - if (parts.length < 2) { + if (length < 2) { return EMPTY; } - String[] nparts = Arrays.copyOfRange(parts, 0, parts.length - 1); - return new DottedChain(nparts); + return new DottedChain(parts, length - 1); } public DottedChain add(String name) { - String[] nparts = new String[parts.length + 1]; - if (parts.length > 0) { - System.arraycopy(parts, 0, nparts, 0, parts.length); + String[] nparts = new String[length + 1]; + if (length > 0) { + System.arraycopy(parts, 0, nparts, 0, length); } nparts[nparts.length - 1] = name; @@ -91,30 +135,30 @@ public class DottedChain implements Serializable { } private String toString(boolean as3, boolean raw) { - if (parts.length == 0 || (parts.length == 1 && parts[0].isEmpty())) { + if (length == 0) { return ""; } StringBuilder ret = new StringBuilder(); - for (int i = 0; i < parts.length; i++) { + for (int i = 0; i < length; i++) { if (i > 0) { ret.append("."); } String part = parts[i]; - boolean lastStar = i == parts.length - 1 && "*".equals(part); + boolean lastStar = i == length - 1 && "*".equals(part); ret.append((raw || lastStar) ? part : IdentifiersDeobfuscation.printIdentifier(as3, part)); } return ret.toString(); } public String toFilePath() { - if (parts.length == 0 || (parts.length == 1 && parts[0].isEmpty())) { + if (length == 0) { return ""; } StringBuilder ret = new StringBuilder(); - for (int i = 0; i < parts.length; i++) { + for (int i = 0; i < length; i++) { if (i > 0) { ret.append(File.separator); } @@ -147,10 +191,12 @@ public class DottedChain implements Serializable { } private int calcHash() { - if (parts.length > 0 && parts[0].equals("ยงยง")) { - int a = 1; + int result = 1; + for (int i = 0; i < length; i++) { + result = 31 * result + parts[i].hashCode(); } - return Arrays.hashCode(parts); + + return result; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TypeItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TypeItem.java index 880eb0ede..1ec2c2e1c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TypeItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TypeItem.java @@ -32,11 +32,11 @@ import java.util.Objects; */ public class TypeItem extends GraphTargetItem { - public static TypeItem BOOLEAN = new TypeItem(new DottedChain("Boolean")); + public static TypeItem BOOLEAN = new TypeItem(DottedChain.BOOLEAN); - public static TypeItem STRING = new TypeItem(new DottedChain("String")); + public static TypeItem STRING = new TypeItem(DottedChain.STRING); - public static TypeItem ARRAY = new TypeItem(new DottedChain("Array")); + public static TypeItem ARRAY = new TypeItem(DottedChain.ARRAY); public static UnboundedTypeItem UNBOUNDED = new UnboundedTypeItem(); diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3Test.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3Test.java index ab3aff734..6d3f41161 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3Test.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3Test.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter; import com.jpexs.decompiler.flash.helpers.NulWriter; import com.jpexs.decompiler.flash.tags.DoABC2Tag; import com.jpexs.decompiler.flash.tags.Tag; +import com.jpexs.decompiler.graph.DottedChain; import com.jpexs.decompiler.graph.ScopeStack; import java.io.BufferedInputStream; import java.io.FileInputStream; @@ -60,7 +61,7 @@ public class ActionScript3Test extends ActionScriptTestBase { } } assertNotNull(tag); - clsIndex = tag.getABC().findClassByName("classes.Test"); + clsIndex = tag.getABC().findClassByName(new DottedChain("classes", "Test")); assertTrue(clsIndex > -1); this.abc = tag.getABC(); Configuration.autoDeobfuscate.set(false); diff --git a/src/com/jpexs/decompiler/flash/gui/debugger/DebuggerTools.java b/src/com/jpexs/decompiler/flash/gui/debugger/DebuggerTools.java index 179f51838..80805407d 100644 --- a/src/com/jpexs/decompiler/flash/gui/debugger/DebuggerTools.java +++ b/src/com/jpexs/decompiler/flash/gui/debugger/DebuggerTools.java @@ -93,7 +93,7 @@ public class DebuggerTools { ABC a = ct.getABC(); for (int i = 1; i < a.constants.constant_multiname.size(); i++) { Multiname m = a.constants.constant_multiname.get(i); - if ("trace".equals(m.getNameWithNamespace(a.constants).toString())) { + if ("trace".equals(m.getNameWithNamespace(a.constants).toRawString())) { m.namespace_index = a.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, a.constants.getStringId(debuggerPkg, true)), 0, true); m.name_index = a.constants.getStringId(fname, true); ((Tag) ct).setModified(true);