mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-04 15:14:49 +00:00
using DottedChains (almost) everywhere
This commit is contained in:
@@ -317,6 +317,10 @@ public class IdentifiersDeobfuscation {
|
||||
* @return
|
||||
*/
|
||||
public static String printIdentifier(boolean as3, String s, String... validExceptions) {
|
||||
if (s.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (s.startsWith("\u00A7") && s.endsWith("\u00A7")) { // Assuming already printed - TODO:detect better
|
||||
return s;
|
||||
}
|
||||
@@ -343,38 +347,6 @@ public class IdentifiersDeobfuscation {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static String printNamespace(boolean as3, String pkg, String... validNameExceptions) {
|
||||
Cache<String, String> nameCache = as3 ? as3NameCache : as2NameCache;
|
||||
if (nameCache.contains(pkg)) {
|
||||
return nameCache.get(pkg);
|
||||
}
|
||||
|
||||
if (pkg.isEmpty()) {
|
||||
nameCache.put(pkg, pkg);
|
||||
return pkg;
|
||||
}
|
||||
|
||||
String[] parts;
|
||||
if (pkg.contains(".")) {
|
||||
parts = pkg.split("\\.");
|
||||
} else {
|
||||
parts = new String[]{pkg};
|
||||
}
|
||||
|
||||
StringBuilder ret = new StringBuilder();
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
if (i > 0) {
|
||||
ret.append(".");
|
||||
}
|
||||
|
||||
ret.append(printIdentifier(as3, parts[i], validNameExceptions));
|
||||
}
|
||||
|
||||
String retStr = ret.toString();
|
||||
nameCache.put(pkg, retStr);
|
||||
return retStr;
|
||||
}
|
||||
|
||||
public static GraphTextWriter escapeOIdentifier(String s, GraphTextWriter writer) {
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash;
|
||||
import com.jpexs.decompiler.flash.abc.types.ABCException;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.ScriptInfo;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
@@ -57,7 +58,7 @@ public class SourceGeneratorLocalData implements Serializable {
|
||||
|
||||
public Map<MethodBody, List<Integer>> traitUsages = new HashMap<>();
|
||||
|
||||
public String pkg = "";
|
||||
public DottedChain pkg = DottedChain.EMPTY;
|
||||
|
||||
public List<GraphTargetItem> scopeStack = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ public class ABC {
|
||||
public ABCContainerTag parentTag;
|
||||
|
||||
/* Map from multiname index of namespace value to namespace name**/
|
||||
private Map<String, DottedChain> namespaceMap;
|
||||
private Map<DottedChain, DottedChain> namespaceMap;
|
||||
|
||||
public ABC(ABCContainerTag tag) {
|
||||
this.parentTag = tag;
|
||||
@@ -814,15 +814,15 @@ public class ABC {
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, DottedChain> getNamespaceMap() {
|
||||
private Map<DottedChain, DottedChain> getNamespaceMap() {
|
||||
if (namespaceMap == null) {
|
||||
Map<String, DottedChain> map = new HashMap<>();
|
||||
Map<DottedChain, DottedChain> map = new HashMap<>();
|
||||
for (ScriptInfo si : script_info) {
|
||||
for (Trait t : si.traits.traits) {
|
||||
if (t instanceof TraitSlotConst) {
|
||||
TraitSlotConst s = ((TraitSlotConst) t);
|
||||
if (s.isNamespace()) {
|
||||
String key = constants.getNamespace(s.value_index).getName(constants, true); // assume not null
|
||||
DottedChain key = constants.getNamespace(s.value_index).getName(constants, true); // assume not null
|
||||
DottedChain val = constants.getMultiname(s.name_index).getNameWithNamespace(constants);
|
||||
map.put(key, val);
|
||||
}
|
||||
@@ -857,13 +857,13 @@ public class ABC {
|
||||
return bodyIdxFromMethodIdx;
|
||||
}
|
||||
|
||||
public DottedChain nsValueToName(String value) {
|
||||
public DottedChain nsValueToName(DottedChain value) {
|
||||
if (getNamespaceMap().containsKey(value)) {
|
||||
return getNamespaceMap().get(value);
|
||||
} else {
|
||||
DottedChain ns = getDeobfuscation().builtInNs(value);
|
||||
if (ns == null) {
|
||||
return new DottedChain("");
|
||||
return DottedChain.EMPTY;
|
||||
} else {
|
||||
return ns;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc;
|
||||
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -24,18 +25,18 @@ import java.util.Objects;
|
||||
*/
|
||||
public class ClassPath {
|
||||
|
||||
public final String packageStr;
|
||||
public final DottedChain packageStr;
|
||||
|
||||
public final String className;
|
||||
|
||||
public ClassPath(String packageStr, String className) {
|
||||
public ClassPath(DottedChain packageStr, String className) {
|
||||
this.packageStr = packageStr;
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (packageStr == null || packageStr.isEmpty()) ? className : packageStr + "." + className;
|
||||
return (packageStr == null || packageStr.isEmpty()) ? className : packageStr.toPrintableString(true) + "." + className;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.helpers.FileTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.NulWriter;
|
||||
import com.jpexs.decompiler.flash.treeitems.AS3ClassTreeItem;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.helpers.CancellableWorker;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.Path;
|
||||
@@ -82,8 +83,8 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
this.allABCs = allAbcs;
|
||||
}
|
||||
|
||||
public String getPathPackage() {
|
||||
String packageName = "";
|
||||
public DottedChain getPathPackage() {
|
||||
DottedChain packageName = DottedChain.EMPTY;
|
||||
for (int t : traitIndices) {
|
||||
Multiname name = abc.script_info.get(scriptIndex).traits.traits.get(t).getName(abc);
|
||||
Namespace ns = name.getNamespace(abc.constants);
|
||||
@@ -108,8 +109,8 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
|
||||
public File getExportFile(String directory, ScriptExportSettings exportSettings) throws IOException {
|
||||
String scriptName = getPathScriptName();
|
||||
String packageName = getPathPackage();
|
||||
File outDir = new File(directory + File.separatorChar + makeDirPath(packageName));
|
||||
DottedChain packageName = getPathPackage();
|
||||
File outDir = new File(directory + File.separatorChar + packageName.toFilePath());
|
||||
Path.createDirectorySafe(outDir);
|
||||
String fileName = outDir.toString() + File.separator + Helper.makeFileName(scriptName) + exportSettings.getFileExtension();
|
||||
return new File(fileName);
|
||||
@@ -128,22 +129,6 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
}
|
||||
return packageName.equals("") ? scriptName : packageName + "." + scriptName;
|
||||
}*/
|
||||
private static String makeDirPath(String packageName) {
|
||||
if (packageName.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
String[] pathParts;
|
||||
if (packageName.contains(".")) {
|
||||
pathParts = packageName.split("\\.");
|
||||
} else {
|
||||
pathParts = new String[]{packageName};
|
||||
}
|
||||
for (int i = 0; i < pathParts.length; i++) {
|
||||
pathParts[i] = Helper.makeFileName(pathParts[i]);
|
||||
}
|
||||
return Helper.joinStrings(pathParts, File.separator);
|
||||
}
|
||||
|
||||
public void convert(final NulWriter writer, final List<Trait> traits, final ScriptExportMode exportMode, final boolean parallel) throws InterruptedException {
|
||||
for (int t : traitIndices) {
|
||||
Trait trait = traits.get(t);
|
||||
|
||||
@@ -20,9 +20,12 @@ 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.graph.DottedChain;
|
||||
import com.jpexs.helpers.utf8.Utf8PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -47,6 +50,8 @@ public class AVM2ConstantPool {
|
||||
|
||||
public List<Multiname> constant_multiname = new ArrayList<>();
|
||||
|
||||
public Map<String, DottedChain> dottedChainCache = new HashMap<>();
|
||||
|
||||
public synchronized int addInt(long value) {
|
||||
constant_int.add(value);
|
||||
return constant_int.size() - 1;
|
||||
@@ -340,6 +345,14 @@ public class AVM2ConstantPool {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getStringId(DottedChain val, boolean add) {
|
||||
if (val == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return getStringId(val.toRawString(), add);
|
||||
}
|
||||
|
||||
public int getIntId(long val, boolean add) {
|
||||
int id = getIntId(val);
|
||||
if (add && id == 0) {
|
||||
@@ -404,6 +417,22 @@ public class AVM2ConstantPool {
|
||||
return id;
|
||||
}
|
||||
|
||||
public DottedChain getDottedChain(int index) {
|
||||
String str = getString(index);
|
||||
DottedChain chain = dottedChainCache.get(str);
|
||||
if (chain == null) {
|
||||
if (str.isEmpty()) {
|
||||
chain = DottedChain.EMPTY;
|
||||
} else {
|
||||
chain = new DottedChain(str.split("\\."));
|
||||
}
|
||||
|
||||
dottedChainCache.put(str, chain);
|
||||
}
|
||||
|
||||
return chain;
|
||||
}
|
||||
|
||||
public void dump(Utf8PrintWriter writer) {
|
||||
String s = "";
|
||||
for (int i = 1; i < constant_int.size(); i++) {
|
||||
|
||||
@@ -92,6 +92,13 @@ public class AVM2Deobfuscation {
|
||||
return isValid;
|
||||
}
|
||||
|
||||
public DottedChain builtInNs(DottedChain ns) {
|
||||
if (ns == null || ns.size() != 1) {
|
||||
return null;
|
||||
}
|
||||
return builtInNs(ns.get(0));
|
||||
}
|
||||
|
||||
public DottedChain builtInNs(String ns) {
|
||||
if (ns == null) {
|
||||
return null;
|
||||
|
||||
@@ -16,11 +16,13 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
|
||||
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface AlchemyTypeIns {
|
||||
|
||||
public static final String ALCHEMY_PACKAGE = "avm2.intrinsics.memory";
|
||||
public static final DottedChain ALCHEMY_PACKAGE = new DottedChain("avm2", "intrinsics", "memory");
|
||||
}
|
||||
|
||||
@@ -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("String");
|
||||
return new TypeItem(new 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("Boolean");
|
||||
return new TypeItem(new 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("Number");
|
||||
return new TypeItem(new 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("int");
|
||||
return new TypeItem(new 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("Object");
|
||||
return new TypeItem(new 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("String");
|
||||
return new TypeItem(new 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("uint");
|
||||
return new TypeItem(new DottedChain("uint"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Li32Ins;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Li8Ins;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
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;
|
||||
@@ -86,9 +87,9 @@ public class AlchemyLoadAVM2Item extends AVM2Item {
|
||||
public GraphTargetItem returnType() {
|
||||
switch (type) {
|
||||
case 'i':
|
||||
return new TypeItem("int");
|
||||
return new TypeItem(new DottedChain("int"));
|
||||
case 'f':
|
||||
return new TypeItem("Number");
|
||||
return new TypeItem(new DottedChain("Number"));
|
||||
}
|
||||
return TypeItem.UNBOUNDED;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Sxi1Ins;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Sxi8Ins;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
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;
|
||||
@@ -52,7 +53,7 @@ public class AlchemySignExtendAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem("int");
|
||||
return new TypeItem(new DottedChain("int"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
@@ -33,7 +34,7 @@ public class FindDefAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
|
||||
return writer.append(propertyName.getNamespace(localData.constantsAvm2).getName(localData.constantsAvm2, false).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);
|
||||
cns = ns.getName(constants, false).toPrintableString(true);
|
||||
}
|
||||
}
|
||||
return cname.equals("XML") && cns.isEmpty();
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.jpexs.decompiler.flash.abc.types.Namespace;
|
||||
import com.jpexs.decompiler.flash.abc.types.NamespaceSet;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
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;
|
||||
@@ -45,6 +46,18 @@ import java.util.List;
|
||||
*/
|
||||
public class InitVectorAVM2Item extends AVM2Item {
|
||||
|
||||
public static final DottedChain VECTOR_PACKAGE = new DottedChain("__AS3__", "vec");
|
||||
|
||||
public static final DottedChain VECTOR_FQN = new DottedChain("__AS3__", "vec", "Vector");
|
||||
|
||||
public static final DottedChain VECTOR_INT = new DottedChain("__AS3__", "vec", "Vector$int");
|
||||
|
||||
public static final DottedChain VECTOR_DOUBLE = new DottedChain("__AS3__", "vec", "Vector$double");
|
||||
|
||||
public static final DottedChain VECTOR_UINT = new DottedChain("__AS3__", "vec", "Vector$uint");
|
||||
|
||||
public static final DottedChain VECTOR_OBJECT = new DottedChain("__AS3__", "vec", "Vector$object");
|
||||
|
||||
public GraphTargetItem subtype;
|
||||
|
||||
public List<GraphTargetItem> arguments;
|
||||
@@ -97,7 +110,7 @@ public class InitVectorAVM2Item extends AVM2Item {
|
||||
public GraphTargetItem returnType() {
|
||||
List<GraphTargetItem> pars = new ArrayList<>();
|
||||
pars.add(subtype);
|
||||
return new ApplyTypeAVM2Item(null, new TypeItem("__AS3__.vec.Vector"), pars);
|
||||
return new ApplyTypeAVM2Item(null, new TypeItem(VECTOR_FQN), pars);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushShortIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
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;
|
||||
@@ -73,7 +74,7 @@ public class IntegerValueAVM2Item extends NumberValueAVM2Item implements Integer
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem("int");
|
||||
return new TypeItem(new DottedChain("int"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -20,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushNanIns;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
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;
|
||||
@@ -47,7 +49,7 @@ public class NanAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem(new DottedChain("Number"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -98,7 +98,7 @@ public class NewFunctionAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem("Function");
|
||||
return new TypeItem(new DottedChain("Function"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.construction.NewObjectIns;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
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;
|
||||
@@ -63,7 +64,7 @@ public class NewObjectAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem("Object");
|
||||
return new TypeItem(new DottedChain("Object"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -21,6 +22,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushNullIns;
|
||||
import com.jpexs.decompiler.flash.ecma.Null;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
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;
|
||||
@@ -59,7 +61,7 @@ public class NullAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem(new DottedChain("null"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -21,6 +22,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushUndefinedIns;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
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;
|
||||
@@ -52,7 +54,7 @@ public class UndefinedAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem(new DottedChain("Undefined"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
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;
|
||||
@@ -49,7 +51,7 @@ public class XMLAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem(new DottedChain("XML"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -89,7 +89,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() : "*";
|
||||
srcData.declaredType = (coerType instanceof TypeItem) ? ((TypeItem) coerType).fullTypeName.toPrintableString(true) : "*";
|
||||
writer.append("var ");
|
||||
writer.append(localName);
|
||||
writer.append(":");
|
||||
@@ -102,7 +102,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() : "*";
|
||||
srcData.declaredType = (type instanceof TypeItem) ? ((TypeItem) type).fullTypeName.toPrintableString(true) : "*";
|
||||
writer.append("var ");
|
||||
ssti.getName(writer, localData);
|
||||
writer.append(":");
|
||||
|
||||
@@ -92,7 +92,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();
|
||||
data.declaredType = eti <= 0 ? "*" : localData.constantsAvm2.constant_multiname.get(eti).getNameWithNamespace(localData.constantsAvm2).toPrintableString(true);
|
||||
writer.hilightSpecial(localName, HighlightSpecialType.TRY_NAME, e, data);
|
||||
writer.append(":");
|
||||
writer.hilightSpecial(catchExceptions.get(e).getTypeName(localData.constantsAvm2, localData.fullyQualifiedNames), HighlightSpecialType.TRY_TYPE, e);
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.parser.script.PropertyAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.script.UnresolvedAVM2Item;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
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;
|
||||
@@ -87,7 +88,7 @@ public class DeletePropertyAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem("Boolean");
|
||||
return new TypeItem(new DottedChain("Boolean"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfEqIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfNeIns;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.decompiler.graph.EqualsTypeItem;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -68,6 +69,6 @@ public class EqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem("Boolean");
|
||||
return new TypeItem(new DottedChain("Boolean"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfGeIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfNGeIns;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
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;
|
||||
@@ -74,6 +75,6 @@ public class GeAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem("Boolean");
|
||||
return new TypeItem(new DottedChain("Boolean"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfGtIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfNGtIns;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
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;
|
||||
@@ -67,6 +68,6 @@ public class GtAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem("Boolean");
|
||||
return new TypeItem(new DottedChain("Boolean"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.other.InIns;
|
||||
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;
|
||||
@@ -41,6 +43,6 @@ public class InAVM2Item extends BinaryOpItem {
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem(new DottedChain("Boolean"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.types.InstanceOfIns;
|
||||
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;
|
||||
@@ -41,6 +43,6 @@ public class InstanceOfAVM2Item extends BinaryOpItem {
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem(new DottedChain("Boolean"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.types.IsTypeLateIns;
|
||||
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;
|
||||
@@ -41,6 +43,6 @@ public class IsTypeAVM2Item extends BinaryOpItem {
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem(new DottedChain("Boolean"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfLeIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfNLeIns;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
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;
|
||||
@@ -74,6 +75,6 @@ public class LeAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem("Boolean");
|
||||
return new TypeItem(new DottedChain("Boolean"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfLtIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfNLtIns;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
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;
|
||||
@@ -67,6 +68,6 @@ public class LtAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem("Boolean");
|
||||
return new TypeItem(new DottedChain("Boolean"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfEqIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfNeIns;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
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;
|
||||
@@ -69,6 +70,6 @@ public class NeqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfCondit
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem("Boolean");
|
||||
return new TypeItem(new DottedChain("Boolean"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfStrictEqIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfStrictNeIns;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.decompiler.graph.EqualsTypeItem;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -71,6 +72,6 @@ public class StrictEqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfC
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem("Boolean");
|
||||
return new TypeItem(new DottedChain("Boolean"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfStrictEqIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfStrictNeIns;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
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;
|
||||
@@ -72,6 +73,6 @@ public class StrictNeqAVM2Item extends BinaryOpItem implements LogicalOpItem, If
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem("Boolean");
|
||||
return new TypeItem(new DottedChain("Boolean"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,6 +138,7 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -1195,12 +1196,11 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
return abc;
|
||||
}
|
||||
|
||||
public void generateClass(List<DottedChain> importedClasses, List<AssignableAVM2Item> sinitVariables, boolean staticNeedsActivation, List<GraphTargetItem> staticInit, List<Integer> openedNamespaces, int namespace, int initScope, String pkg, ClassInfo classInfo, InstanceInfo instanceInfo, SourceGeneratorLocalData localData, boolean isInterface, String name, String superName, GraphTargetItem extendsVal, List<GraphTargetItem> implementsStr, GraphTargetItem constructor, List<GraphTargetItem> traitItems, Reference<Integer> class_index) throws AVM2ParseException, CompilationException {
|
||||
public void generateClass(List<DottedChain> importedClasses, List<AssignableAVM2Item> sinitVariables, boolean staticNeedsActivation, List<GraphTargetItem> staticInit, List<Integer> openedNamespaces, int namespace, int initScope, DottedChain pkg, ClassInfo classInfo, InstanceInfo instanceInfo, SourceGeneratorLocalData localData, boolean isInterface, String name, String superName, GraphTargetItem extendsVal, List<GraphTargetItem> implementsStr, GraphTargetItem constructor, List<GraphTargetItem> traitItems, Reference<Integer> class_index) throws AVM2ParseException, CompilationException {
|
||||
localData.currentClass = name;
|
||||
localData.pkg = pkg;
|
||||
List<GraphSourceItem> ret = new ArrayList<>();
|
||||
if (extendsVal == null && !isInterface) {
|
||||
extendsVal = new TypeItem("Object");
|
||||
extendsVal = new TypeItem(new DottedChain("Object"));
|
||||
}
|
||||
ParsedSymbol s = null;
|
||||
|
||||
@@ -1298,7 +1298,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public int generateClass(int namespace, ClassInfo ci, InstanceInfo ii, int initScope, String pkg, SourceGeneratorLocalData localData, AVM2Item cls, Reference<Integer> class_index) throws AVM2ParseException, CompilationException {
|
||||
public int generateClass(int namespace, ClassInfo ci, InstanceInfo ii, int initScope, DottedChain pkg, SourceGeneratorLocalData localData, AVM2Item cls, Reference<Integer> class_index) throws AVM2ParseException, CompilationException {
|
||||
/*ClassInfo ci = new ClassInfo();
|
||||
InstanceInfo ii = new InstanceInfo();
|
||||
abc.class_info.add(ci);
|
||||
@@ -1405,7 +1405,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int method(boolean subMethod, boolean isInterface, List<MethodBody> callStack, String pkg, boolean needsActivation, List<AssignableAVM2Item> subvariables, int initScope, boolean hasRest, int line, String className, String superType, boolean constructor, SourceGeneratorLocalData localData, List<GraphTargetItem> paramTypes, List<String> paramNames, List<GraphTargetItem> paramValues, List<GraphTargetItem> body, GraphTargetItem retType) throws CompilationException {
|
||||
public int method(boolean subMethod, boolean isInterface, List<MethodBody> callStack, DottedChain pkg, boolean needsActivation, List<AssignableAVM2Item> subvariables, int initScope, boolean hasRest, int line, String className, String superType, boolean constructor, SourceGeneratorLocalData localData, List<GraphTargetItem> paramTypes, List<String> paramNames, List<GraphTargetItem> paramValues, List<GraphTargetItem> body, GraphTargetItem retType) throws CompilationException {
|
||||
//Reference<Boolean> hasArgs = new Reference<>(Boolean.FALSE);
|
||||
//calcRegisters(localData,needsActivation,paramNames,subvariables,body, hasArgs);
|
||||
SourceGeneratorLocalData newlocalData = new SourceGeneratorLocalData(new HashMap<>(), 1, true, 0);
|
||||
@@ -1868,7 +1868,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
return null;
|
||||
}
|
||||
|
||||
private int genNs(List<DottedChain> importedClasses, String pkg, String custom, int namespace, List<Integer> openedNamespaces, SourceGeneratorLocalData localData, int line) throws CompilationException {
|
||||
private int genNs(List<DottedChain> importedClasses, DottedChain pkg, String custom, int namespace, List<Integer> openedNamespaces, SourceGeneratorLocalData localData, int line) throws CompilationException {
|
||||
if (custom != null) {
|
||||
PropertyAVM2Item prop = new PropertyAVM2Item(null, custom, abc, allABCs, openedNamespaces, new ArrayList<>());
|
||||
Reference<ValueKind> value = new Reference<>(null);
|
||||
@@ -1913,7 +1913,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
return namespace;
|
||||
}
|
||||
|
||||
public void generateTraitsPhase2(List<DottedChain> importedClasses, String pkg, List<GraphTargetItem> items, Trait[] traits, List<Integer> openedNamespaces, SourceGeneratorLocalData localData) throws CompilationException {
|
||||
public void generateTraitsPhase2(List<DottedChain> importedClasses, DottedChain pkg, List<GraphTargetItem> items, Trait[] traits, List<Integer> openedNamespaces, SourceGeneratorLocalData localData) throws CompilationException {
|
||||
for (int k = 0; k < items.size(); k++) {
|
||||
GraphTargetItem item = items.get(k);
|
||||
if (traits[k] == null) {
|
||||
@@ -2173,12 +2173,12 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
} else {
|
||||
|
||||
parentNamesAddNames(abc, allABCs, abc.instance_info.get(tc.class_info).name_index, parents, new ArrayList<>(), new ArrayList<>());
|
||||
for (int i = parents.size() - 1; i >= 1; i--) {
|
||||
for (int i = parents.size() - 1; i >= 0; i--) {
|
||||
mbCode.add(ins(new GetLexIns(), parents.get(i)));
|
||||
mbCode.add(ins(new PushScopeIns()));
|
||||
traitScope++;
|
||||
}
|
||||
mbCode.add(ins(new GetLexIns(), parents.get(1)));
|
||||
mbCode.add(ins(new GetLexIns(), parents.get(0)));
|
||||
}
|
||||
mbCode.add(ins(new NewClassIns(), tc.class_info));
|
||||
if (!abc.instance_info.get(tc.class_info).isInterface()) {
|
||||
@@ -2245,25 +2245,12 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
}
|
||||
}
|
||||
if (t instanceof TraitFunction) {
|
||||
return new TypeItem("Function");
|
||||
return new TypeItem(new DottedChain("Function"));
|
||||
}
|
||||
return TypeItem.UNBOUNDED;
|
||||
}
|
||||
|
||||
private static boolean eq(Object a, Object b) {
|
||||
if (a == null && b == null) {
|
||||
return true;
|
||||
}
|
||||
if (a == null) {
|
||||
return false;
|
||||
}
|
||||
if (b == null) {
|
||||
return false;
|
||||
}
|
||||
return a.equals(b);
|
||||
}
|
||||
|
||||
public static boolean searchPrototypeChain(boolean instanceOnly, List<ABC> abcs, String pkg, String obj, String propertyName, Reference<String> outName, Reference<String> outNs, Reference<String> outPropNs, Reference<Integer> outPropNsKind, Reference<Integer> outPropNsIndex, Reference<GraphTargetItem> outPropType, Reference<ValueKind> outPropValue) {
|
||||
public static boolean searchPrototypeChain(boolean instanceOnly, List<ABC> abcs, DottedChain pkg, String obj, String propertyName, Reference<String> outName, Reference<DottedChain> outNs, Reference<DottedChain> outPropNs, Reference<Integer> outPropNsKind, Reference<Integer> outPropNsIndex, Reference<GraphTargetItem> outPropType, Reference<ValueKind> outPropValue) {
|
||||
|
||||
for (ABC abc : abcs) {
|
||||
if (!instanceOnly) {
|
||||
@@ -2272,7 +2259,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
continue;
|
||||
}
|
||||
for (Trait t : ii.traits.traits) {
|
||||
if (eq(pkg, t.getName(abc).getNamespace(abc.constants).getName(abc.constants, true))) {
|
||||
if (Objects.equals(pkg, t.getName(abc).getNamespace(abc.constants).getName(abc.constants, true))) {
|
||||
if (propertyName.equals(t.getName(abc).getName(abc.constants, null, true))) {
|
||||
outName.setVal(obj);
|
||||
outNs.setVal(pkg);
|
||||
@@ -2297,7 +2284,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
}
|
||||
Multiname clsName = ii.getName(abc.constants);
|
||||
if (obj.equals(clsName.getName(abc.constants, null, true))) {
|
||||
if (eq(pkg, clsName.getNamespace(abc.constants).getName(abc.constants, true))) {
|
||||
if (Objects.equals(pkg, clsName.getNamespace(abc.constants).getName(abc.constants, true))) {
|
||||
//class found
|
||||
|
||||
for (Trait t : ii.instance_traits.traits) {
|
||||
@@ -2356,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));
|
||||
namespaces.add(abc.constants.constant_multiname.get(name_index).getNamespace(abc.constants).getName(abc.constants, true).toRawString());
|
||||
Multiname mname = abc.constants.constant_multiname.get(name_index);
|
||||
|
||||
outABCs.add(abc);
|
||||
@@ -2370,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), a.constants)) {
|
||||
if (m.getNamespace(a.constants).hasName(mname.getNamespace(abc.constants).getName(abc.constants, true).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) {
|
||||
|
||||
@@ -144,7 +144,7 @@ public class ActionScript3Parser {
|
||||
return uniqLast;
|
||||
}
|
||||
|
||||
private List<GraphTargetItem> commands(TypeItem thisType, String pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, Stack<Loop> loops, Map<Loop, String> loopLabels, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, int forinlevel, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
private List<GraphTargetItem> commands(TypeItem thisType, DottedChain pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, Stack<Loop> loops, Map<Loop, String> loopLabels, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, int forinlevel, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
List<GraphTargetItem> ret = new ArrayList<>();
|
||||
if (debugMode) {
|
||||
System.out.println("commands:");
|
||||
@@ -159,12 +159,12 @@ public class ActionScript3Parser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private GraphTargetItem type(TypeItem thisType, String pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
private GraphTargetItem type(TypeItem thisType, DottedChain pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
ParsedSymbol s = lex();
|
||||
if (s.type == SymbolType.MULTIPLY) {
|
||||
return new UnboundedTypeItem();
|
||||
} else if (s.type == SymbolType.VOID) {
|
||||
return new TypeItem("void");
|
||||
return new TypeItem(new DottedChain("void"));
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
}
|
||||
@@ -174,7 +174,7 @@ public class ActionScript3Parser {
|
||||
return t;
|
||||
}
|
||||
|
||||
private GraphTargetItem memberOrCall(TypeItem thisType, String pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, GraphTargetItem newcmds, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
private GraphTargetItem memberOrCall(TypeItem thisType, DottedChain pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, GraphTargetItem newcmds, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
if (debugMode) {
|
||||
System.out.println("memberOrCall:");
|
||||
}
|
||||
@@ -223,7 +223,7 @@ public class ActionScript3Parser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private GraphTargetItem applyType(TypeItem thisType, String pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, GraphTargetItem obj, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
private GraphTargetItem applyType(TypeItem thisType, DottedChain pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, GraphTargetItem obj, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
GraphTargetItem ret = obj;
|
||||
ParsedSymbol s = lex();
|
||||
if (s.type == SymbolType.TYPENAME) {
|
||||
@@ -250,7 +250,7 @@ public class ActionScript3Parser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private GraphTargetItem member(TypeItem thisType, String pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, GraphTargetItem obj, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
private GraphTargetItem member(TypeItem thisType, DottedChain pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, GraphTargetItem obj, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
if (debugMode) {
|
||||
System.out.println("member:");
|
||||
}
|
||||
@@ -317,7 +317,7 @@ public class ActionScript3Parser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private GraphTargetItem name(TypeItem thisType, String pkg, Reference<Boolean> needsActivation, boolean typeOnly, List<Integer> openedNamespaces, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<AssignableAVM2Item> variables, List<DottedChain> importedClasses) throws IOException, AVM2ParseException {
|
||||
private GraphTargetItem name(TypeItem thisType, DottedChain pkg, Reference<Boolean> needsActivation, boolean typeOnly, List<Integer> openedNamespaces, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<AssignableAVM2Item> variables, List<DottedChain> importedClasses) throws IOException, AVM2ParseException {
|
||||
ParsedSymbol s = lex();
|
||||
DottedChain name = new DottedChain();
|
||||
String name2 = "";
|
||||
@@ -330,7 +330,7 @@ public class ActionScript3Parser {
|
||||
s = lex();
|
||||
boolean attrBracket = false;
|
||||
|
||||
name.parts.add(name2);
|
||||
name = name.add(name2);
|
||||
while (s.isType(SymbolType.DOT)) {
|
||||
//name += s.value.toString(); //. or ::
|
||||
s = lex();
|
||||
@@ -353,7 +353,7 @@ public class ActionScript3Parser {
|
||||
expected(s, lexer.yyline(), SymbolGroup.IDENTIFIER, SymbolType.NAMESPACE);
|
||||
name2 += s.value.toString();
|
||||
}
|
||||
name.parts.add(name2);
|
||||
name = name.add(name2);
|
||||
s = lex();
|
||||
}
|
||||
String nsname = null;
|
||||
@@ -373,7 +373,7 @@ public class ActionScript3Parser {
|
||||
}
|
||||
|
||||
GraphTargetItem ret = null;
|
||||
if (!name.parts.isEmpty()) {
|
||||
if (!name.isEmpty()) {
|
||||
UnresolvedAVM2Item unr = new UnresolvedAVM2Item(new ArrayList<>(), importedClasses, typeOnly, null, lexer.yyline(), name, null, openedNamespaces);
|
||||
//unr.setIndex(index);
|
||||
variables.add(unr);
|
||||
@@ -439,7 +439,7 @@ public class ActionScript3Parser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private List<GraphTargetItem> call(TypeItem thisType, String pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
private List<GraphTargetItem> call(TypeItem thisType, DottedChain pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
List<GraphTargetItem> ret = new ArrayList<>();
|
||||
//expected(SymbolType.PARENT_OPEN); //MUST BE HANDLED BY CALLER
|
||||
ParsedSymbol s = lex();
|
||||
@@ -454,12 +454,12 @@ public class ActionScript3Parser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private MethodAVM2Item method(String pkg, boolean isInterface, String customAccess, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, boolean override, boolean isFinal, TypeItem thisType, List<Integer> openedNamespaces, boolean isStatic, int namespace, String functionName, boolean isMethod, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
private MethodAVM2Item method(DottedChain pkg, boolean isInterface, String customAccess, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, boolean override, boolean isFinal, TypeItem thisType, List<Integer> openedNamespaces, boolean isStatic, int namespace, String functionName, boolean isMethod, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
FunctionAVM2Item f = function(pkg, isInterface, needsActivation, importedClasses, namespace, thisType, openedNamespaces, functionName, isMethod, variables);
|
||||
return new MethodAVM2Item(f.pkg, f.isInterface, customAccess, f.needsActivation, f.hasRest, f.line, override, isFinal, isStatic, f.namespace, functionName, f.paramTypes, f.paramNames, f.paramValues, f.body, f.subvariables, f.retType);
|
||||
}
|
||||
|
||||
private FunctionAVM2Item function(String pkg, boolean isInterface, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, int namespace, TypeItem thisType, List<Integer> openedNamespaces, String functionName, boolean isMethod, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
private FunctionAVM2Item function(DottedChain pkg, boolean isInterface, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, int namespace, TypeItem thisType, List<Integer> openedNamespaces, String functionName, boolean isMethod, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
openedNamespaces = new ArrayList<>(openedNamespaces); //local copy
|
||||
int line = lexer.yyline();
|
||||
ParsedSymbol s;
|
||||
@@ -540,10 +540,10 @@ public class ActionScript3Parser {
|
||||
return new FunctionAVM2Item(pkg, isInterface, needsActivation2.getVal(), namespace, hasRest, line, functionName, paramTypes, paramNames, paramValues, body, subvariables, retType);
|
||||
}
|
||||
|
||||
private GraphTargetItem traits(String scriptName, boolean scriptTraits, List<AssignableAVM2Item> sinitVariables, Reference<Boolean> sinitNeedsActivation, List<GraphTargetItem> staticInitializer, List<DottedChain> importedClasses, int privateNs, int protectedNs, int publicNs, int packageInternalNs, int protectedStaticNs, List<Integer> openedNamespaces, String pkg, String classNameStr, boolean isInterface, List<GraphTargetItem> traits) throws AVM2ParseException, IOException, CompilationException {
|
||||
private GraphTargetItem traits(String scriptName, boolean scriptTraits, List<AssignableAVM2Item> sinitVariables, Reference<Boolean> sinitNeedsActivation, List<GraphTargetItem> staticInitializer, List<DottedChain> importedClasses, int privateNs, int protectedNs, int publicNs, int packageInternalNs, int protectedStaticNs, List<Integer> openedNamespaces, DottedChain pkg, String classNameStr, boolean isInterface, List<GraphTargetItem> traits) throws AVM2ParseException, IOException, CompilationException {
|
||||
ParsedSymbol s;
|
||||
GraphTargetItem constr = null;
|
||||
TypeItem thisType = pkg == null && classNameStr == null ? null : new TypeItem(pkg == null || "".equals(pkg) ? classNameStr : pkg + "." + classNameStr);
|
||||
TypeItem thisType = pkg == null && classNameStr == null ? null : new TypeItem(pkg == null || pkg.isEmpty() ? new DottedChain(classNameStr) : pkg.add(classNameStr));
|
||||
List<AssignableAVM2Item> constrVariables = new ArrayList<>();
|
||||
List<Integer> originalOpenedNamespaces = openedNamespaces;
|
||||
int originalPrivateNs = privateNs;
|
||||
@@ -824,7 +824,7 @@ public class ActionScript3Parser {
|
||||
lexer.pushback(s);
|
||||
}
|
||||
|
||||
ConstAVM2Item ns = new ConstAVM2Item(pkg, customAccess, true, namespace, nname, new TypeItem("Namespace"), new StringAVM2Item(null, nval), lexer.yyline());
|
||||
ConstAVM2Item ns = new ConstAVM2Item(pkg, customAccess, true, namespace, nname, new TypeItem(new DottedChain("Namespace")), new StringAVM2Item(null, nval), lexer.yyline());
|
||||
traits.add(ns);
|
||||
break;
|
||||
case CONST:
|
||||
@@ -888,7 +888,7 @@ public class ActionScript3Parser {
|
||||
return constr;
|
||||
}
|
||||
|
||||
private GraphTargetItem classTraits(String scriptName, int gpublicNs, String pkg, List<DottedChain> importedClasses, boolean isDynamic, boolean isFinal, List<Integer> openedNamespaces, String packageName, int namespace, boolean isInterface, String nameStr, GraphTargetItem extendsStr, List<GraphTargetItem> implementsStr, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException, CompilationException {
|
||||
private GraphTargetItem classTraits(String scriptName, int gpublicNs, DottedChain pkg, List<DottedChain> importedClasses, boolean isDynamic, boolean isFinal, List<Integer> openedNamespaces, DottedChain packageName, int namespace, boolean isInterface, String nameStr, GraphTargetItem extendsStr, List<GraphTargetItem> implementsStr, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException, CompilationException {
|
||||
|
||||
GraphTargetItem ret = null;
|
||||
|
||||
@@ -1045,7 +1045,7 @@ public class ActionScript3Parser {
|
||||
}
|
||||
}
|
||||
|
||||
private List<GraphTargetItem> xmltag(TypeItem thisType, String pkg, Reference<Boolean> usesVars, List<String> openedTags, Reference<Integer> closedVarTags, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
private List<GraphTargetItem> xmltag(TypeItem thisType, DottedChain pkg, Reference<Boolean> usesVars, List<String> openedTags, Reference<Integer> closedVarTags, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
ParsedSymbol s = null;
|
||||
List<GraphTargetItem> rets = new ArrayList<>();
|
||||
//GraphTargetItem ret = null;
|
||||
@@ -1174,7 +1174,7 @@ public class ActionScript3Parser {
|
||||
return rets;
|
||||
}
|
||||
|
||||
private GraphTargetItem xml(TypeItem thisType, String pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
private GraphTargetItem xml(TypeItem thisType, DottedChain pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
List<String> openedTags = new ArrayList<>();
|
||||
int closedVarTags = 0;
|
||||
|
||||
@@ -1185,7 +1185,7 @@ public class ActionScript3Parser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private GraphTargetItem command(TypeItem thisType, String pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, Stack<Loop> loops, Map<Loop, String> loopLabels, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, int forinlevel, boolean mustBeCommand, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
private GraphTargetItem command(TypeItem thisType, DottedChain pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, Stack<Loop> loops, Map<Loop, String> loopLabels, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, int forinlevel, boolean mustBeCommand, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
LexBufferer buf = new LexBufferer();
|
||||
lexer.addListener(buf);
|
||||
GraphTargetItem ret = null;
|
||||
@@ -1668,7 +1668,7 @@ public class ActionScript3Parser {
|
||||
|
||||
}
|
||||
|
||||
private GraphTargetItem expression(TypeItem thisType, String pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
private GraphTargetItem expression(TypeItem thisType, DottedChain pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
return expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, false, registerVars, inFunction, inMethod, allowRemainder, variables);
|
||||
}
|
||||
|
||||
@@ -1736,7 +1736,7 @@ public class ActionScript3Parser {
|
||||
return false;
|
||||
}
|
||||
|
||||
private int brackets(TypeItem thisType, String pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, List<GraphTargetItem> ret, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
private int brackets(TypeItem thisType, DottedChain pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, List<GraphTargetItem> ret, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
ParsedSymbol s = lex();
|
||||
int arrCnt = 0;
|
||||
if (s.type == SymbolType.BRACKET_OPEN) {
|
||||
@@ -1760,7 +1760,7 @@ public class ActionScript3Parser {
|
||||
return arrCnt;
|
||||
}
|
||||
|
||||
private GraphTargetItem commaExpression(TypeItem thisType, String pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, Stack<Loop> loops, Map<Loop, String> loopLabels, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, int forInLevel, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
private GraphTargetItem commaExpression(TypeItem thisType, DottedChain pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, Stack<Loop> loops, Map<Loop, String> loopLabels, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, int forInLevel, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
GraphTargetItem cmd = null;
|
||||
List<GraphTargetItem> expr = new ArrayList<>();
|
||||
ParsedSymbol s;
|
||||
@@ -1782,7 +1782,7 @@ public class ActionScript3Parser {
|
||||
return new CommaExpressionItem(null, expr);
|
||||
}
|
||||
|
||||
private GraphTargetItem expression(TypeItem thisType, String pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, boolean allowEmpty, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
private GraphTargetItem expression(TypeItem thisType, DottedChain pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, boolean allowEmpty, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
GraphTargetItem prim = expressionPrimary(thisType, pkg, needsActivation, importedClasses, openedNamespaces, allowEmpty, registerVars, inFunction, inMethod, allowRemainder, variables);
|
||||
if (prim == null) {
|
||||
return null;
|
||||
@@ -1812,7 +1812,7 @@ public class ActionScript3Parser {
|
||||
return lookahead;
|
||||
}
|
||||
|
||||
private GraphTargetItem expression1(GraphTargetItem lhs, int min_precedence, TypeItem thisType, String pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, boolean allowEmpty, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
private GraphTargetItem expression1(GraphTargetItem lhs, int min_precedence, TypeItem thisType, DottedChain pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, boolean allowEmpty, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
if (debugMode) {
|
||||
System.out.println("expression1:");
|
||||
}
|
||||
@@ -2025,7 +2025,7 @@ public class ActionScript3Parser {
|
||||
return lhs;
|
||||
}
|
||||
|
||||
private GraphTargetItem expressionPrimary(TypeItem thisType, String pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, boolean allowEmpty, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
private GraphTargetItem expressionPrimary(TypeItem thisType, DottedChain pkg, Reference<Boolean> needsActivation, List<DottedChain> importedClasses, List<Integer> openedNamespaces, boolean allowEmpty, HashMap<String, Integer> registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List<AssignableAVM2Item> variables) throws IOException, AVM2ParseException {
|
||||
if (debugMode) {
|
||||
System.out.println("primary:");
|
||||
}
|
||||
@@ -2260,18 +2260,18 @@ public class ActionScript3Parser {
|
||||
private PackageAVM2Item parsePackage(List<Integer> openedNamespaces) throws IOException, AVM2ParseException, CompilationException {
|
||||
List<GraphTargetItem> items = new ArrayList<>();
|
||||
expectedType(SymbolType.PACKAGE);
|
||||
String name = "";
|
||||
DottedChain name = DottedChain.EMPTY;
|
||||
ParsedSymbol s = lex();
|
||||
if (s.type != SymbolType.CURLY_OPEN) {
|
||||
expected(s, lexer.yyline(), SymbolGroup.IDENTIFIER);
|
||||
name = s.value.toString();
|
||||
name = name.add(s.value.toString());
|
||||
s = lex();
|
||||
}
|
||||
while (s.type != SymbolType.CURLY_OPEN) {
|
||||
expected(s, lexer.yyline(), SymbolType.DOT);
|
||||
s = lex();
|
||||
expected(s, lexer.yyline(), SymbolGroup.IDENTIFIER);
|
||||
name += "." + s.value.toString();
|
||||
name.add(s.value.toString());
|
||||
s = lex();
|
||||
}
|
||||
|
||||
@@ -2283,7 +2283,7 @@ public class ActionScript3Parser {
|
||||
s = lex();
|
||||
expected(s, lexer.yyline(), SymbolGroup.IDENTIFIER);
|
||||
DottedChain imp = new DottedChain();
|
||||
imp.parts.add(s.value.toString());
|
||||
imp = imp.add(s.value.toString());
|
||||
s = lex();
|
||||
boolean isStar = false;
|
||||
while (s.type == SymbolType.DOT) {
|
||||
@@ -2295,7 +2295,7 @@ public class ActionScript3Parser {
|
||||
break;
|
||||
}
|
||||
expected(s, lexer.yyline(), SymbolGroup.IDENTIFIER);
|
||||
imp.parts.add(s.value.toString());
|
||||
imp = imp.add(s.value.toString());
|
||||
s = lex();
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.types.ValueKind;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
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;
|
||||
@@ -77,14 +78,12 @@ public class CallAVM2Item extends AVM2Item {
|
||||
List<ABC> allAbcs = new ArrayList<>();
|
||||
allAbcs.add(g.abc);
|
||||
allAbcs.addAll(g.allABCs);
|
||||
String cname;
|
||||
String pkgName = "";
|
||||
cname = localData.currentClass;
|
||||
pkgName = localData.pkg;
|
||||
String cname = localData.currentClass;
|
||||
DottedChain pkgName = localData.pkg;
|
||||
GraphTargetItem obj = null;
|
||||
Reference<String> outName = new Reference<>("");
|
||||
Reference<String> outNs = new Reference<>("");
|
||||
Reference<String> outPropNs = new Reference<>("");
|
||||
Reference<DottedChain> outNs = new Reference<>(DottedChain.EMPTY);
|
||||
Reference<DottedChain> outPropNs = new Reference<>(DottedChain.EMPTY);
|
||||
Reference<Integer> outPropNsKind = new Reference<>(1);
|
||||
Reference<Integer> outPropNsIndex = new Reference<>(0);
|
||||
Reference<GraphTargetItem> outPropType = new Reference<>(null);
|
||||
@@ -114,13 +113,11 @@ public class CallAVM2Item extends AVM2Item {
|
||||
List<ABC> allAbcs = new ArrayList<>();
|
||||
allAbcs.add(g.abc);
|
||||
allAbcs.addAll(g.allABCs);
|
||||
String cname;
|
||||
String pkgName = "";
|
||||
cname = localData.currentClass;
|
||||
pkgName = localData.pkg;
|
||||
String cname = localData.currentClass;
|
||||
DottedChain pkgName = localData.pkg;
|
||||
Reference<String> outName = new Reference<>("");
|
||||
Reference<String> outNs = new Reference<>("");
|
||||
Reference<String> outPropNs = new Reference<>("");
|
||||
Reference<DottedChain> outNs = new Reference<>(DottedChain.EMPTY);
|
||||
Reference<DottedChain> outPropNs = new Reference<>(DottedChain.EMPTY);
|
||||
Reference<Integer> outPropNsKind = new Reference<>(1);
|
||||
Reference<Integer> outPropNsIndex = new Reference<>(0);
|
||||
Reference<GraphTargetItem> outPropType = new Reference<>(null);
|
||||
|
||||
@@ -57,7 +57,7 @@ public class ClassAVM2Item extends AVM2Item implements Block {
|
||||
|
||||
public List<DottedChain> importedClasses;
|
||||
|
||||
public String pkg;
|
||||
public DottedChain pkg;
|
||||
|
||||
@Override
|
||||
public List<List<GraphTargetItem>> getSubs() {
|
||||
@@ -68,7 +68,7 @@ public class ClassAVM2Item extends AVM2Item implements Block {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public ClassAVM2Item(List<DottedChain> importedClasses, String pkg, List<Integer> openedNamespaces, int protectedNs, boolean isDynamic, boolean isFinal, int namespace, String className, GraphTargetItem extendsOp, List<GraphTargetItem> implementsOp, List<GraphTargetItem> staticInit, boolean staticInitActivation, List<AssignableAVM2Item> sinitVariables, GraphTargetItem constructor, List<GraphTargetItem> traits) {
|
||||
public ClassAVM2Item(List<DottedChain> importedClasses, DottedChain pkg, List<Integer> openedNamespaces, int protectedNs, boolean isDynamic, boolean isFinal, int namespace, String className, GraphTargetItem extendsOp, List<GraphTargetItem> implementsOp, List<GraphTargetItem> staticInit, boolean staticInitActivation, List<AssignableAVM2Item> sinitVariables, GraphTargetItem constructor, List<GraphTargetItem> traits) {
|
||||
super(null, NOPRECEDENCE);
|
||||
this.importedClasses = importedClasses;
|
||||
this.pkg = pkg;
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.parser.script;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
|
||||
@@ -39,7 +40,7 @@ public class ConstAVM2Item extends AVM2Item {
|
||||
|
||||
public int line;
|
||||
|
||||
public String pkg;
|
||||
public DottedChain pkg;
|
||||
|
||||
public int getNamespace() {
|
||||
return namespace;
|
||||
@@ -49,7 +50,7 @@ public class ConstAVM2Item extends AVM2Item {
|
||||
return isStatic;
|
||||
}
|
||||
|
||||
public ConstAVM2Item(String pkg, String customNamespace, boolean isStatic, int namespace, String var, GraphTargetItem type, GraphTargetItem value, int line) {
|
||||
public ConstAVM2Item(DottedChain pkg, String customNamespace, boolean isStatic, int namespace, String var, GraphTargetItem type, GraphTargetItem value, int line) {
|
||||
super(null, NOPRECEDENCE, value);
|
||||
this.pkg = pkg;
|
||||
this.line = line;
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
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;
|
||||
@@ -59,9 +60,9 @@ public class FunctionAVM2Item extends AVM2Item {
|
||||
|
||||
public boolean isInterface;
|
||||
|
||||
public String pkg;
|
||||
public DottedChain pkg;
|
||||
|
||||
public FunctionAVM2Item(String pkg, boolean isInterface, boolean needsActivation, int namespace, boolean hasRest, int line, String functionName, List<GraphTargetItem> paramTypes, List<String> paramNames, List<GraphTargetItem> paramValues, List<GraphTargetItem> body, List<AssignableAVM2Item> subvariables, GraphTargetItem retType) {
|
||||
public FunctionAVM2Item(DottedChain pkg, boolean isInterface, boolean needsActivation, int namespace, boolean hasRest, int line, String functionName, List<GraphTargetItem> paramTypes, List<String> paramNames, List<GraphTargetItem> paramValues, List<GraphTargetItem> body, List<AssignableAVM2Item> subvariables, GraphTargetItem retType) {
|
||||
super(null, NOPRECEDENCE);
|
||||
this.pkg = pkg;
|
||||
this.needsActivation = needsActivation;
|
||||
@@ -85,7 +86,7 @@ public class FunctionAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem("Function");
|
||||
return new TypeItem(new DottedChain("Function"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
|
||||
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,7 +26,7 @@ import java.util.List;
|
||||
*/
|
||||
public class GetterAVM2Item extends MethodAVM2Item {
|
||||
|
||||
public GetterAVM2Item(String pkg, boolean isInterface, String customNamespace, boolean needsActivation, boolean hasRest, int line, boolean override, boolean isFinal, boolean isStatic, int namespace, String methodName, List<GraphTargetItem> paramTypes, List<String> paramNames, List<GraphTargetItem> paramValues, List<GraphTargetItem> body, List<AssignableAVM2Item> subvariables, GraphTargetItem retType) {
|
||||
public GetterAVM2Item(DottedChain pkg, boolean isInterface, String customNamespace, boolean needsActivation, boolean hasRest, int line, boolean override, boolean isFinal, boolean isStatic, int namespace, String methodName, List<GraphTargetItem> paramTypes, List<String> paramNames, List<GraphTargetItem> paramValues, List<GraphTargetItem> body, List<AssignableAVM2Item> subvariables, GraphTargetItem retType) {
|
||||
super(pkg, isInterface, customNamespace, needsActivation, hasRest, line, override, isFinal, isStatic, namespace, methodName, paramTypes, paramNames, paramValues, body, subvariables, retType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ public class InterfaceAVM2Item extends AVM2Item {
|
||||
|
||||
public List<Integer> openedNamespaces;
|
||||
|
||||
public String pkg;
|
||||
public DottedChain pkg;
|
||||
|
||||
public List<DottedChain> importedClasses;
|
||||
|
||||
public InterfaceAVM2Item(List<DottedChain> importedClasses, String pkg, List<Integer> openedNamespaces, boolean isFinal, int namespace, String name, List<GraphTargetItem> superInterfaces, List<GraphTargetItem> traits) {
|
||||
public InterfaceAVM2Item(List<DottedChain> importedClasses, DottedChain pkg, List<Integer> openedNamespaces, boolean isFinal, int namespace, String name, List<GraphTargetItem> superInterfaces, List<GraphTargetItem> traits) {
|
||||
super(null, NOPRECEDENCE);
|
||||
this.importedClasses = importedClasses;
|
||||
this.pkg = pkg;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
|
||||
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import java.util.List;
|
||||
@@ -37,7 +38,7 @@ public class MethodAVM2Item extends FunctionAVM2Item {
|
||||
|
||||
public boolean isInterface;
|
||||
|
||||
public MethodAVM2Item(String pkg, boolean isInterface, String customNamespace, boolean needsActivation, boolean hasRest, int line, boolean override, boolean isFinal, boolean isStatic, int namespace, String methodName, List<GraphTargetItem> paramTypes, List<String> paramNames, List<GraphTargetItem> paramValues, List<GraphTargetItem> body, List<AssignableAVM2Item> subvariables, GraphTargetItem retType) {
|
||||
public MethodAVM2Item(DottedChain pkg, boolean isInterface, String customNamespace, boolean needsActivation, boolean hasRest, int line, boolean override, boolean isFinal, boolean isStatic, int namespace, String methodName, List<GraphTargetItem> paramTypes, List<String> paramNames, List<GraphTargetItem> paramValues, List<GraphTargetItem> body, List<AssignableAVM2Item> subvariables, GraphTargetItem retType) {
|
||||
super(pkg, isInterface, needsActivation, namespace, hasRest, line, methodName, paramTypes, paramNames, paramValues, body, subvariables, retType);
|
||||
this.isStatic = isStatic;
|
||||
this.override = override;
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.jpexs.decompiler.flash.abc.types.Multiname;
|
||||
import com.jpexs.decompiler.flash.abc.types.NamespaceSet;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
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;
|
||||
@@ -116,10 +117,10 @@ public class NamespacedAVM2Item extends AssignableAVM2Item {
|
||||
*/
|
||||
if (name != null) {
|
||||
return toSourceMerge(localData, generator,
|
||||
ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem("Namespace")),
|
||||
ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem(new 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("Namespace")),
|
||||
ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem(new 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)),
|
||||
@@ -168,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("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("Namespace")), nameItem, ins(new ConvertSIns()), assignedValue,
|
||||
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,
|
||||
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,
|
||||
@@ -177,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("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(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)),
|
||||
call ? dupSetTemp(localData, generator, obj_temp) : null,
|
||||
ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem("Namespace")), nameItem, ins(new ConvertSIns()),
|
||||
ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem(new 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,
|
||||
@@ -192,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("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("Namespace")), assignedValue,
|
||||
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,
|
||||
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,
|
||||
@@ -201,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("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(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)),
|
||||
call ? dupSetTemp(localData, generator, obj_temp) : null,
|
||||
ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem("Namespace")),
|
||||
ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem(new 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,
|
||||
|
||||
@@ -33,13 +33,13 @@ public class PackageAVM2Item extends AVM2Item {
|
||||
|
||||
public List<GraphTargetItem> items;
|
||||
|
||||
public String packageName;
|
||||
public DottedChain packageName;
|
||||
|
||||
public List<DottedChain> importedClasses = new ArrayList<>();
|
||||
|
||||
public int publicNs = 0;
|
||||
|
||||
public PackageAVM2Item(int publicNs, List<DottedChain> importedClasses, String packageName, List<GraphTargetItem> items) {
|
||||
public PackageAVM2Item(int publicNs, List<DottedChain> importedClasses, DottedChain packageName, List<GraphTargetItem> items) {
|
||||
super(null, NOPRECEDENCE);
|
||||
this.publicNs = publicNs;
|
||||
this.importedClasses = importedClasses;
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PopIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.types.ConvertDIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.ApplyTypeAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.CoerceAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.InitVectorAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.types.InstanceInfo;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.Multiname;
|
||||
@@ -44,6 +45,7 @@ import com.jpexs.decompiler.flash.abc.types.traits.Trait;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
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;
|
||||
@@ -195,19 +197,19 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
|
||||
List<ABC> abcs = new ArrayList<>();
|
||||
abcs.add(abc);
|
||||
abcs.addAll(otherABCs);
|
||||
if (ttype.equals(new TypeItem("__AS3__.vec.Vector"))) {
|
||||
if (ttype.equals(new TypeItem(InitVectorAVM2Item.VECTOR_FQN))) {
|
||||
switch ("" + objSubType) {
|
||||
case "int":
|
||||
ttype = new TypeItem("__AS3__.vec.Vector$int");
|
||||
ttype = new TypeItem(InitVectorAVM2Item.VECTOR_INT);
|
||||
break;
|
||||
case "Number":
|
||||
ttype = new TypeItem("__AS3__.vec.Vector$double");
|
||||
ttype = new TypeItem(InitVectorAVM2Item.VECTOR_DOUBLE);
|
||||
break;
|
||||
case "uint":
|
||||
ttype = new TypeItem("__AS3__.vec.Vector$uint");
|
||||
ttype = new TypeItem(InitVectorAVM2Item.VECTOR_UINT);
|
||||
break;
|
||||
default:
|
||||
ttype = new TypeItem("__AS3__.vec.Vector$object");
|
||||
ttype = new TypeItem(InitVectorAVM2Item.VECTOR_OBJECT);
|
||||
}
|
||||
}
|
||||
loopa:
|
||||
@@ -219,8 +221,8 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
|
||||
Multiname m = ii.getName(a.constants);
|
||||
if (multinameToType(ii.name_index, a.constants).equals(ttype)) {
|
||||
Reference<String> outName = new Reference<>("");
|
||||
Reference<String> outNs = new Reference<>("");
|
||||
Reference<String> outPropNs = new Reference<>("");
|
||||
Reference<DottedChain> outNs = new Reference<>(DottedChain.EMPTY);
|
||||
Reference<DottedChain> outPropNs = new Reference<>(DottedChain.EMPTY);
|
||||
Reference<Integer> outPropNsKind = new Reference<>(1);
|
||||
Reference<Integer> outPropNsIndex = new Reference<>(0);
|
||||
Reference<GraphTargetItem> outPropType = new Reference<>(null);
|
||||
@@ -248,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("Function");
|
||||
objType = new TypeItem(new DottedChain("Function"));
|
||||
propType = multinameToType(tsc.type_index, abc.constants);
|
||||
propIndex = tsc.name_index;
|
||||
if (!localData.traitUsages.containsKey(b)) {
|
||||
@@ -264,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;
|
||||
String 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, true);
|
||||
int name_index = 0;
|
||||
for (int m = 1; m < abc.constants.constant_multiname.size(); m++) {
|
||||
Multiname mname = abc.constants.constant_multiname.get(m);
|
||||
@@ -310,7 +312,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
|
||||
}
|
||||
for (Trait t : si.traits.traits) {
|
||||
if (t.name_index == name_index) {
|
||||
objType = new TypeItem("Object");
|
||||
objType = new TypeItem(new DottedChain("Object"));
|
||||
propType = AVM2SourceGenerator.getTraitReturnType(abc, t);
|
||||
propIndex = t.name_index;
|
||||
if (t instanceof TraitSlotConst) {
|
||||
@@ -336,8 +338,8 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
|
||||
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)) {
|
||||
Reference<String> outName = new Reference<>("");
|
||||
Reference<String> outNs = new Reference<>("");
|
||||
Reference<String> outPropNs = new Reference<>("");
|
||||
Reference<DottedChain> outNs = new Reference<>(DottedChain.EMPTY);
|
||||
Reference<DottedChain> outPropNs = new Reference<>(DottedChain.EMPTY);
|
||||
Reference<Integer> outPropNsKind = new Reference<>(1);
|
||||
Reference<Integer> outPropNsIndex = new Reference<>(0);
|
||||
Reference<GraphTargetItem> outPropType = new Reference<>(null);
|
||||
@@ -622,13 +624,11 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
|
||||
Object obj = object;
|
||||
|
||||
if (obj == null) {
|
||||
String cname;
|
||||
String pkgName = "";
|
||||
cname = localData.currentClass;
|
||||
pkgName = localData.pkg;
|
||||
String cname = localData.currentClass;
|
||||
DottedChain pkgName = localData.pkg;
|
||||
Reference<String> outName = new Reference<>("");
|
||||
Reference<String> outNs = new Reference<>("");
|
||||
Reference<String> outPropNs = new Reference<>("");
|
||||
Reference<DottedChain> outNs = new Reference<>(DottedChain.EMPTY);
|
||||
Reference<DottedChain> outPropNs = new Reference<>(DottedChain.EMPTY);
|
||||
Reference<Integer> outPropNsKind = new Reference<>(1);
|
||||
Reference<Integer> outPropNsIndex = new Reference<>(0);
|
||||
Reference<GraphTargetItem> outPropType = new Reference<>(null);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
|
||||
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,7 +26,7 @@ import java.util.List;
|
||||
*/
|
||||
public class SetterAVM2Item extends MethodAVM2Item {
|
||||
|
||||
public SetterAVM2Item(String pkg, boolean isInterface, String customNamespace, boolean needsActivation, boolean hasRest, int line, boolean override, boolean isFinal, boolean isStatic, int namespace, String methodName, List<GraphTargetItem> paramTypes, List<String> paramNames, List<GraphTargetItem> paramValues, List<GraphTargetItem> body, List<AssignableAVM2Item> subvariables, GraphTargetItem retType) {
|
||||
public SetterAVM2Item(DottedChain pkg, boolean isInterface, String customNamespace, boolean needsActivation, boolean hasRest, int line, boolean override, boolean isFinal, boolean isStatic, int namespace, String methodName, List<GraphTargetItem> paramTypes, List<String> paramNames, List<GraphTargetItem> paramValues, List<GraphTargetItem> body, List<AssignableAVM2Item> subvariables, GraphTargetItem retType) {
|
||||
super(pkg, isInterface, customNamespace, needsActivation, hasRest, line, override, isFinal, isStatic, namespace, methodName, paramTypes, paramNames, paramValues, body, subvariables, retType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.parser.script;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
|
||||
@@ -39,7 +40,7 @@ public class SlotAVM2Item extends AVM2Item {
|
||||
|
||||
public int line;
|
||||
|
||||
public String pkg;
|
||||
public DottedChain pkg;
|
||||
|
||||
public int getNamespace() {
|
||||
return namespace;
|
||||
@@ -49,7 +50,7 @@ public class SlotAVM2Item extends AVM2Item {
|
||||
return isStatic;
|
||||
}
|
||||
|
||||
public SlotAVM2Item(String pkg, String customNamespace, boolean isStatic, int namespace, String var, GraphTargetItem type, GraphTargetItem value, int line) {
|
||||
public SlotAVM2Item(DottedChain pkg, String customNamespace, boolean isStatic, int namespace, String var, GraphTargetItem type, GraphTargetItem value, int line) {
|
||||
super(null, NOPRECEDENCE, value);
|
||||
this.pkg = pkg;
|
||||
this.line = line;
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceAIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceSIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.types.ConvertIIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.InitVectorAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.NanAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.NullAVM2Item;
|
||||
@@ -127,7 +128,7 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
|
||||
*/
|
||||
|
||||
public void appendName(String name) {
|
||||
this.name.parts.add(name);
|
||||
this.name = this.name.add(name);
|
||||
}
|
||||
|
||||
public void setDefinition(boolean definition) {
|
||||
@@ -289,26 +290,25 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
|
||||
}
|
||||
|
||||
public GraphTargetItem resolve(GraphTargetItem thisType, List<GraphTargetItem> paramTypes, List<String> paramNames, ABC abc, List<ABC> otherAbcs, List<MethodBody> callStack, List<AssignableAVM2Item> variables) throws CompilationException {
|
||||
List<String> parts = name.parts;
|
||||
if (scopeStack.isEmpty()) { //Everything is multiname property in with command
|
||||
|
||||
//search for variable
|
||||
for (AssignableAVM2Item a : variables) {
|
||||
if (a instanceof NameAVM2Item) {
|
||||
NameAVM2Item n = (NameAVM2Item) a;
|
||||
if (n.isDefinition() && parts.get(0).equals(n.getVariableName())) {
|
||||
NameAVM2Item ret = new NameAVM2Item(n.type, n.line, parts.get(0), null, false, openedNamespaces);
|
||||
if (n.isDefinition() && name.get(0).equals(n.getVariableName())) {
|
||||
NameAVM2Item ret = new NameAVM2Item(n.type, n.line, name.get(0), null, false, openedNamespaces);
|
||||
ret.setSlotScope(n.getSlotScope());
|
||||
ret.setSlotNumber(n.getSlotNumber());
|
||||
ret.setRegNumber(n.getRegNumber());
|
||||
resolved = ret;
|
||||
for (int i = 1; i < parts.size(); i++) {
|
||||
resolved = new PropertyAVM2Item(resolved, parts.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<>());
|
||||
if (i == parts.size() - 1) {
|
||||
for (int i = 1; i < name.size(); i++) {
|
||||
resolved = new PropertyAVM2Item(resolved, name.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<>());
|
||||
if (i == name.size() - 1) {
|
||||
((PropertyAVM2Item) resolved).assignedValue = assignedValue;
|
||||
}
|
||||
}
|
||||
if (parts.size() == 1) {
|
||||
if (name.size() == 1) {
|
||||
ret.setAssignedValue(assignedValue);
|
||||
}
|
||||
ret.setNs(n.getNs());
|
||||
@@ -321,16 +321,16 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
|
||||
for (DottedChain imp : importedClasses) {
|
||||
String impName = imp.getLast();
|
||||
|
||||
if (impName.equals(parts.get(0))) {
|
||||
if (impName.equals(name.get(0))) {
|
||||
TypeItem ret = new TypeItem(imp);
|
||||
resolved = ret;
|
||||
for (int i = 1; i < parts.size(); i++) {
|
||||
resolved = new PropertyAVM2Item(resolved, parts.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<>());
|
||||
if (i == parts.size() - 1) {
|
||||
for (int i = 1; i < name.size(); i++) {
|
||||
resolved = new PropertyAVM2Item(resolved, name.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<>());
|
||||
if (i == name.size() - 1) {
|
||||
((PropertyAVM2Item) resolved).assignedValue = assignedValue;
|
||||
}
|
||||
}
|
||||
if (parts.size() == 1 && assignedValue != null) {
|
||||
if (name.size() == 1 && assignedValue != null) {
|
||||
throw new CompilationException("Cannot assign type", line);
|
||||
}
|
||||
return resolvedRoot = ret;
|
||||
@@ -341,26 +341,26 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
|
||||
List<ABC> allAbcs = new ArrayList<>();
|
||||
allAbcs.add(abc);
|
||||
allAbcs.addAll(otherAbcs);
|
||||
for (int i = 0; i < parts.size(); i++) {
|
||||
DottedChain fname = new DottedChain(parts.subList(0, i + 1)); //Helper.joinStrings(parts.subList(0, i + 1), ".");
|
||||
for (int i = 0; i < name.size(); i++) {
|
||||
DottedChain fname = name.subChain(i + 1);
|
||||
for (ABC a : allAbcs) {
|
||||
for (int c = 0; c < a.instance_info.size(); c++) {
|
||||
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))) {
|
||||
if (!subtypes.isEmpty() && parts.size() > i + 1) {
|
||||
if (!subtypes.isEmpty() && name.size() > i + 1) {
|
||||
continue;
|
||||
}
|
||||
TypeItem ret = new TypeItem(fname);
|
||||
resolved = ret;
|
||||
for (int j = i + 1; j < parts.size(); j++) {
|
||||
resolved = new PropertyAVM2Item(resolved, parts.get(j), abc, otherAbcs, openedNamespaces, new ArrayList<>());
|
||||
if (j == parts.size() - 1) {
|
||||
for (int j = i + 1; j < name.size(); j++) {
|
||||
resolved = new PropertyAVM2Item(resolved, name.get(j), abc, otherAbcs, openedNamespaces, new ArrayList<>());
|
||||
if (j == name.size() - 1) {
|
||||
((PropertyAVM2Item) resolved).assignedValue = assignedValue;
|
||||
}
|
||||
}
|
||||
if (parts.size() == i + 1 && assignedValue != null) {
|
||||
if (name.size() == i + 1 && assignedValue != null) {
|
||||
throw new CompilationException("Cannot assign type", line);
|
||||
}
|
||||
|
||||
@@ -382,10 +382,10 @@ 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), 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, true).toRawString(), a.constants))) {
|
||||
String cname = a.instance_info.get(c).getName(a.constants).getName(a.constants, null, true);
|
||||
if (parts.get(0).equals(cname)) {
|
||||
if (!subtypes.isEmpty() && parts.size() > 1) {
|
||||
if (name.get(0).equals(cname)) {
|
||||
if (!subtypes.isEmpty() && name.size() > 1) {
|
||||
continue;
|
||||
}
|
||||
TypeItem ret = new TypeItem(a.instance_info.get(c).getName(a.constants).getNameWithNamespace(a.constants));
|
||||
@@ -399,13 +399,13 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
|
||||
ret.subtypes.add(st.fullTypeName);
|
||||
}*/
|
||||
resolved = ret;
|
||||
for (int i = 1; i < parts.size(); i++) {
|
||||
resolved = new PropertyAVM2Item(resolved, parts.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<>());
|
||||
if (i == parts.size() - 1) {
|
||||
for (int i = 1; i < name.size(); i++) {
|
||||
resolved = new PropertyAVM2Item(resolved, name.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<>());
|
||||
if (i == name.size() - 1) {
|
||||
((PropertyAVM2Item) resolved).assignedValue = assignedValue;
|
||||
}
|
||||
}
|
||||
if (parts.size() == 1 && assignedValue != null) {
|
||||
if (name.size() == 1 && assignedValue != null) {
|
||||
throw new CompilationException("Cannot assign type", line);
|
||||
}
|
||||
|
||||
@@ -416,26 +416,26 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
|
||||
}
|
||||
}
|
||||
|
||||
if (parts.get(0).equals("this") || parts.get(0).equals("super")) {
|
||||
if (name.get(0).equals("this") || name.get(0).equals("super")) {
|
||||
if (thisType == null) {
|
||||
throw new CompilationException("Cannot use this in that context", line);
|
||||
}
|
||||
NameAVM2Item ret = new NameAVM2Item(thisType, line, parts.get(0), null, false, openedNamespaces);
|
||||
NameAVM2Item ret = new NameAVM2Item(thisType, line, name.get(0), null, false, openedNamespaces);
|
||||
resolved = ret;
|
||||
for (int i = 1; i < parts.size(); i++) {
|
||||
resolved = new PropertyAVM2Item(resolved, parts.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<>());
|
||||
if (i == parts.size() - 1) {
|
||||
for (int i = 1; i < name.size(); i++) {
|
||||
resolved = new PropertyAVM2Item(resolved, name.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<>());
|
||||
if (i == name.size() - 1) {
|
||||
((PropertyAVM2Item) resolved).assignedValue = assignedValue;
|
||||
}
|
||||
}
|
||||
if (parts.size() == 1) {
|
||||
if (name.size() == 1) {
|
||||
ret.setAssignedValue(assignedValue);
|
||||
}
|
||||
return resolvedRoot = ret;
|
||||
}
|
||||
|
||||
if (paramNames.contains(parts.get(0)) || parts.get(0).equals("arguments")) {
|
||||
int ind = paramNames.indexOf(parts.get(0));
|
||||
if (paramNames.contains(name.get(0)) || name.get(0).equals("arguments")) {
|
||||
int ind = paramNames.indexOf(name.get(0));
|
||||
GraphTargetItem t = TypeItem.UNBOUNDED;
|
||||
if (ind == -1) {
|
||||
|
||||
@@ -443,22 +443,22 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
|
||||
t = paramTypes.get(ind);
|
||||
} //else rest parameter
|
||||
|
||||
GraphTargetItem ret = new NameAVM2Item(t, line, parts.get(0), null, false, openedNamespaces);
|
||||
GraphTargetItem ret = new NameAVM2Item(t, line, name.get(0), null, false, openedNamespaces);
|
||||
resolved = ret;
|
||||
for (int i = 1; i < parts.size(); i++) {
|
||||
resolved = new PropertyAVM2Item(resolved, parts.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<>());
|
||||
if (i == parts.size() - 1) {
|
||||
for (int i = 1; i < name.size(); i++) {
|
||||
resolved = new PropertyAVM2Item(resolved, name.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<>());
|
||||
if (i == name.size() - 1) {
|
||||
((PropertyAVM2Item) resolved).assignedValue = assignedValue;
|
||||
}
|
||||
}
|
||||
if (parts.size() == 1) {
|
||||
if (name.size() == 1) {
|
||||
((NameAVM2Item) ret).setAssignedValue(assignedValue);
|
||||
}
|
||||
return resolvedRoot = ret;
|
||||
}
|
||||
|
||||
if (/*!subtypes.isEmpty() && */parts.size() == 1 && parts.get(0).equals("Vector")) {
|
||||
TypeItem ret = new TypeItem("__AS3__.vec.Vector");
|
||||
if (/*!subtypes.isEmpty() && */name.size() == 1 && name.get(0).equals("Vector")) {
|
||||
TypeItem ret = new TypeItem(InitVectorAVM2Item.VECTOR_FQN);
|
||||
/*for (String s : subtypes) {
|
||||
UnresolvedAVM2Item su = new UnresolvedAVM2Item(new ArrayList<>(), importedClasses, true, null, line, s, null, openedNamespaces);
|
||||
su.resolve(thisType, paramTypes, paramNames, abc, otherAbcs, callStack, variables);
|
||||
@@ -477,13 +477,13 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
|
||||
}
|
||||
resolved = null;
|
||||
GraphTargetItem ret = null;
|
||||
for (int i = 0; i < parts.size(); i++) {
|
||||
resolved = new PropertyAVM2Item(resolved, parts.get(i), abc, otherAbcs, openedNamespaces, callStack);
|
||||
for (int i = 0; i < name.size(); i++) {
|
||||
resolved = new PropertyAVM2Item(resolved, name.get(i), abc, otherAbcs, openedNamespaces, callStack);
|
||||
if (ret == null) {
|
||||
((PropertyAVM2Item) resolved).scopeStack = scopeStack;
|
||||
ret = resolved;
|
||||
}
|
||||
if (i == parts.size() - 1) {
|
||||
if (i == name.size() - 1) {
|
||||
((PropertyAVM2Item) resolved).setAssignedValue(assignedValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.types.Multiname;
|
||||
import com.jpexs.decompiler.flash.abc.types.Namespace;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
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;
|
||||
@@ -54,7 +55,7 @@ public class XMLAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem("XML");
|
||||
return new TypeItem(new DottedChain("XML"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
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;
|
||||
@@ -55,7 +56,7 @@ public class XMLFilterAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
return new TypeItem("String");
|
||||
return new TypeItem(new DottedChain("String"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -100,7 +100,7 @@ public class InstanceInfo {
|
||||
writer.hilightSpecial(abc.constants.getMultiname(name_index).getName(abc.constants, null/* No full names here*/, false), HighlightSpecialType.CLASS_NAME);
|
||||
|
||||
if (super_index > 0) {
|
||||
String typeName = abc.constants.getMultiname(super_index).getNameWithNamespace(abc.constants).toPrintableString();
|
||||
String typeName = abc.constants.getMultiname(super_index).getNameWithNamespace(abc.constants).toPrintableString(true);
|
||||
writer.appendNoHilight(" extends ");
|
||||
writer.hilightSpecial(abc.constants.getMultiname(super_index).getName(abc.constants, fullyQualifiedNames, false), HighlightSpecialType.TYPE_NAME, typeName);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public class InstanceInfo {
|
||||
if (i > 0) {
|
||||
writer.append(", ");
|
||||
}
|
||||
String typeName = abc.constants.getMultiname(interfaces[i]).getNameWithNamespace(abc.constants).toPrintableString();
|
||||
String typeName = abc.constants.getMultiname(interfaces[i]).getNameWithNamespace(abc.constants).toPrintableString(true);
|
||||
writer.hilightSpecial(abc.constants.getMultiname(interfaces[i]).getName(abc.constants, fullyQualifiedNames, false), HighlightSpecialType.TYPE_NAME, typeName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ public class MethodInfo {
|
||||
}
|
||||
String ptype = "*";
|
||||
if (param_types[i] > 0) {
|
||||
ptype = constants.getMultiname(param_types[i]).getNameWithNamespace(constants).toPrintableString();
|
||||
ptype = constants.getMultiname(param_types[i]).getNameWithNamespace(constants).toPrintableString(true);
|
||||
}
|
||||
|
||||
HighlightData pdata = new HighlightData();
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -189,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);
|
||||
String name = name_index == 0 ? null : constants.getNamespace(index).getName(constants, true).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) {
|
||||
@@ -296,27 +295,19 @@ public class Multiname {
|
||||
String name = constants.getString(name_index);
|
||||
if (fullyQualifiedNames != null && fullyQualifiedNames.contains(name)) {
|
||||
DottedChain dc = getNameWithNamespace(constants);
|
||||
return raw ? dc.toString() : dc.toPrintableString();
|
||||
return raw ? dc.toString() : dc.toPrintableString(true);
|
||||
}
|
||||
return (isAttribute() ? "@" : "") + (raw ? name : IdentifiersDeobfuscation.printIdentifier(true, name));
|
||||
}
|
||||
}
|
||||
|
||||
public DottedChain getNameWithNamespace(AVM2ConstantPool constants) {
|
||||
StringBuilder ret = new StringBuilder();
|
||||
Namespace ns = getNamespace(constants);
|
||||
List<String> chain = new ArrayList<>();
|
||||
String name = getName(constants, null, true);
|
||||
if (ns != null) {
|
||||
String nsname = ns.getName(constants, true);
|
||||
if (nsname != null && !nsname.isEmpty()) {
|
||||
String parts[] = nsname.split("\\.");
|
||||
for (String p : parts) {
|
||||
chain.add(p);
|
||||
}
|
||||
}
|
||||
return ns.getName(constants, true).add(name);
|
||||
}
|
||||
chain.add(getName(constants, null, true));
|
||||
return new DottedChain(chain);
|
||||
return new DottedChain(name);
|
||||
}
|
||||
|
||||
public Namespace getNamespace(AVM2ConstantPool constants) {
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.types;
|
||||
|
||||
import com.jpexs.decompiler.flash.IdentifiersDeobfuscation;
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
|
||||
public class Namespace {
|
||||
|
||||
@@ -94,7 +94,7 @@ public class Namespace {
|
||||
}
|
||||
|
||||
public String toString(AVM2ConstantPool constants) {
|
||||
return getName(constants, false);
|
||||
return getName(constants, false).toPrintableString(true);
|
||||
}
|
||||
|
||||
public String getNameWithKind(AVM2ConstantPool constants) {
|
||||
@@ -114,14 +114,12 @@ public class Namespace {
|
||||
return kindStr;
|
||||
}
|
||||
|
||||
public String getName(AVM2ConstantPool constants, boolean raw) {
|
||||
public DottedChain getName(AVM2ConstantPool constants, boolean raw) {
|
||||
if (name_index == 0) {
|
||||
return null;
|
||||
return DottedChain.EMPTY;
|
||||
}
|
||||
if (raw) {
|
||||
return constants.getString(name_index);
|
||||
}
|
||||
return IdentifiersDeobfuscation.printNamespace(true, constants.getString(name_index));
|
||||
|
||||
return constants.getDottedChain(name_index);
|
||||
}
|
||||
|
||||
public boolean hasName(String name, AVM2ConstantPool constants) {
|
||||
|
||||
@@ -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)) {
|
||||
String packageName = ns.getName(abc.constants, false); // assume not null package
|
||||
DottedChain packageName = ns.getName(abc.constants, false); // assume not null package
|
||||
String objectName = name.getName(abc.constants, null, false);
|
||||
List<Integer> traitIndices = new ArrayList<>();
|
||||
|
||||
@@ -83,7 +83,7 @@ public class ScriptInfo {
|
||||
otherTraits.clear();
|
||||
}
|
||||
|
||||
if (packagePrefix == null || packageName.startsWith(packagePrefix)) {
|
||||
if (packagePrefix == null || packageName.toPrintableString(true).startsWith(packagePrefix)) {
|
||||
ClassPath cp = new ClassPath(packageName, objectName);
|
||||
ret.add(new ScriptPack(cp, abc, allAbcs, scriptIndex, traitIndices));
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ public class ValueKind {
|
||||
case CONSTANT_ExplicitNamespace:
|
||||
case CONSTANT_StaticProtectedNs:
|
||||
case CONSTANT_PrivateNs:
|
||||
ret = "\"" + constants.getNamespace(value_index).getName(constants, true) + "\""; //assume not null name
|
||||
ret = "\"" + constants.getNamespace(value_index).getName(constants, true).toRawString() + "\""; //assume not null name
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -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);
|
||||
String nsname = ns.getName(abc.constants, false).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);
|
||||
String nsname = ns.getName(abc.constants, false).toPrintableString(true);
|
||||
convert(parent, path + nsname, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel);
|
||||
}
|
||||
}
|
||||
@@ -183,8 +183,8 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
public ClassPath getPath(ABC abc) {
|
||||
Multiname name = getName(abc);
|
||||
Namespace ns = name.getNamespace(abc.constants);
|
||||
String packageName = ns.getName(abc.constants, false);
|
||||
String objectName = name.getName(abc.constants, null, false);
|
||||
DottedChain packageName = ns.getName(abc.constants, false);
|
||||
String objectName = name.getName(abc.constants, null, true);
|
||||
return new ClassPath(packageName, objectName); //assume not null name
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.other.FindPropertyStrict
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.other.GetLexIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.types.AsTypeIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.InitVectorAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.types.ABCException;
|
||||
import com.jpexs.decompiler.flash.abc.types.ClassInfo;
|
||||
import com.jpexs.decompiler.flash.abc.types.InstanceInfo;
|
||||
@@ -95,13 +96,13 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
return "Class " + abc.constants.getMultiname(name_index).toString(abc.constants, fullyQualifiedNames) + " slot=" + slot_id + " class_info=" + class_info + " metadata=" + Helper.intArrToString(metadata);
|
||||
}
|
||||
|
||||
private boolean parseUsagesFromNS(ABC abc, List<DottedChain> imports, List<String> uses, int namespace_index, String ignorePackage, String name) {
|
||||
private boolean parseUsagesFromNS(ABC abc, List<DottedChain> imports, List<String> uses, int namespace_index, DottedChain ignorePackage, String name) {
|
||||
Namespace ns = abc.constants.getNamespace(namespace_index);
|
||||
if (name.isEmpty()) {
|
||||
name = "*";
|
||||
}
|
||||
String nsname = ns.getName(abc.constants, ns.kind == Namespace.KIND_NAMESPACE);
|
||||
DottedChain newimport = nsname == null ? new DottedChain() : new DottedChain(nsname.split("\\."));
|
||||
boolean raw = ns.kind == Namespace.KIND_NAMESPACE;
|
||||
DottedChain newimport = ns.getName(abc.constants, raw);
|
||||
/*if ((ns.kind != Namespace.KIND_PACKAGE)
|
||||
&& (ns.kind != Namespace.KIND_NAMESPACE)
|
||||
&& (ns.kind != Namespace.KIND_STATIC_PROTECTED)) {
|
||||
@@ -111,23 +112,21 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
DottedChain oldimport = newimport;
|
||||
newimport = new DottedChain();
|
||||
for (ABCContainerTag abcTag : abc.getAbcTags()) {
|
||||
DottedChain newname = abcTag.getABC().nsValueToName(oldimport == null ? null : oldimport.toString());
|
||||
if (newname.toString().equals("-")) {
|
||||
DottedChain newname = abcTag.getABC().nsValueToName(oldimport);
|
||||
if (newname.size() == 1 && newname.get(0).equals("-")) {
|
||||
return true;
|
||||
}
|
||||
if (!newname.toString().isEmpty()) {
|
||||
|
||||
if (!newname.isEmpty()) {
|
||||
newimport = newname;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (newimport.parts.isEmpty()) {
|
||||
newimport = oldimport;
|
||||
newimport.parts.add(name);
|
||||
if (newimport.isEmpty()) {
|
||||
newimport = oldimport.add(name);
|
||||
}
|
||||
if (!newimport.parts.isEmpty() && newimport.toString().isEmpty()) {
|
||||
newimport.parts.clear();
|
||||
}
|
||||
if (newimport.parts.isEmpty()) {
|
||||
|
||||
if (newimport.isEmpty()) {
|
||||
/* if(ns.kind==Namespace.KIND_PACKAGE){
|
||||
newimport+=".*";
|
||||
}*/
|
||||
@@ -141,7 +140,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
String usname = newimport.getLast();
|
||||
if (ns.kind == Namespace.KIND_PACKAGE) {
|
||||
if (!pkg.equals(ignorePackage)) {
|
||||
if (!pkg.toString().equals("__AS3__.vec")) { //Automatic import
|
||||
if (!pkg.equals(InitVectorAVM2Item.VECTOR_PACKAGE)) { //Automatic import
|
||||
imports.add(newimport);
|
||||
}
|
||||
}
|
||||
@@ -163,39 +162,35 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void parseImportsUsagesFromNS(ABC abc, List<DottedChain> imports, List<String> uses, int namespace_index, String ignorePackage, String name) {
|
||||
private void parseImportsUsagesFromNS(ABC abc, List<DottedChain> imports, List<String> uses, int namespace_index, DottedChain ignorePackage, String name) {
|
||||
Namespace ns = abc.constants.getNamespace(namespace_index);
|
||||
if (name.isEmpty()) {
|
||||
name = "*";
|
||||
}
|
||||
String niS = ns.getName(abc.constants, false);
|
||||
DottedChain newimport = niS == null ? new DottedChain() : new DottedChain(niS.split("\\."));
|
||||
DottedChain newimport = ns.getName(abc.constants, false);
|
||||
if (parseUsagesFromNS(abc, imports, uses, namespace_index, ignorePackage, name)) {
|
||||
return;
|
||||
} else if ((ns.kind != Namespace.KIND_PACKAGE) && (ns.kind != Namespace.KIND_PACKAGE_INTERNAL)) {
|
||||
return;
|
||||
}
|
||||
if (newimport.parts.isEmpty()) {
|
||||
newimport = new DottedChain("");
|
||||
}
|
||||
newimport.parts.add(name);
|
||||
newimport = newimport.add(name);
|
||||
//WUT?
|
||||
/*if (newimport.contains(":")) {
|
||||
return;
|
||||
}*/
|
||||
if (!imports.contains(newimport)) {
|
||||
DottedChain pkg = newimport.getWithoutLast(); //.substring(0, newimport.lastIndexOf('.'));
|
||||
if (pkg.toString().equals("__AS3__.vec")) { //special case - is imported always
|
||||
if (pkg.equals(InitVectorAVM2Item.VECTOR_PACKAGE)) { //special case - is imported always
|
||||
return;
|
||||
}
|
||||
if (!pkg.toString().equals(ignorePackage)) {
|
||||
if (!pkg.equals(ignorePackage)) {
|
||||
imports.add(newimport);
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
private void parseUsagesFromMultiname(ABC abc, List<DottedChain> imports, List<String> uses, Multiname m, String ignorePackage, List<DottedChain> fullyQualifiedNames) {
|
||||
private void parseUsagesFromMultiname(ABC abc, List<DottedChain> imports, List<String> uses, Multiname m, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames) {
|
||||
if (m != null) {
|
||||
if (m.kind == Multiname.TYPENAME) {
|
||||
if (m.qname_index != 0) {
|
||||
@@ -226,7 +221,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
}
|
||||
}
|
||||
|
||||
private void parseImportsUsagesFromMultiname(ABC abc, List<DottedChain> imports, List<String> uses, Multiname m, String ignorePackage, List<DottedChain> fullyQualifiedNames) {
|
||||
private void parseImportsUsagesFromMultiname(ABC abc, List<DottedChain> imports, List<String> uses, Multiname m, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames) {
|
||||
if (m != null) {
|
||||
if (m.kind == Multiname.TYPENAME) {
|
||||
if (m.qname_index != 0) {
|
||||
@@ -240,7 +235,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, true);
|
||||
NamespaceSet nss = m.getNamespaceSet(abc.constants);
|
||||
if (ns != null) {
|
||||
parseImportsUsagesFromNS(abc, imports, uses, m.namespace_index, ignorePackage, name);
|
||||
@@ -253,7 +248,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
}
|
||||
}
|
||||
|
||||
private void parseImportsUsagesFromMethodInfo(ABC abc, int method_index, List<DottedChain> imports, List<String> uses, String ignorePackage, List<DottedChain> fullyQualifiedNames, List<Integer> visitedMethods) {
|
||||
private void parseImportsUsagesFromMethodInfo(ABC abc, int method_index, List<DottedChain> imports, List<String> uses, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames, List<Integer> visitedMethods) {
|
||||
if ((method_index < 0) || (method_index >= abc.method_info.size())) {
|
||||
return;
|
||||
}
|
||||
@@ -274,7 +269,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
}
|
||||
for (AVM2Instruction ins : body.getCode().code) {
|
||||
if (ins.definition instanceof AlchemyTypeIns) {
|
||||
DottedChain nimport = new DottedChain((AlchemyTypeIns.ALCHEMY_PACKAGE + "." + ins.definition.instructionName).split("\\."));
|
||||
DottedChain nimport = AlchemyTypeIns.ALCHEMY_PACKAGE.add(ins.definition.instructionName);
|
||||
if (!imports.contains(nimport)) {
|
||||
imports.add(nimport);
|
||||
}
|
||||
@@ -312,13 +307,13 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
}
|
||||
}
|
||||
|
||||
private void parseImportsUsagesFromTraits(ABC abc, Traits ts, List<DottedChain> imports, List<String> uses, String ignorePackage, List<DottedChain> fullyQualifiedNames) {
|
||||
private void parseImportsUsagesFromTraits(ABC abc, Traits ts, List<DottedChain> imports, List<String> uses, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames) {
|
||||
for (Trait t : ts.traits) {
|
||||
parseImportsUsagesFromTrait(abc, t, imports, uses, ignorePackage, fullyQualifiedNames);
|
||||
}
|
||||
}
|
||||
|
||||
private void parseImportsUsagesFromTrait(ABC abc, Trait t, List<DottedChain> imports, List<String> uses, String ignorePackage, List<DottedChain> fullyQualifiedNames) {
|
||||
private void parseImportsUsagesFromTrait(ABC abc, Trait t, List<DottedChain> imports, List<String> uses, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames) {
|
||||
if (t instanceof TraitMethodGetterSetter) {
|
||||
TraitMethodGetterSetter tm = (TraitMethodGetterSetter) t;
|
||||
parseImportsUsagesFromMultiname(abc, imports, uses, abc.constants.getMultiname(tm.name_index), ignorePackage, fullyQualifiedNames);
|
||||
@@ -339,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);
|
||||
String 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, false); //assume not null name
|
||||
|
||||
parseImportsUsagesFromMultiname(abc, imports, uses, abc.constants.getMultiname(instanceInfo.name_index), packageName, fullyQualifiedNames);
|
||||
|
||||
@@ -380,13 +375,13 @@ 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);
|
||||
String packageName = instanceInfoMultiname.getNamespace(abc.constants).getName(abc.constants, false); //assume not null name
|
||||
DottedChain packageName = instanceInfoMultiname.getNamespace(abc.constants).getName(abc.constants, false); //assume not null name
|
||||
List<String> namesInThisPackage = new ArrayList<>();
|
||||
for (ABCContainerTag tag : abc.getAbcTags()) {
|
||||
for (ScriptInfo si : tag.getABC().script_info) {
|
||||
for (Trait t : si.traits.traits) {
|
||||
ClassPath classPath = t.getPath(tag.getABC());
|
||||
String pkg = classPath.packageStr == null ? "" : classPath.packageStr;
|
||||
DottedChain pkg = classPath.packageStr == null ? DottedChain.EMPTY : classPath.packageStr;
|
||||
if (pkg.equals(packageName)) {
|
||||
namesInThisPackage.add(classPath.className);
|
||||
}
|
||||
@@ -406,7 +401,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
for (DottedChain ipath : imports) {
|
||||
String name = ipath.getLast();
|
||||
DottedChain pkg = ipath.getWithoutLast();
|
||||
if (importnames.contains(name) || ((!pkg.parts.isEmpty()) && isBuiltInClass(name))) {
|
||||
if (importnames.contains(name) || isBuiltInClass(name)) {
|
||||
fullyQualifiedNames.add(new DottedChain(name));
|
||||
} else {
|
||||
importnames.add(name);
|
||||
@@ -429,13 +424,12 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
|
||||
for (int i = 0; i < imports.size(); i++) {
|
||||
DottedChain imp = imports.get(i);
|
||||
DottedChain pkg = imp.getWithoutLast(); //imp.substring(0, imp.lastIndexOf('.'));
|
||||
String name = imp.getLast();//imp.substring(imp.lastIndexOf('.') + 1);
|
||||
DottedChain pkg = imp.getWithoutLast();
|
||||
String name = imp.getLast();
|
||||
if (name.equals("*")) {
|
||||
continue;
|
||||
}
|
||||
DottedChain dAll = new DottedChain(pkg.parts);
|
||||
dAll.parts.add("*");
|
||||
DottedChain dAll = pkg.add("*");
|
||||
if (imports.contains(dAll)) {
|
||||
imports.remove(i);
|
||||
i--;
|
||||
@@ -444,8 +438,8 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
|
||||
boolean hasImport = false;
|
||||
for (DottedChain imp : imports) {
|
||||
if (!imp.parts.get(0).isEmpty()) { //No imports from root package
|
||||
writer.appendNoHilight("import " + imp + ";").newLine();
|
||||
if (imp.size() > 1) { //No imports from root package
|
||||
writer.appendNoHilight("import " + imp.toPrintableString(true) + ";").newLine();
|
||||
hasImport = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
@@ -30,6 +30,6 @@ public class ClassNameMultinameUsage extends InsideClassMultinameUsage implement
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "class " + abc.constants.getMultiname(abc.instance_info.get(classIndex).name_index).getNameWithNamespace(abc.constants).toPrintableString();
|
||||
return "class " + abc.constants.getMultiname(abc.instance_info.get(classIndex).name_index).getNameWithNamespace(abc.constants).toPrintableString(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public abstract class InsideClassMultinameUsage extends MultinameUsage {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "class " + abc.constants.getMultiname(abc.instance_info.get(classIndex).name_index).getNameWithNamespace(abc.constants).toPrintableString();
|
||||
return "class " + abc.constants.getMultiname(abc.instance_info.get(classIndex).name_index).getNameWithNamespace(abc.constants).toPrintableString(true);
|
||||
}
|
||||
|
||||
public int getMultinameIndex() {
|
||||
|
||||
@@ -201,31 +201,21 @@ public class DoInitActionTag extends Tag implements CharacterIdTag, ASMSource {
|
||||
|
||||
@Override
|
||||
public String getExportFileName() {
|
||||
String expName = swf.getExportName(spriteId);
|
||||
if ((expName == null) || expName.isEmpty()) {
|
||||
String expName = swf == null ? "" : swf.getExportName(spriteId);
|
||||
if (expName == null || expName.isEmpty()) {
|
||||
return super.getExportFileName();
|
||||
}
|
||||
String[] pathParts;
|
||||
if (expName.contains(".")) {
|
||||
pathParts = expName.split("\\.");
|
||||
} else {
|
||||
pathParts = new String[]{expName};
|
||||
}
|
||||
String[] pathParts = expName.contains(".") ? expName.split("\\.") : new String[]{expName};
|
||||
return pathParts[pathParts.length - 1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
String expName = swf == null ? "" : swf.getExportName(spriteId);
|
||||
if ((expName == null) || expName.isEmpty()) {
|
||||
if (expName == null || expName.isEmpty()) {
|
||||
return super.getName();
|
||||
}
|
||||
String[] pathParts;
|
||||
if (expName.contains(".")) {
|
||||
pathParts = expName.split("\\.");
|
||||
} else {
|
||||
pathParts = new String[]{expName};
|
||||
}
|
||||
String[] pathParts = expName.contains(".") ? expName.split("\\.") : new String[]{expName};
|
||||
return pathParts[pathParts.length - 1];
|
||||
}
|
||||
|
||||
|
||||
@@ -17,80 +17,144 @@
|
||||
package com.jpexs.decompiler.graph;
|
||||
|
||||
import com.jpexs.decompiler.flash.IdentifiersDeobfuscation;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DottedChain {
|
||||
public class DottedChain implements Serializable {
|
||||
|
||||
public final List<String> parts;
|
||||
public static final DottedChain EMPTY = new DottedChain();
|
||||
|
||||
private final String[] parts;
|
||||
|
||||
private final int hash;
|
||||
|
||||
public DottedChain(List<String> parts) {
|
||||
this.parts = new ArrayList<>(parts);
|
||||
this.parts = parts.toArray(new String[parts.size()]);
|
||||
hash = calcHash();
|
||||
}
|
||||
|
||||
public DottedChain(String... parts) {
|
||||
this.parts = new ArrayList<>();
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
this.parts.add(parts[i]);
|
||||
}
|
||||
this.parts = parts;
|
||||
hash = calcHash();
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return parts.length == 0;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return parts.length;
|
||||
}
|
||||
|
||||
public String get(int index) {
|
||||
return parts[index];
|
||||
}
|
||||
|
||||
public DottedChain subChain(int count) {
|
||||
String[] nparts = Arrays.copyOfRange(parts, 0, count);
|
||||
return new DottedChain(nparts);
|
||||
}
|
||||
|
||||
public String getLast() {
|
||||
if (parts.isEmpty()) {
|
||||
if (parts.length == 0) {
|
||||
return "";
|
||||
} else {
|
||||
return parts.get(parts.size() - 1);
|
||||
return parts[parts.length - 1];
|
||||
}
|
||||
}
|
||||
|
||||
public DottedChain getWithoutLast() {
|
||||
List<String> nparts = new ArrayList<>(parts);
|
||||
if (!nparts.isEmpty()) {
|
||||
nparts.remove(nparts.size() - 1);
|
||||
if (parts.length < 2) {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
String[] nparts = Arrays.copyOfRange(parts, 0, parts.length - 1);
|
||||
return new DottedChain(nparts);
|
||||
}
|
||||
|
||||
public String toPrintableString() {
|
||||
public DottedChain add(String name) {
|
||||
String[] nparts = new String[parts.length + 1];
|
||||
if (parts.length > 0) {
|
||||
System.arraycopy(parts, 0, nparts, 0, parts.length);
|
||||
}
|
||||
|
||||
nparts[nparts.length - 1] = name;
|
||||
return new DottedChain(nparts);
|
||||
}
|
||||
|
||||
private String toString(boolean as3, boolean raw) {
|
||||
if (parts.length == 0 || (parts.length == 1 && parts[0].isEmpty())) {
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuilder ret = new StringBuilder();
|
||||
for (int i = 0; i < parts.size(); i++) {
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
if (i > 0) {
|
||||
ret.append(".");
|
||||
}
|
||||
ret.append(IdentifiersDeobfuscation.printIdentifier(true, parts.get(0)));
|
||||
|
||||
String part = parts[i];
|
||||
boolean lastStar = i == parts.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())) {
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuilder ret = new StringBuilder();
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
if (i > 0) {
|
||||
ret.append(File.separator);
|
||||
}
|
||||
|
||||
ret.append(Helper.makeFileName(IdentifiersDeobfuscation.printIdentifier(true, parts[i])));
|
||||
}
|
||||
return ret.toString();
|
||||
}
|
||||
|
||||
public List<String> toList() {
|
||||
return new ArrayList<>(Arrays.asList(parts));
|
||||
}
|
||||
|
||||
public String toPrintableString(boolean as3) {
|
||||
return toString(as3, false);
|
||||
}
|
||||
|
||||
public String toRawString() {
|
||||
return toString(false/*ignored*/, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder ret = new StringBuilder();
|
||||
for (int i = 0; i < parts.size(); i++) {
|
||||
if (i > 0) {
|
||||
ret.append(".");
|
||||
}
|
||||
ret.append(parts.get(i));
|
||||
}
|
||||
return ret.toString();
|
||||
return toRawString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 89 * hash + Objects.hashCode(parts);
|
||||
return hash;
|
||||
}
|
||||
|
||||
private int calcHash() {
|
||||
if (parts.length > 0 && parts[0].equals("§§")) {
|
||||
int a = 1;
|
||||
}
|
||||
return Arrays.hashCode(parts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof String) {
|
||||
obj = new DottedChain(((String) obj).split("\\."));
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -98,7 +162,7 @@ public class DottedChain {
|
||||
return false;
|
||||
}
|
||||
final DottedChain other = (DottedChain) obj;
|
||||
if (!Objects.equals(parts, other.parts)) {
|
||||
if (!Arrays.equals(parts, other.parts)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -32,11 +32,11 @@ import java.util.Objects;
|
||||
*/
|
||||
public class TypeItem extends GraphTargetItem {
|
||||
|
||||
public static TypeItem BOOLEAN = new TypeItem("Boolean");
|
||||
public static TypeItem BOOLEAN = new TypeItem(new DottedChain("Boolean"));
|
||||
|
||||
public static TypeItem STRING = new TypeItem("String");
|
||||
public static TypeItem STRING = new TypeItem(new DottedChain("String"));
|
||||
|
||||
public static TypeItem ARRAY = new TypeItem("Array");
|
||||
public static TypeItem ARRAY = new TypeItem(new DottedChain("Array"));
|
||||
|
||||
public static UnboundedTypeItem UNBOUNDED = new UnboundedTypeItem();
|
||||
|
||||
@@ -79,10 +79,11 @@ public class TypeItem extends GraphTargetItem {
|
||||
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
|
||||
boolean as3 = localData.constantsAvm2 != null;
|
||||
if (localData.fullyQualifiedNames.contains(fullTypeName)) {
|
||||
writer.hilightSpecial(IdentifiersDeobfuscation.printNamespace(localData.constantsAvm2 != null, fullTypeName.toPrintableString()), HighlightSpecialType.TYPE_NAME, fullTypeName.toPrintableString());
|
||||
writer.hilightSpecial(fullTypeName.toPrintableString(as3), HighlightSpecialType.TYPE_NAME, fullTypeName.toPrintableString(as3));
|
||||
} else {
|
||||
writer.hilightSpecial(IdentifiersDeobfuscation.printIdentifier(localData.constantsAvm2 != null, fullTypeName.getLast()), HighlightSpecialType.TYPE_NAME, fullTypeName.toPrintableString());
|
||||
writer.hilightSpecial(IdentifiersDeobfuscation.printIdentifier(as3, fullTypeName.getLast()), HighlightSpecialType.TYPE_NAME, fullTypeName.toPrintableString(as3));
|
||||
}
|
||||
|
||||
return writer;
|
||||
@@ -100,7 +101,7 @@ public class TypeItem extends GraphTargetItem {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return fullTypeName.toString();
|
||||
return fullTypeName.toRawString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user