mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-14 22:41:53 +00:00
imports & code formatting 2
This commit is contained in:
@@ -694,7 +694,7 @@ public class ABC {
|
||||
|
||||
public MethodBody findBodyByClassAndName(String className, String methodName) {
|
||||
for (int i = 0; i < instance_info.size(); i++) {
|
||||
if (className.equals(constants.getMultiname(instance_info.get(i).name_index).getName(constants, new ArrayList<String>(),true))) {
|
||||
if (className.equals(constants.getMultiname(instance_info.get(i).name_index).getName(constants, new ArrayList<String>(), true))) {
|
||||
for (Trait t : instance_info.get(i).instance_traits.traits) {
|
||||
if (t instanceof TraitMethodGetterSetter) {
|
||||
TraitMethodGetterSetter t2 = (TraitMethodGetterSetter) t;
|
||||
|
||||
@@ -1465,7 +1465,7 @@ public class AVM2Code implements Serializable {
|
||||
if (code.get(ip + plus + 2).definition instanceof SwapIns) {
|
||||
if (code.get(ip + plus + 4).definition instanceof PopScopeIns) {
|
||||
if (code.get(ip + plus + 3).definition instanceof SetPropertyIns) {
|
||||
functionName = abc.constants.getMultiname(code.get(ip + plus + 3).operands[0]).getName(constants, fullyQualifiedNames,true);
|
||||
functionName = abc.constants.getMultiname(code.get(ip + plus + 3).operands[0]).getName(constants, fullyQualifiedNames, true);
|
||||
scopeStack.pop();//with
|
||||
output.remove(output.size() - 1); //with
|
||||
ip = ip + plus + 4; //+1 below
|
||||
|
||||
@@ -20,12 +20,9 @@ import com.jpexs.decompiler.flash.abc.types.Decimal;
|
||||
import com.jpexs.decompiler.flash.abc.types.Multiname;
|
||||
import com.jpexs.decompiler.flash.abc.types.Namespace;
|
||||
import com.jpexs.decompiler.flash.abc.types.NamespaceSet;
|
||||
import com.jpexs.decompiler.flash.action.Deobfuscation;
|
||||
import com.jpexs.helpers.utf8.Utf8PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ConstantPool {
|
||||
|
||||
@@ -38,7 +35,7 @@ public class ConstantPool {
|
||||
public List<Namespace> constant_namespace = new ArrayList<>();
|
||||
public List<NamespaceSet> constant_namespace_set = new ArrayList<>();
|
||||
public List<Multiname> constant_multiname = new ArrayList<>();
|
||||
|
||||
|
||||
public synchronized int addInt(long value) {
|
||||
constant_int.add(value);
|
||||
return constant_int.size() - 1;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -109,7 +109,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
|
||||
}
|
||||
return new ApplyTypeAVM2Item(null, obj, params);
|
||||
} else {
|
||||
return new TypeItem(m.getNameWithNamespace(constants,true));
|
||||
return new TypeItem(m.getNameWithNamespace(constants, true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
|
||||
Reference<Integer> outPropNsIndex = new Reference<>(0);
|
||||
Reference<GraphTargetItem> outPropType = new Reference<>(null);
|
||||
Reference<ValueKind> outPropValue = new Reference<>(null);
|
||||
if (AVM2SourceGenerator.searchPrototypeChain(false, abcs, m.getNamespace(a.constants).getName(a.constants), m.getName(a.constants, new ArrayList<String>(),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, new ArrayList<String>(), 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,
|
||||
@@ -239,7 +239,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
|
||||
for (MethodBody b : callStack) {
|
||||
for (int i = 0; i < b.traits.traits.size(); i++) {
|
||||
Trait t = b.traits.traits.get(i);
|
||||
if (t.getName(abc).getName(abc.constants, new ArrayList<String>(),true).equals(propertyName)) {
|
||||
if (t.getName(abc).getName(abc.constants, new ArrayList<String>(), true).equals(propertyName)) {
|
||||
if (t instanceof TraitSlotConst) {
|
||||
TraitSlotConst tsc = (TraitSlotConst) t;
|
||||
objType = new TypeItem("Function");
|
||||
@@ -262,7 +262,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
|
||||
int name_index = 0;
|
||||
for (int m = 1; m < abc.constants.constant_multiname.size(); m++) {
|
||||
Multiname mname = abc.constants.constant_multiname.get(m);
|
||||
if (mname.kind == Multiname.QNAME && mname.getName(abc.constants, new ArrayList<String>(),true).equals(propertyName) && mname.namespace_index == nsindex) {
|
||||
if (mname.kind == Multiname.QNAME && mname.getName(abc.constants, new ArrayList<String>(), true).equals(propertyName) && mname.namespace_index == nsindex) {
|
||||
name_index = m;
|
||||
break;
|
||||
}
|
||||
@@ -337,7 +337,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
|
||||
Reference<GraphTargetItem> outPropType = new Reference<>(null);
|
||||
Reference<ValueKind> outPropValue = new Reference<>(null);
|
||||
|
||||
if (propertyName != null && AVM2SourceGenerator.searchPrototypeChain(false, abcs, nsname, n.getName(a.constants, new ArrayList<String>(),true), propertyName, outName, outNs, outPropNs, outPropNsKind, outPropNsIndex, outPropType, outPropValue)) {
|
||||
if (propertyName != null && AVM2SourceGenerator.searchPrototypeChain(false, abcs, nsname, n.getName(a.constants, new ArrayList<String>(), 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,
|
||||
|
||||
@@ -364,7 +364,7 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
|
||||
if (a.instance_info.get(c).deleted) {
|
||||
continue;
|
||||
}
|
||||
if (a.instance_info.get(c).name_index > 0 && fname.equals(a.instance_info.get(c).getName(a.constants).getNameWithNamespace(a.constants,true))) {
|
||||
if (a.instance_info.get(c).name_index > 0 && fname.equals(a.instance_info.get(c).getName(a.constants).getNameWithNamespace(a.constants, true))) {
|
||||
if (!subtypes.isEmpty() && parts.size() > i + 1) {
|
||||
continue;
|
||||
}
|
||||
@@ -408,12 +408,12 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
|
||||
}
|
||||
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), a.constants))) {
|
||||
String cname = a.instance_info.get(c).getName(a.constants).getName(a.constants, new ArrayList<String>(),true);
|
||||
String cname = a.instance_info.get(c).getName(a.constants).getName(a.constants, new ArrayList<String>(), true);
|
||||
if (parts.get(0).equals(cname)) {
|
||||
if (!subtypes.isEmpty() && parts.size() > 1) {
|
||||
continue;
|
||||
}
|
||||
TypeItem ret = new TypeItem(a.instance_info.get(c).getName(a.constants).getNameWithNamespace(a.constants,true));
|
||||
TypeItem ret = new TypeItem(a.instance_info.get(c).getName(a.constants).getNameWithNamespace(a.constants, true));
|
||||
/*for (String s : subtypes) {
|
||||
UnresolvedAVM2Item su = new UnresolvedAVM2Item(new ArrayList<String>(), importedClasses, true, null, line, s, null, openedNamespaces);
|
||||
su.resolve(thisType, paramTypes, paramNames, abc, otherAbcs, callStack, variables);
|
||||
|
||||
@@ -56,13 +56,13 @@ public class ABCException implements Serializable {
|
||||
if (name_index == 0) {
|
||||
return "";
|
||||
}
|
||||
return constants.getMultiname(name_index).getName(constants, fullyQualifiedNames,false);
|
||||
return constants.getMultiname(name_index).getName(constants, fullyQualifiedNames, false);
|
||||
}
|
||||
|
||||
public String getTypeName(ConstantPool constants, List<String> fullyQualifiedNames) {
|
||||
if (type_index == 0) {
|
||||
return "*";
|
||||
}
|
||||
return constants.getMultiname(type_index).getName(constants, fullyQualifiedNames,false);
|
||||
return constants.getMultiname(type_index).getName(constants, fullyQualifiedNames, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class InstanceInfo {
|
||||
public String getClassHeaderStr(ABC abc, List<String> fullyQualifiedNames) {
|
||||
String supIndexStr = "";
|
||||
if (super_index > 0) {
|
||||
supIndexStr = " extends " + abc.constants.getMultiname(super_index).getName(abc.constants, fullyQualifiedNames,false);////+" flags="+flags+" protectedNS="+protectedNS+" interfaces="+Helper.intArrToString(interfaces)+" method_index="+iinit_index
|
||||
supIndexStr = " extends " + abc.constants.getMultiname(super_index).getName(abc.constants, fullyQualifiedNames, false);////+" flags="+flags+" protectedNS="+protectedNS+" interfaces="+Helper.intArrToString(interfaces)+" method_index="+iinit_index
|
||||
}
|
||||
String implStr = "";
|
||||
if (interfaces.length > 0) {
|
||||
@@ -68,7 +68,7 @@ public class InstanceInfo {
|
||||
if (i > 0) {
|
||||
implStr += ", ";
|
||||
}
|
||||
implStr += abc.constants.getMultiname(interfaces[i]).getName(abc.constants, fullyQualifiedNames,false);
|
||||
implStr += abc.constants.getMultiname(interfaces[i]).getName(abc.constants, fullyQualifiedNames, false);
|
||||
}
|
||||
}
|
||||
String modifiers;
|
||||
@@ -88,7 +88,7 @@ public class InstanceInfo {
|
||||
if (isInterface()) {
|
||||
objType = "interface ";
|
||||
}
|
||||
return modifiers + objType + abc.constants.getMultiname(name_index).getName(abc.constants, new ArrayList<String>()/* No full names here*/,false) + supIndexStr + implStr;
|
||||
return modifiers + objType + abc.constants.getMultiname(name_index).getName(abc.constants, new ArrayList<String>()/* No full names here*/, false) + supIndexStr + implStr;
|
||||
}
|
||||
|
||||
public Multiname getName(ConstantPool constants) {
|
||||
|
||||
@@ -286,7 +286,7 @@ public class MethodInfo {
|
||||
if (param_types[i] == 0) {
|
||||
writer.hilightSpecial("*", "param", i);
|
||||
} else {
|
||||
writer.hilightSpecial(constants.getMultiname(param_types[i]).getName(constants, fullyQualifiedNames,false), "param", i);
|
||||
writer.hilightSpecial(constants.getMultiname(param_types[i]).getName(constants, fullyQualifiedNames, false), "param", i);
|
||||
}
|
||||
if (optional != null) {
|
||||
if (i >= param_types.length - optional.length) {
|
||||
@@ -313,7 +313,7 @@ public class MethodInfo {
|
||||
}
|
||||
|
||||
public GraphTextWriter getReturnTypeStr(GraphTextWriter writer, ConstantPool constants, List<String> fullyQualifiedNames) {
|
||||
return writer.hilightSpecial(ret_type == 0 ? "*" : constants.getMultiname(ret_type).getName(constants, fullyQualifiedNames,false), "returns");
|
||||
return writer.hilightSpecial(ret_type == 0 ? "*" : constants.getMultiname(ret_type).getName(constants, fullyQualifiedNames, false), "returns");
|
||||
}
|
||||
|
||||
public void setBody(MethodBody body) {
|
||||
|
||||
@@ -232,7 +232,7 @@ public class Multiname {
|
||||
if (constants.getMultiname(qname_index).name_index == name_index) {
|
||||
return "ambiguousTypeName";
|
||||
}
|
||||
String typeNameStr = constants.getMultiname(qname_index).getName(constants, fullyQualifiedNames,raw);
|
||||
String typeNameStr = constants.getMultiname(qname_index).getName(constants, fullyQualifiedNames, raw);
|
||||
if (!params.isEmpty()) {
|
||||
typeNameStr += ".<";
|
||||
for (int i = 0; i < params.size(); i++) {
|
||||
@@ -242,7 +242,7 @@ public class Multiname {
|
||||
if (params.get(i) == 0) {
|
||||
typeNameStr += "*";
|
||||
} else {
|
||||
typeNameStr += constants.getMultiname(params.get(i)).getName(constants, fullyQualifiedNames,raw);
|
||||
typeNameStr += constants.getMultiname(params.get(i)).getName(constants, fullyQualifiedNames, raw);
|
||||
}
|
||||
}
|
||||
typeNameStr += ">";
|
||||
@@ -252,7 +252,7 @@ public class Multiname {
|
||||
|
||||
public String getName(ConstantPool constants, List<String> fullyQualifiedNames, boolean raw) {
|
||||
if (kind == TYPENAME) {
|
||||
return typeNameToStr(constants, fullyQualifiedNames,raw);
|
||||
return typeNameToStr(constants, fullyQualifiedNames, raw);
|
||||
}
|
||||
if (name_index == -1) {
|
||||
return "";
|
||||
@@ -262,13 +262,13 @@ public class Multiname {
|
||||
} else {
|
||||
String name = constants.getString(name_index);
|
||||
if ((fullyQualifiedNames != null) && fullyQualifiedNames.contains(name)) {
|
||||
return getNameWithNamespace(constants,raw);
|
||||
return getNameWithNamespace(constants, raw);
|
||||
}
|
||||
return (isAttribute() ? "@" : "") + (raw?name:Deobfuscation.printIdentifier(name));
|
||||
return (isAttribute() ? "@" : "") + (raw ? name : Deobfuscation.printIdentifier(name));
|
||||
}
|
||||
}
|
||||
|
||||
public String getNameWithNamespace(ConstantPool constants,boolean raw) {
|
||||
public String getNameWithNamespace(ConstantPool constants, boolean raw) {
|
||||
String ret = "";
|
||||
Namespace ns = getNamespace(constants);
|
||||
if (ns != null) {
|
||||
|
||||
@@ -175,7 +175,7 @@ public abstract class Trait implements Serializable {
|
||||
Multiname name = getName(abc);
|
||||
Namespace ns = name.getNamespace(abc.constants);
|
||||
String packageName = ns.getName(abc.constants);
|
||||
String objectName = name.getName(abc.constants, new ArrayList<String>(),false);
|
||||
String objectName = name.getName(abc.constants, new ArrayList<String>(), false);
|
||||
return packageName + "." + objectName; //assume not null name
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
return;
|
||||
}
|
||||
Namespace ns = m.getNamespace(abc.constants);
|
||||
String name = m.getName(abc.constants, fullyQualifiedNames,false);
|
||||
String name = m.getName(abc.constants, fullyQualifiedNames, false);
|
||||
NamespaceSet nss = m.getNamespaceSet(abc.constants);
|
||||
if (ns != null) {
|
||||
parseUsagesFromNS(abcTags, abc, imports, uses, m.namespace_index, ignorePackage, name);
|
||||
@@ -234,7 +234,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
return;
|
||||
}
|
||||
Namespace ns = m.getNamespace(abc.constants);
|
||||
String name = m.getName(abc.constants, fullyQualifiedNames,false);
|
||||
String name = m.getName(abc.constants, fullyQualifiedNames, false);
|
||||
NamespaceSet nss = m.getNamespaceSet(abc.constants);
|
||||
if (ns != null) {
|
||||
parseImportsUsagesFromNS(abcTags, abc, imports, uses, m.namespace_index, ignorePackage, name);
|
||||
@@ -459,7 +459,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
writer.newLine();
|
||||
writer.startTrait(abc.class_info.get(class_info).static_traits.traits.size() + abc.instance_info.get(class_info).instance_traits.traits.size() + 1);
|
||||
writer.appendNoHilight("{").newLine();
|
||||
abc.bodies.get(bodyIndex).toString(path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames,false) + ".staticinitializer", exportMode, abc, this, abc.constants, abc.method_info, writer, fullyQualifiedNames);
|
||||
abc.bodies.get(bodyIndex).toString(path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames, false) + ".staticinitializer", exportMode, abc, this, abc.constants, abc.method_info, writer, fullyQualifiedNames);
|
||||
writer.appendNoHilight("}").newLine();
|
||||
writer.endTrait();
|
||||
}
|
||||
@@ -488,7 +488,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
writer.startTrait(abc.class_info.get(class_info).static_traits.traits.size() + abc.instance_info.get(class_info).instance_traits.traits.size());
|
||||
writer.appendNoHilight(modifier);
|
||||
writer.appendNoHilight("function ");
|
||||
writer.appendNoHilight(abc.constants.getMultiname(abc.instance_info.get(class_info).name_index).getName(abc.constants, new ArrayList<String>()/*do not want full names here*/,false));
|
||||
writer.appendNoHilight(abc.constants.getMultiname(abc.instance_info.get(class_info).name_index).getName(abc.constants, new ArrayList<String>()/*do not want full names here*/, false));
|
||||
writer.appendNoHilight("(");
|
||||
bodyIndex = abc.findBodyIndex(abc.instance_info.get(class_info).iinit_index);
|
||||
if (bodyIndex != -1) {
|
||||
@@ -498,16 +498,16 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
}
|
||||
writer.appendNoHilight(")").startBlock();
|
||||
if (bodyIndex != -1) {
|
||||
abc.bodies.get(bodyIndex).toString(path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames,false) + ".initializer", exportMode, abc, this, abc.constants, abc.method_info, writer, fullyQualifiedNames);
|
||||
abc.bodies.get(bodyIndex).toString(path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames, false) + ".initializer", exportMode, abc, this, abc.constants, abc.method_info, writer, fullyQualifiedNames);
|
||||
}
|
||||
writer.endBlock().newLine();
|
||||
writer.endTrait();
|
||||
}
|
||||
|
||||
//static variables,constants & methods
|
||||
abc.class_info.get(class_info).static_traits.toString(this, path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames,false), abcTags, abc, true, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel);
|
||||
abc.class_info.get(class_info).static_traits.toString(this, path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames, false), abcTags, abc, true, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel);
|
||||
|
||||
abc.instance_info.get(class_info).instance_traits.toString(this, path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames,false), abcTags, abc, false, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel);
|
||||
abc.instance_info.get(class_info).instance_traits.toString(this, path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames, false), abcTags, abc, false, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel);
|
||||
|
||||
writer.endBlock(); // class
|
||||
writer.endClass();
|
||||
@@ -523,7 +523,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
int bodyIndex = abc.findBodyIndex(abc.class_info.get(class_info).cinit_index);
|
||||
if (bodyIndex != -1) {
|
||||
writer.mark();
|
||||
abc.bodies.get(bodyIndex).convert(path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames,false) + ".staticinitializer", exportMode, true, scriptIndex, class_info, abc, this, abc.constants, abc.method_info, new ScopeStack(), true, writer, fullyQualifiedNames, abc.class_info.get(class_info).static_traits, true);
|
||||
abc.bodies.get(bodyIndex).convert(path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames, false) + ".staticinitializer", exportMode, true, scriptIndex, class_info, abc, this, abc.constants, abc.method_info, new ScopeStack(), true, writer, fullyQualifiedNames, abc.class_info.get(class_info).static_traits, true);
|
||||
classInitializerIsEmpty = !writer.getMark();
|
||||
}
|
||||
|
||||
@@ -531,14 +531,14 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
if (!abc.instance_info.get(class_info).isInterface()) {
|
||||
bodyIndex = abc.findBodyIndex(abc.instance_info.get(class_info).iinit_index);
|
||||
if (bodyIndex != -1) {
|
||||
abc.bodies.get(bodyIndex).convert(path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames,false) + ".initializer", exportMode, false, scriptIndex, class_info, abc, this, abc.constants, abc.method_info, new ScopeStack(), false, writer, fullyQualifiedNames, abc.instance_info.get(class_info).instance_traits, true);
|
||||
abc.bodies.get(bodyIndex).convert(path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames, false) + ".initializer", exportMode, false, scriptIndex, class_info, abc, this, abc.constants, abc.method_info, new ScopeStack(), false, writer, fullyQualifiedNames, abc.instance_info.get(class_info).instance_traits, true);
|
||||
}
|
||||
}
|
||||
|
||||
//static variables,constants & methods
|
||||
abc.class_info.get(class_info).static_traits.convert(this, path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames,false), abcTags, abc, true, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel);
|
||||
abc.class_info.get(class_info).static_traits.convert(this, path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames, false), abcTags, abc, true, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel);
|
||||
|
||||
abc.instance_info.get(class_info).instance_traits.convert(this, path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames,false), abcTags, abc, false, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel);
|
||||
abc.instance_info.get(class_info).instance_traits.convert(this, path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames, false), abcTags, abc, false, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -59,7 +59,7 @@ public class TraitFunction extends Trait implements TraitWithSlot {
|
||||
}
|
||||
writer.appendNoHilight(modifier);
|
||||
writer.hilightSpecial("function ", "traittype");
|
||||
writer.hilightSpecial(abc.constants.getMultiname(name_index).getName(abc.constants, fullyQualifiedNames,false), "traitname");
|
||||
writer.hilightSpecial(abc.constants.getMultiname(name_index).getName(abc.constants, fullyQualifiedNames, false), "traitname");
|
||||
writer.appendNoHilight("(");
|
||||
abc.method_info.get(method_info).getParamStr(writer, abc.constants, body, abc, fullyQualifiedNames);
|
||||
writer.appendNoHilight(") : ");
|
||||
@@ -80,7 +80,7 @@ public class TraitFunction extends Trait implements TraitWithSlot {
|
||||
writer.appendNoHilight(" {").newLine();
|
||||
int bodyIndex = abc.findBodyIndex(method_info);
|
||||
if (bodyIndex != -1) {
|
||||
abc.bodies.get(bodyIndex).toString(path + "." + abc.constants.getMultiname(name_index).getName(abc.constants, fullyQualifiedNames,false), exportMode, abc, this, abc.constants, abc.method_info, writer, fullyQualifiedNames);
|
||||
abc.bodies.get(bodyIndex).toString(path + "." + abc.constants.getMultiname(name_index).getName(abc.constants, fullyQualifiedNames, false), exportMode, abc, this, abc.constants, abc.method_info, writer, fullyQualifiedNames);
|
||||
}
|
||||
writer.newLine();
|
||||
writer.appendNoHilight("}");
|
||||
@@ -95,7 +95,7 @@ public class TraitFunction extends Trait implements TraitWithSlot {
|
||||
if (!abc.instance_info.get(classIndex).isInterface()) {
|
||||
int bodyIndex = abc.findBodyIndex(method_info);
|
||||
if (bodyIndex != -1) {
|
||||
abc.bodies.get(bodyIndex).convert(path + "." + abc.constants.getMultiname(name_index).getName(abc.constants, fullyQualifiedNames,false), exportMode, isStatic, scriptIndex, classIndex, abc, this, abc.constants, abc.method_info, new ScopeStack(), false, writer, fullyQualifiedNames, null, true);
|
||||
abc.bodies.get(bodyIndex).convert(path + "." + abc.constants.getMultiname(name_index).getName(abc.constants, fullyQualifiedNames, false), exportMode, isStatic, scriptIndex, classIndex, abc, this, abc.constants, abc.method_info, new ScopeStack(), false, writer, fullyQualifiedNames, null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.abc.types.traits;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.action.Deobfuscation;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.NulWriter;
|
||||
@@ -68,7 +67,7 @@ public class TraitMethodGetterSetter extends Trait {
|
||||
|
||||
writer.appendNoHilight(modifier);
|
||||
writer.hilightSpecial("function " + addKind, "traittype");
|
||||
writer.hilightSpecial(getName(abc).getName(abc.constants, fullyQualifiedNames,false), "traitname");
|
||||
writer.hilightSpecial(getName(abc).getName(abc.constants, fullyQualifiedNames, false), "traitname");
|
||||
writer.appendNoHilight("(");
|
||||
abc.method_info.get(method_info).getParamStr(writer, abc.constants, body, abc, fullyQualifiedNames);
|
||||
writer.appendNoHilight(") : ");
|
||||
@@ -78,7 +77,7 @@ public class TraitMethodGetterSetter extends Trait {
|
||||
|
||||
@Override
|
||||
public void convert(Trait parent, String path, List<ABCContainerTag> abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<String> fullyQualifiedNames, boolean parallel) throws InterruptedException {
|
||||
path = path + "." + getName(abc).getName(abc.constants, fullyQualifiedNames,false);
|
||||
path = path + "." + getName(abc).getName(abc.constants, fullyQualifiedNames, false);
|
||||
convertHeader(parent, path, abcTags, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel);
|
||||
int bodyIndex = abc.findBodyIndex(method_info);
|
||||
if (!(classIndex != -1 && abc.instance_info.get(classIndex).isInterface() || bodyIndex == -1)) {
|
||||
@@ -90,7 +89,7 @@ public class TraitMethodGetterSetter extends Trait {
|
||||
|
||||
@Override
|
||||
public GraphTextWriter toString(Trait parent, String path, List<ABCContainerTag> abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<String> fullyQualifiedNames, boolean parallel) throws InterruptedException {
|
||||
path = path + "." + getName(abc).getName(abc.constants, fullyQualifiedNames,false);
|
||||
path = path + "." + getName(abc).getName(abc.constants, fullyQualifiedNames, false);
|
||||
toStringHeader(parent, path, abcTags, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel);
|
||||
int bodyIndex = abc.findBodyIndex(method_info);
|
||||
if (classIndex != -1 && abc.instance_info.get(classIndex).isInterface() || bodyIndex == -1) {
|
||||
|
||||
@@ -175,18 +175,18 @@ public class Deobfuscation {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isValidName(String s,String ...exceptions) {
|
||||
|
||||
public static boolean isValidName(String s, String... exceptions) {
|
||||
boolean isValid = true;
|
||||
|
||||
for(String e:exceptions){
|
||||
if(e.equals(s)){
|
||||
|
||||
for (String e : exceptions) {
|
||||
if (e.equals(s)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (Action.isReservedWord(s)) {
|
||||
isValid = false;
|
||||
|
||||
if (Action.isReservedWord(s)) {
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
if (isValid) {
|
||||
@@ -249,28 +249,29 @@ public class Deobfuscation {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String makeObfuscatedIdentifier(String s){
|
||||
|
||||
public static String makeObfuscatedIdentifier(String s) {
|
||||
return "\u00A7" + escapeOIdentifier(s) + "\u00A7";
|
||||
}
|
||||
|
||||
|
||||
private static Cache<String> nameCache = Cache.getInstance(false);
|
||||
|
||||
|
||||
private static final Cache<String> nameCache = Cache.getInstance(false);
|
||||
|
||||
/**
|
||||
* Ensures identifier is valid and if not, uses paragraph syntax
|
||||
*
|
||||
* @param s Identifier
|
||||
* @param validExceptions Exceptions which are valid (e.g. some reserved words)
|
||||
* @return
|
||||
* @param validExceptions Exceptions which are valid (e.g. some reserved
|
||||
* words)
|
||||
* @return
|
||||
*/
|
||||
public static String printIdentifier(String s,String ...validExceptions){
|
||||
if(s.startsWith("\u00A7")&&s.endsWith("\u00A7")){ //Assuming already printed - TODO:detect better
|
||||
public static String printIdentifier(String s, String... validExceptions) {
|
||||
if (s.startsWith("\u00A7") && s.endsWith("\u00A7")) { //Assuming already printed - TODO:detect better
|
||||
return s;
|
||||
}
|
||||
if(nameCache.contains(s)){
|
||||
if (nameCache.contains(s)) {
|
||||
return nameCache.get(s);
|
||||
}
|
||||
if(isValidName(s, validExceptions)){
|
||||
}
|
||||
if (isValidName(s, validExceptions)) {
|
||||
nameCache.put(s, s);
|
||||
return s;
|
||||
}
|
||||
@@ -279,11 +280,11 @@ public class Deobfuscation {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static String printNamespace(String pkg,String ...validNameExceptions){
|
||||
if(nameCache.contains(pkg)){
|
||||
public static String printNamespace(String pkg, String... validNameExceptions) {
|
||||
if (nameCache.contains(pkg)) {
|
||||
return nameCache.get(pkg);
|
||||
}
|
||||
if(pkg.equals("")){
|
||||
if (pkg.isEmpty()) {
|
||||
nameCache.put(pkg, pkg);
|
||||
return pkg;
|
||||
}
|
||||
@@ -293,18 +294,17 @@ public class Deobfuscation {
|
||||
} else {
|
||||
parts = new String[]{pkg};
|
||||
}
|
||||
String ret="";
|
||||
for(int i=0;i<parts.length;i++){
|
||||
if(i>0){
|
||||
ret+=".";
|
||||
String ret = "";
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
if (i > 0) {
|
||||
ret += ".";
|
||||
}
|
||||
ret += printIdentifier(parts[i], validNameExceptions);
|
||||
}
|
||||
nameCache.put(pkg, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String escapeOIdentifier(String s) {
|
||||
StringBuilder ret = new StringBuilder(s.length());
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user