more DottedChains

This commit is contained in:
2015-07-14 21:11:08 +02:00
parent a4d49aeaf0
commit af3553e387
55 changed files with 179 additions and 120 deletions
@@ -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;
}
}
@@ -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;
@@ -56,6 +56,10 @@ public class AVM2Deobfuscation {
private final Map<String, Integer> 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;
}
@@ -57,6 +57,6 @@ public class CoerceSIns extends InstructionDefinition implements CoerceOrConvert
@Override
public GraphTargetItem getTargetType(AVM2ConstantPool constants, AVM2Instruction ins, List<DottedChain> fullyQualifiedNames) {
return new TypeItem(new DottedChain("String"));
return new TypeItem(DottedChain.STRING);
}
}
@@ -67,6 +67,6 @@ public class ConvertBIns extends InstructionDefinition implements CoerceOrConver
@Override
public GraphTargetItem getTargetType(AVM2ConstantPool constants, AVM2Instruction ins, List<DottedChain> fullyQualifiedNames) {
return new TypeItem(new DottedChain("Boolean"));
return new TypeItem(DottedChain.BOOLEAN);
}
}
@@ -75,6 +75,6 @@ public class ConvertDIns extends InstructionDefinition implements CoerceOrConver
@Override
public GraphTargetItem getTargetType(AVM2ConstantPool constants, AVM2Instruction ins, List<DottedChain> fullyQualifiedNames) {
return new TypeItem(new DottedChain("Number"));
return new TypeItem(DottedChain.NUMBER);
}
}
@@ -73,6 +73,6 @@ public class ConvertIIns extends InstructionDefinition implements CoerceOrConver
@Override
public GraphTargetItem getTargetType(AVM2ConstantPool constants, AVM2Instruction ins, List<DottedChain> fullyQualifiedNames) {
return new TypeItem(new DottedChain("int"));
return new TypeItem(DottedChain.INT);
}
}
@@ -56,6 +56,6 @@ public class ConvertOIns extends InstructionDefinition implements CoerceOrConver
@Override
public GraphTargetItem getTargetType(AVM2ConstantPool constants, AVM2Instruction ins, List<DottedChain> fullyQualifiedNames) {
return new TypeItem(new DottedChain("Object"));
return new TypeItem(DottedChain.OBJECT);
}
}
@@ -57,6 +57,6 @@ public class ConvertSIns extends InstructionDefinition implements CoerceOrConver
@Override
public GraphTargetItem getTargetType(AVM2ConstantPool constants, AVM2Instruction ins, List<DottedChain> fullyQualifiedNames) {
return new TypeItem(new DottedChain("String"));
return new TypeItem(DottedChain.STRING);
}
}
@@ -56,6 +56,6 @@ public class ConvertUIns extends InstructionDefinition implements CoerceOrConver
@Override
public GraphTargetItem getTargetType(AVM2ConstantPool constants, AVM2Instruction ins, List<DottedChain> fullyQualifiedNames) {
return new TypeItem(new DottedChain("uint"));
return new TypeItem(DottedChain.UINT);
}
}
@@ -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;
}
@@ -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
@@ -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
@@ -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();
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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(":");
@@ -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);
@@ -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
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -43,6 +43,6 @@ public class InAVM2Item extends BinaryOpItem {
@Override
public GraphTargetItem returnType() {
return new TypeItem(new DottedChain("Boolean"));
return new TypeItem(DottedChain.BOOLEAN);
}
}
@@ -43,6 +43,6 @@ public class InstanceOfAVM2Item extends BinaryOpItem {
@Override
public GraphTargetItem returnType() {
return new TypeItem(new DottedChain("Boolean"));
return new TypeItem(DottedChain.BOOLEAN);
}
}
@@ -43,6 +43,6 @@ public class IsTypeAVM2Item extends BinaryOpItem {
@Override
public GraphTargetItem returnType() {
return new TypeItem(new DottedChain("Boolean"));
return new TypeItem(DottedChain.BOOLEAN);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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<ABC> allABCs, int name_index, List<Integer> indices, List<String> names, List<String> namespaces, List<ABC> 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;
}
@@ -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:
@@ -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
@@ -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<Integer>()), 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,
@@ -227,7 +227,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, 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<String> outName = new Reference<>("");
Reference<DottedChain> outNs = new Reference<>(DottedChain.EMPTY);
Reference<DottedChain> outPropNs = new Reference<>(DottedChain.EMPTY);
@@ -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) {
@@ -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
@@ -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
@@ -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);
@@ -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);
}
@@ -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;
}
@@ -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<Integer> traitIndices = new ArrayList<>();
@@ -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;
@@ -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<DottedChain> 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<DottedChain> 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
}
@@ -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<String> namesInThisPackage = new ArrayList<>();
for (ABCContainerTag tag : abc.getAbcTags()) {
for (ScriptInfo si : tag.getABC().script_info) {
@@ -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;
@@ -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<String> 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
@@ -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();