mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 20:20:51 +00:00
highlighting refactored
This commit is contained in:
@@ -563,7 +563,7 @@ public class ABC {
|
||||
loadNamespaceMap();
|
||||
/*for(int i=0;i<script_count;i++){
|
||||
MethodBody bod=bodies.get(bodyIdxFromMethodIdx.get(script_info.get(i).init_index));
|
||||
GraphTextWriter t=new HilightedTextWriter(Configuration.getCodeFormatting(),false);
|
||||
GraphTextWriter t=new HighlightedTextWriter(Configuration.getCodeFormatting(),false);
|
||||
try {
|
||||
bod.toString("script", ScriptExportMode.PCODE, this, null, constants, method_info, t, new ArrayList<String>());
|
||||
} catch (InterruptedException ex) {
|
||||
|
||||
@@ -221,7 +221,8 @@ import com.jpexs.decompiler.flash.dumpview.DumpInfo;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.HighlightSpecialType;
|
||||
import com.jpexs.decompiler.graph.Block;
|
||||
import com.jpexs.decompiler.graph.Graph;
|
||||
import com.jpexs.decompiler.graph.GraphPart;
|
||||
@@ -927,10 +928,10 @@ public class AVM2Code implements Cloneable {
|
||||
if (trait instanceof TraitFunction) {
|
||||
TraitFunction tf = (TraitFunction) trait;
|
||||
writer.appendNoHilight("trait ");
|
||||
writer.hilightSpecial("function ", "traittype");
|
||||
writer.hilightSpecial(constants.multinameToString(tf.name_index), "traitname");
|
||||
writer.hilightSpecial("function ", HighlightSpecialType.TRAIT_TYPE);
|
||||
writer.hilightSpecial(constants.multinameToString(tf.name_index), HighlightSpecialType.TRAIT_NAME);
|
||||
writer.appendNoHilight(" slotid ");
|
||||
writer.hilightSpecial("" + tf.slot_id, "slotid");
|
||||
writer.hilightSpecial("" + tf.slot_id, HighlightSpecialType.SLOT_ID);
|
||||
writer.newLine();
|
||||
}
|
||||
if (trait instanceof TraitMethodGetterSetter) {
|
||||
@@ -938,70 +939,70 @@ public class AVM2Code implements Cloneable {
|
||||
writer.appendNoHilight("trait ");
|
||||
switch (tm.kindType) {
|
||||
case Trait.TRAIT_METHOD:
|
||||
writer.hilightSpecial("method ", "traittype");
|
||||
writer.hilightSpecial("method ", HighlightSpecialType.TRAIT_TYPE);
|
||||
break;
|
||||
case Trait.TRAIT_GETTER:
|
||||
writer.hilightSpecial("getter ", "traittype");
|
||||
writer.hilightSpecial("getter ", HighlightSpecialType.TRAIT_TYPE);
|
||||
break;
|
||||
case Trait.TRAIT_SETTER:
|
||||
writer.hilightSpecial("setter ", "traittype");
|
||||
writer.hilightSpecial("setter ", HighlightSpecialType.TRAIT_TYPE);
|
||||
break;
|
||||
}
|
||||
writer.hilightSpecial(constants.multinameToString(tm.name_index), "traitname");
|
||||
writer.hilightSpecial(constants.multinameToString(tm.name_index), HighlightSpecialType.TRAIT_NAME);
|
||||
writer.appendNoHilight(" dispid ");
|
||||
writer.hilightSpecial("" + tm.disp_id, "dispid");
|
||||
writer.hilightSpecial("" + tm.disp_id, HighlightSpecialType.DISP_ID);
|
||||
writer.newLine();
|
||||
}
|
||||
}
|
||||
if (info != null) {
|
||||
writer.appendNoHilight("method").newLine();
|
||||
writer.appendNoHilight("name ");
|
||||
writer.hilightSpecial(info.name_index == 0 ? "null" : "\"" + Helper.escapeString(info.getName(constants)) + "\"", "methodname");
|
||||
writer.hilightSpecial(info.name_index == 0 ? "null" : "\"" + Helper.escapeString(info.getName(constants)) + "\"", HighlightSpecialType.METHOD_NAME);
|
||||
writer.newLine();
|
||||
if (info.flagExplicit()) {
|
||||
writer.appendNoHilight("flag ");
|
||||
writer.hilightSpecial("EXPLICIT", "flag.EXPLICIT");
|
||||
writer.hilightSpecial("EXPLICIT", HighlightSpecialType.FLAG_EXPLICIT);
|
||||
writer.newLine();
|
||||
}
|
||||
if (info.flagHas_optional()) {
|
||||
writer.appendNoHilight("flag ");
|
||||
writer.hilightSpecial("HAS_OPTIONAL", "flag.HAS_OPTIONAL");
|
||||
writer.hilightSpecial("HAS_OPTIONAL", HighlightSpecialType.FLAG_HAS_OPTIONAL);
|
||||
writer.newLine();
|
||||
writer.appendNoHilight("flag HAS_OPTIONAL").newLine();
|
||||
}
|
||||
if (info.flagHas_paramnames()) {
|
||||
writer.appendNoHilight("flag ");
|
||||
writer.hilightSpecial("HAS_PARAM_NAMES", "flag.HAS_PARAM_NAMES");
|
||||
writer.hilightSpecial("HAS_PARAM_NAMES", HighlightSpecialType.FLAG_HAS_PARAM_NAMES);
|
||||
writer.newLine();
|
||||
}
|
||||
if (info.flagIgnore_rest()) {
|
||||
writer.appendNoHilight("flag ");
|
||||
writer.hilightSpecial("EXPLICIT", "flag.IGNORE_REST");
|
||||
writer.hilightSpecial("EXPLICIT", HighlightSpecialType.FLAG_IGNORE_REST);
|
||||
writer.newLine();
|
||||
}
|
||||
if (info.flagNeed_activation()) {
|
||||
writer.appendNoHilight("flag ");
|
||||
writer.hilightSpecial("NEED_ACTIVATION", "flag.NEED_ACTIVATION");
|
||||
writer.hilightSpecial("NEED_ACTIVATION", HighlightSpecialType.FLAG_NEED_ACTIVATION);
|
||||
writer.newLine();
|
||||
}
|
||||
if (info.flagNeed_arguments()) {
|
||||
writer.appendNoHilight("flag ");
|
||||
writer.hilightSpecial("NEED_ARGUMENTS", "flag.NEED_ARGUMENTS");
|
||||
writer.hilightSpecial("NEED_ARGUMENTS", HighlightSpecialType.FLAG_NEED_ARGUMENTS);
|
||||
writer.newLine();
|
||||
}
|
||||
if (info.flagNeed_rest()) {
|
||||
writer.appendNoHilight("flag ");
|
||||
writer.hilightSpecial("NEED_REST", "flag.NEED_REST");
|
||||
writer.hilightSpecial("NEED_REST", HighlightSpecialType.FLAG_NEED_REST);
|
||||
writer.newLine();
|
||||
}
|
||||
if (info.flagSetsdxns()) {
|
||||
writer.appendNoHilight("flag ");
|
||||
writer.hilightSpecial("SET_DXNS", "flag.SET_DXNS");
|
||||
writer.hilightSpecial("SET_DXNS", HighlightSpecialType.FLAG_SET_DXNS);
|
||||
writer.newLine();
|
||||
}
|
||||
for (int p = 0; p < info.param_types.length; p++) {
|
||||
writer.appendNoHilight("param ");
|
||||
writer.hilightSpecial(constants.multinameToString(info.param_types[p]), "param", p);
|
||||
writer.hilightSpecial(constants.multinameToString(info.param_types[p]), HighlightSpecialType.PARAM, p);
|
||||
writer.newLine();
|
||||
}
|
||||
if (info.flagHas_paramnames()) {
|
||||
@@ -1021,12 +1022,12 @@ public class AVM2Code implements Cloneable {
|
||||
for (int i = 0; i < info.optional.length; i++) {
|
||||
ValueKind vk = info.optional[i];
|
||||
writer.appendNoHilight("optional ");
|
||||
writer.hilightSpecial(vk.toString(constants), "optional", i);
|
||||
writer.hilightSpecial(vk.toString(constants), HighlightSpecialType.OPTIONAL, i);
|
||||
writer.newLine();
|
||||
}
|
||||
}
|
||||
writer.appendNoHilight("returns ");
|
||||
writer.hilightSpecial(constants.multinameToString(info.ret_type), "returns");
|
||||
writer.hilightSpecial(constants.multinameToString(info.ret_type), HighlightSpecialType.RETURNS);
|
||||
writer.newLine();
|
||||
}
|
||||
writer.newLine();
|
||||
@@ -1068,10 +1069,10 @@ public class AVM2Code implements Cloneable {
|
||||
offsets.add((long) body.exceptions[e].target);
|
||||
|
||||
writer.appendNoHilight(" type ");
|
||||
writer.hilightSpecial(body.exceptions[e].type_index == 0 ? "null" : constants.getMultiname(body.exceptions[e].type_index).toString(constants, new ArrayList<String>()), "try.type", e);
|
||||
writer.hilightSpecial(body.exceptions[e].type_index == 0 ? "null" : constants.getMultiname(body.exceptions[e].type_index).toString(constants, new ArrayList<String>()), HighlightSpecialType.TRY_TYPE, e);
|
||||
|
||||
writer.appendNoHilight(" name ");
|
||||
writer.hilightSpecial(body.exceptions[e].name_index == 0 ? "null" : constants.getMultiname(body.exceptions[e].name_index).toString(constants, new ArrayList<String>()), "try.name", e);
|
||||
writer.hilightSpecial(body.exceptions[e].name_index == 0 ? "null" : constants.getMultiname(body.exceptions[e].name_index).toString(constants, new ArrayList<String>()), HighlightSpecialType.TRY_NAME, e);
|
||||
writer.newLine();
|
||||
}
|
||||
|
||||
@@ -2448,7 +2449,7 @@ public class AVM2Code implements Cloneable {
|
||||
invalidateCache();
|
||||
try {
|
||||
List<Integer> outputMap = new ArrayList<>();
|
||||
HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), false);
|
||||
toASMSource(constants, trait, info, body, outputMap, ScriptExportMode.PCODE, writer);
|
||||
String src = writer.toString();
|
||||
|
||||
@@ -2490,7 +2491,7 @@ public class AVM2Code implements Cloneable {
|
||||
public void removeIgnored(AVM2ConstantPool constants, Trait trait, MethodInfo info, MethodBody body) throws InterruptedException {
|
||||
try {
|
||||
List<Integer> outputMap = new ArrayList<>();
|
||||
HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), false);
|
||||
toASMSource(constants, trait, info, body, outputMap, ScriptExportMode.PCODE, writer);
|
||||
String src = writer.toString();
|
||||
AVM2Code acode = ASM3Parser.parse(new StringReader(src), constants, trait, body, info);
|
||||
|
||||
+2
-2
@@ -25,7 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.model.UnparsedAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
@@ -42,7 +42,7 @@ public class NewClassIns extends InstructionDefinition {
|
||||
@Override
|
||||
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) throws InterruptedException {
|
||||
int clsIndex = ins.operands[0];
|
||||
HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), false);
|
||||
stack.pop().toString(writer, LocalData.create(constants, localRegNames, fullyQualifiedNames));
|
||||
String baseType = writer.toString();
|
||||
stack.push(new UnparsedAVM2Item(ins, "new " + abc.constants.getMultiname(abc.instance_info.get(clsIndex).name_index).getName(constants, fullyQualifiedNames, false) + ".class extends " + baseType));
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ import com.jpexs.decompiler.flash.abc.avm2.model.SetSuperAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
@@ -56,7 +56,7 @@ public class SetSuperIns extends InstructionDefinition implements SetTypeIns {
|
||||
public String getObject(Stack<AVM2Item> stack, ABC abc, AVM2Instruction ins, List<AVM2Item> output, MethodBody body, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) throws InterruptedException {
|
||||
int multinameIndex = ins.operands[0];
|
||||
String multiname = resolveMultinameNoPop(1, stack, abc.constants, multinameIndex, ins, fullyQualifiedNames);
|
||||
HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), false);
|
||||
stack.get(1 + resolvedCount(abc.constants, multinameIndex)).toString(writer, LocalData.create(abc.constants, localRegNames, fullyQualifiedNames));
|
||||
String obj = writer.toString();
|
||||
return obj + ".super." + multiname;
|
||||
|
||||
@@ -36,7 +36,7 @@ public class GetLexAVM2Item extends AVM2Item {
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
|
||||
|
||||
String localName = propertyName.getName(localData.constantsAvm2, localData.fullyQualifiedNames, false);
|
||||
srcData.put("localName", localName);
|
||||
srcData.localName = localName;
|
||||
return writer.append(propertyName.getName(localData.constantsAvm2, localData.fullyQualifiedNames, false));
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class GetSlotAVM2Item extends AVM2Item {
|
||||
if (slotName == null) {
|
||||
return writer.append("/*UnknownSlot*/");
|
||||
}
|
||||
srcData.put("localName", getNameAsStr(localData));
|
||||
srcData.localName = getNameAsStr(localData);
|
||||
|
||||
return writer.append(slotName.getName(localData.constantsAvm2, localData.fullyQualifiedNames, false));
|
||||
}
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ public class LocalRegAVM2Item extends AVM2Item {
|
||||
return computedValue.toString(writer, localData);
|
||||
}
|
||||
String localName = localRegName(localData.localRegNames, regIndex);
|
||||
srcData.put("localName", localName);
|
||||
srcData.localName = localName;
|
||||
return writer.append(localName);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public class SetLocalAVM2Item extends AVM2Item implements SetTypeAVM2Item, Assig
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
|
||||
String localName = localRegName(localData.localRegNames, regIndex);
|
||||
srcData.put("localName", localName);
|
||||
srcData.localName = localName;
|
||||
writer.append(localName + " = ");
|
||||
return value.toString(writer, localData);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class SetSlotAVM2Item extends AVM2Item implements SetTypeAVM2Item, Assign
|
||||
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
|
||||
srcData.put("localName", slotName.getName(localData.constantsAvm2, localData.fullyQualifiedNames, false));
|
||||
srcData.localName = slotName.getName(localData.constantsAvm2, localData.fullyQualifiedNames, false);
|
||||
getName(writer, localData);
|
||||
writer.append(" = ");
|
||||
return value.toString(writer, localData);
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ThisAVM2Item extends AVM2Item {
|
||||
public ThisAVM2Item(GraphSourceItem instruction, Multiname className) {
|
||||
super(instruction, PRECEDENCE_PRIMARY);
|
||||
this.className = className;
|
||||
srcData.put("localName", "this");
|
||||
srcData.localName = "this";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+12
-12
@@ -53,9 +53,9 @@ public class DeclarationAVM2Item extends AVM2Item {
|
||||
if (assignment instanceof LocalRegAVM2Item) { //for..in
|
||||
LocalRegAVM2Item lti = (LocalRegAVM2Item) assignment;
|
||||
String localName = localRegName(localData.localRegNames, lti.regIndex);
|
||||
srcData.put("localName", localName);
|
||||
srcData.put("declaration", "true");
|
||||
srcData.put("declaredType", "*");
|
||||
srcData.localName = localName;
|
||||
srcData.declaration = true;
|
||||
srcData.declaredType = "*";
|
||||
writer.append("var ");
|
||||
writer.append(localName);
|
||||
return writer;
|
||||
@@ -63,9 +63,9 @@ public class DeclarationAVM2Item extends AVM2Item {
|
||||
|
||||
if (assignment instanceof GetSlotAVM2Item) { //for..in
|
||||
GetSlotAVM2Item sti = (GetSlotAVM2Item) assignment;
|
||||
srcData.put("localName", sti.getNameAsStr(localData));
|
||||
srcData.put("declaration", "true");
|
||||
srcData.put("declaredType", "*");
|
||||
srcData.localName = sti.getNameAsStr(localData);
|
||||
srcData.declaration = true;
|
||||
srcData.declaredType = "*";
|
||||
writer.append("var ");
|
||||
sti.getName(writer, localData);
|
||||
return writer;
|
||||
@@ -74,8 +74,8 @@ public class DeclarationAVM2Item extends AVM2Item {
|
||||
if (assignment instanceof SetLocalAVM2Item) {
|
||||
SetLocalAVM2Item lti = (SetLocalAVM2Item) assignment;
|
||||
String localName = localRegName(localData.localRegNames, lti.regIndex);
|
||||
srcData.put("localName", localName);
|
||||
srcData.put("declaration", "true");
|
||||
srcData.localName = localName;
|
||||
srcData.declaration = true;
|
||||
|
||||
GraphTargetItem coerType = TypeItem.UNBOUNDED;
|
||||
if (lti.value instanceof CoerceAVM2Item) {
|
||||
@@ -84,7 +84,7 @@ public class DeclarationAVM2Item extends AVM2Item {
|
||||
if (lti.value instanceof ConvertAVM2Item) {
|
||||
coerType = ((ConvertAVM2Item) lti.value).type;
|
||||
}
|
||||
srcData.put("declaredType", (coerType instanceof TypeItem) ? ((TypeItem) coerType).fullTypeName : "*");
|
||||
srcData.declaredType = (coerType instanceof TypeItem) ? ((TypeItem) coerType).fullTypeName : "*";
|
||||
writer.append("var ");
|
||||
writer.append(localName);
|
||||
writer.append(":");
|
||||
@@ -94,9 +94,9 @@ public class DeclarationAVM2Item extends AVM2Item {
|
||||
}
|
||||
if (assignment instanceof SetSlotAVM2Item) {
|
||||
SetSlotAVM2Item ssti = (SetSlotAVM2Item) assignment;
|
||||
srcData.put("localName", ssti.getNameAsStr(localData));
|
||||
srcData.put("declaration", "true");
|
||||
srcData.put("declaredType", (type instanceof TypeItem) ? ((TypeItem) type).fullTypeName : "*");
|
||||
srcData.localName = ssti.getNameAsStr(localData);
|
||||
srcData.declaration = true;
|
||||
srcData.declaredType = (type instanceof TypeItem) ? ((TypeItem) type).fullTypeName : "*";
|
||||
writer.append("var ");
|
||||
ssti.getName(writer, localData);
|
||||
writer.append(":");
|
||||
|
||||
+8
-8
@@ -23,6 +23,8 @@ import com.jpexs.decompiler.flash.abc.avm2.parser.script.AssignableAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.script.NameAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.types.ABCException;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.HighlightData;
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.HighlightSpecialType;
|
||||
import com.jpexs.decompiler.graph.Block;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -32,9 +34,7 @@ import com.jpexs.decompiler.graph.TypeItem;
|
||||
import com.jpexs.decompiler.graph.model.ContinueItem;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class TryAVM2Item extends AVM2Item implements Block {
|
||||
|
||||
@@ -79,16 +79,16 @@ public class TryAVM2Item extends AVM2Item implements Block {
|
||||
writer.newLine();
|
||||
writer.append("catch(");
|
||||
String localName = catchExceptions.get(e).getVarName(localData.constantsAvm2, localData.fullyQualifiedNames);
|
||||
Map<String, String> data = new HashMap<>();
|
||||
data.put("localName", localName);
|
||||
data.put("declaration", "true");
|
||||
HighlightData data = new HighlightData();
|
||||
data.localName = localName;
|
||||
data.declaration = true;
|
||||
|
||||
int eti = catchExceptions.get(e).type_index;
|
||||
|
||||
data.put("declaredType", eti <= 0 ? "*" : localData.constantsAvm2.constant_multiname.get(eti).getNameWithNamespace(localData.constantsAvm2, true));
|
||||
writer.hilightSpecial(localName, "try.name", e, data);
|
||||
data.declaredType = eti <= 0 ? "*" : localData.constantsAvm2.constant_multiname.get(eti).getNameWithNamespace(localData.constantsAvm2, true);
|
||||
writer.hilightSpecial(localName, HighlightSpecialType.TRY_NAME, e, data);
|
||||
writer.append(":");
|
||||
writer.hilightSpecial(catchExceptions.get(e).getTypeName(localData.constantsAvm2, localData.fullyQualifiedNames), "try.type", e);
|
||||
writer.hilightSpecial(catchExceptions.get(e).getTypeName(localData.constantsAvm2, localData.fullyQualifiedNames), HighlightSpecialType.TRY_TYPE, e);
|
||||
writer.append(")");
|
||||
writer.startBlock();
|
||||
List<GraphTargetItem> commands = catchCommands.get(e);
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.Traits;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.HighlightSpecialType;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -76,12 +77,12 @@ public class InstanceInfo {
|
||||
}
|
||||
|
||||
writer.appendNoHilight(modifiers + objType);
|
||||
writer.hilightSpecial(abc.constants.getMultiname(name_index).getName(abc.constants, new ArrayList<String>()/* No full names here*/, false), "classname");
|
||||
writer.hilightSpecial(abc.constants.getMultiname(name_index).getName(abc.constants, new ArrayList<String>()/* No full names here*/, false), HighlightSpecialType.CLASS_NAME);
|
||||
|
||||
if (super_index > 0) {
|
||||
String typeName = abc.constants.getMultiname(super_index).getNameWithNamespace(abc.constants, true);
|
||||
writer.appendNoHilight(" extends ");
|
||||
writer.hilightSpecial(abc.constants.getMultiname(super_index).getName(abc.constants, fullyQualifiedNames, false), "typename", typeName);
|
||||
writer.hilightSpecial(abc.constants.getMultiname(super_index).getName(abc.constants, fullyQualifiedNames, false), HighlightSpecialType.TYPE_NAME, typeName);
|
||||
}
|
||||
if (interfaces.length > 0) {
|
||||
if (isInterface()) {
|
||||
@@ -94,7 +95,7 @@ public class InstanceInfo {
|
||||
writer.append(", ");
|
||||
}
|
||||
String typeName = abc.constants.getMultiname(interfaces[i]).getNameWithNamespace(abc.constants, true);
|
||||
writer.hilightSpecial(abc.constants.getMultiname(interfaces[i]).getName(abc.constants, fullyQualifiedNames, false), "typename", typeName);
|
||||
writer.hilightSpecial(abc.constants.getMultiname(interfaces[i]).getName(abc.constants, fullyQualifiedNames, false), HighlightSpecialType.TYPE_NAME, typeName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.construction.NewFunctionIns;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.HighlightData;
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.HighlightSpecialType;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -272,7 +274,6 @@ public class MethodInfo {
|
||||
if (body != null && Configuration.getLocalNamesFromDebugInfo.get()) {
|
||||
localRegNames = body.getCode().getLocalRegNamesFromDebug(abc);
|
||||
}
|
||||
Map<String, String> pdata;
|
||||
|
||||
for (int i = 0; i < param_types.length; i++) {
|
||||
if (i > 0) {
|
||||
@@ -283,30 +284,30 @@ public class MethodInfo {
|
||||
ptype = constants.getMultiname(param_types[i]).getNameWithNamespace(constants, false);
|
||||
}
|
||||
|
||||
pdata = new HashMap<>();
|
||||
pdata.put("declaration", "true");
|
||||
pdata.put("declaredType", ptype);
|
||||
HighlightData pdata = new HighlightData();
|
||||
pdata.declaration = true;
|
||||
pdata.declaredType = ptype;
|
||||
if (!localRegNames.isEmpty()) {
|
||||
pdata.put("localName", localRegNames.get(i + 1)); //assuming it is a slot
|
||||
writer.hilightSpecial(IdentifiersDeobfuscation.printIdentifier(true, localRegNames.get(i + 1)), "paramname", i, pdata);
|
||||
pdata.localName = localRegNames.get(i + 1); //assuming it is a slot
|
||||
writer.hilightSpecial(IdentifiersDeobfuscation.printIdentifier(true, localRegNames.get(i + 1)), HighlightSpecialType.PARAM_NAME, i, pdata);
|
||||
} else if ((paramNames.length > i) && (paramNames[i] != 0) && Configuration.paramNamesEnable.get()) {
|
||||
pdata.put("localName", constants.getString(paramNames[i]));
|
||||
writer.hilightSpecial(IdentifiersDeobfuscation.printIdentifier(true, constants.getString(paramNames[i])), "paramname", i, pdata);
|
||||
pdata.localName = constants.getString(paramNames[i]);
|
||||
writer.hilightSpecial(IdentifiersDeobfuscation.printIdentifier(true, constants.getString(paramNames[i])), HighlightSpecialType.PARAM_NAME, i, pdata);
|
||||
} else {
|
||||
pdata.put("localName", "param" + (i + 1));
|
||||
writer.hilightSpecial("param" + (i + 1), "paramname", i, pdata);
|
||||
pdata.localName = "param" + (i + 1);
|
||||
writer.hilightSpecial("param" + (i + 1), HighlightSpecialType.PARAM_NAME, i, pdata);
|
||||
}
|
||||
writer.appendNoHilight(":");
|
||||
if (param_types[i] == 0) {
|
||||
writer.hilightSpecial("*", "param", i);
|
||||
writer.hilightSpecial("*", HighlightSpecialType.PARAM, i);
|
||||
} else {
|
||||
writer.hilightSpecial(constants.getMultiname(param_types[i]).getName(constants, fullyQualifiedNames, false), "param", i);
|
||||
writer.hilightSpecial(constants.getMultiname(param_types[i]).getName(constants, fullyQualifiedNames, false), HighlightSpecialType.PARAM, i);
|
||||
}
|
||||
if (optional != null) {
|
||||
if (i >= param_types.length - optional.length) {
|
||||
int optionalIndex = i - (param_types.length - optional.length);
|
||||
writer.appendNoHilight(" = ");
|
||||
writer.hilightSpecial(optional[optionalIndex].toString(constants), "optional", optionalIndex);
|
||||
writer.hilightSpecial(optional[optionalIndex].toString(constants), HighlightSpecialType.OPTIONAL, optionalIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -322,12 +323,13 @@ public class MethodInfo {
|
||||
} else {
|
||||
restName = "rest";
|
||||
}
|
||||
pdata = new HashMap<>();
|
||||
pdata.put("declaration", "true");
|
||||
pdata.put("declaredType", "*");
|
||||
pdata.put("localName", restName);
|
||||
|
||||
HighlightData pdata = new HighlightData();
|
||||
pdata.declaration = true;
|
||||
pdata.declaredType = "*";
|
||||
pdata.localName = restName;
|
||||
writer.append(restAdd);
|
||||
writer.hilightSpecial(restName, "flag.NEED_REST", 0, pdata);
|
||||
writer.hilightSpecial(restName, HighlightSpecialType.FLAG_NEED_REST, 0, pdata);
|
||||
}
|
||||
return writer;
|
||||
}
|
||||
@@ -337,7 +339,7 @@ public class MethodInfo {
|
||||
if (ret_type > 0) {
|
||||
rname = IdentifiersDeobfuscation.printIdentifier(true, constants.getMultiname(ret_type).getName(constants, fullyQualifiedNames, true), "void");
|
||||
}
|
||||
return writer.hilightSpecial(rname, "returns");
|
||||
return writer.hilightSpecial(rname, HighlightSpecialType.RETURNS);
|
||||
}
|
||||
|
||||
public void setBody(MethodBody body) {
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.NulWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.HighlightSpecialType;
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.helpers.Helper;
|
||||
@@ -58,8 +59,8 @@ public class TraitFunction extends Trait implements TraitWithSlot {
|
||||
modifier = "";
|
||||
}
|
||||
writer.appendNoHilight(modifier);
|
||||
writer.hilightSpecial("function ", "traittype");
|
||||
writer.hilightSpecial(abc.constants.getMultiname(name_index).getName(abc.constants, fullyQualifiedNames, false), "traitname");
|
||||
writer.hilightSpecial("function ", HighlightSpecialType.TRAIT_TYPE);
|
||||
writer.hilightSpecial(abc.constants.getMultiname(name_index).getName(abc.constants, fullyQualifiedNames, false), HighlightSpecialType.TRAIT_NAME);
|
||||
writer.appendNoHilight("(");
|
||||
abc.method_info.get(method_info).getParamStr(writer, abc.constants, body, abc, fullyQualifiedNames);
|
||||
writer.appendNoHilight(") : ");
|
||||
|
||||
+3
-2
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.NulWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.HighlightSpecialType;
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.helpers.Helper;
|
||||
@@ -66,8 +67,8 @@ public class TraitMethodGetterSetter extends Trait {
|
||||
}
|
||||
|
||||
writer.appendNoHilight(modifier);
|
||||
writer.hilightSpecial("function " + addKind, "traittype");
|
||||
writer.hilightSpecial(getName(abc).getName(abc.constants, fullyQualifiedNames, false), "traitname");
|
||||
writer.hilightSpecial("function " + addKind, HighlightSpecialType.TRAIT_TYPE);
|
||||
writer.hilightSpecial(getName(abc).getName(abc.constants, fullyQualifiedNames, false), HighlightSpecialType.TRAIT_NAME);
|
||||
writer.appendNoHilight("(");
|
||||
abc.method_info.get(method_info).getParamStr(writer, abc.constants, body, abc, fullyQualifiedNames);
|
||||
writer.appendNoHilight(") : ");
|
||||
|
||||
+5
-4
@@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.NulWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.HighlightSpecialType;
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
@@ -86,9 +87,9 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
|
||||
if (val != null && val.isNamespace()) {
|
||||
slotconst = "namespace";
|
||||
}
|
||||
writer.hilightSpecial(slotconst + " ", "traittype");
|
||||
writer.hilightSpecial(getName(abc).getName(abc.constants, fullyQualifiedNames, false), "traitname");
|
||||
writer.hilightSpecial(typeStr, "traittypename");
|
||||
writer.hilightSpecial(slotconst + " ", HighlightSpecialType.TRAIT_TYPE);
|
||||
writer.hilightSpecial(getName(abc).getName(abc.constants, fullyQualifiedNames, false), HighlightSpecialType.TRAIT_NAME);
|
||||
writer.hilightSpecial(typeStr, HighlightSpecialType.TRAIT_TYPE_NAME);
|
||||
return writer;
|
||||
}
|
||||
|
||||
@@ -117,7 +118,7 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
|
||||
|
||||
if (value_kind != 0) {
|
||||
ValueKind val = new ValueKind(value_index, value_kind);
|
||||
writer.hilightSpecial(val.toString(abc.constants), "traitvalue");
|
||||
writer.hilightSpecial(val.toString(abc.constants), HighlightSpecialType.TRAIT_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.Traits;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.NulWriter;
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
import java.util.ArrayList;
|
||||
@@ -53,7 +53,7 @@ public abstract class ConstVarMultinameUsage extends TraitMultinameUsage {
|
||||
//ignore
|
||||
}
|
||||
|
||||
HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), false);
|
||||
writer.appendNoHilight(super.toString() + " ");
|
||||
if (parentTraitIndex > -1) {
|
||||
if (isStatic) {
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.Traits;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.NulWriter;
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
import java.util.ArrayList;
|
||||
@@ -57,7 +57,7 @@ public abstract class MethodMultinameUsage extends TraitMultinameUsage {
|
||||
((TraitMethodGetterSetter) traits.traits.get(traitIndex)).convertHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList<String>(), false);
|
||||
}
|
||||
|
||||
HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), false);
|
||||
writer.appendNoHilight(super.toString());
|
||||
writer.appendNoHilight(" ");
|
||||
if (isInitializer) {
|
||||
|
||||
Reference in New Issue
Block a user