mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-02 09:54:50 +00:00
highlighting refactored
This commit is contained in:
@@ -16,8 +16,9 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.graph.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.LoopWithType;
|
||||
import com.jpexs.decompiler.flash.helpers.NulWriter;
|
||||
import com.jpexs.decompiler.graph.Block;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -32,6 +33,7 @@ public class ForItem extends LoopItem implements Block {
|
||||
public GraphTargetItem expression;
|
||||
public List<GraphTargetItem> finalCommands;
|
||||
public List<GraphTargetItem> commands;
|
||||
private boolean labelUsed;
|
||||
|
||||
@Override
|
||||
public List<List<GraphTargetItem>> getSubs() {
|
||||
@@ -51,9 +53,13 @@ public class ForItem extends LoopItem implements Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected HilightedTextWriter appendTo(HilightedTextWriter writer, LocalData localData) {
|
||||
writer.startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP);
|
||||
writer.append("loop" + loop.id + ":").newLine();
|
||||
protected GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
|
||||
if (writer instanceof NulWriter) {
|
||||
((NulWriter)writer).startLoop(loop.id, LoopWithType.LOOP_TYPE_LOOP);
|
||||
}
|
||||
if (labelUsed) {
|
||||
writer.append("loop" + loop.id + ":").newLine();
|
||||
}
|
||||
writer.append("for(");
|
||||
int p = 0;
|
||||
for (int i = 0; i < firstCommands.size(); i++) {
|
||||
@@ -93,8 +99,10 @@ public class ForItem extends LoopItem implements Block {
|
||||
}
|
||||
writer.unindent();
|
||||
writer.append("}").newLine();
|
||||
writer.append(":loop" + loop.id).newLine();
|
||||
writer.endLoop(loop.id);
|
||||
if (writer instanceof NulWriter) {
|
||||
LoopWithType loopOjb = ((NulWriter)writer).endLoop(loop.id);
|
||||
labelUsed = loopOjb.used;
|
||||
}
|
||||
return writer;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user