mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-21 16:45:34 +00:00
Better line start detection
Fixed debug info injection
This commit is contained in:
@@ -30,5 +30,7 @@ public class GraphSourceItemPosition {
|
||||
|
||||
public int position;
|
||||
|
||||
public GraphSourceItem startLineItem;
|
||||
|
||||
public HighlightData data;
|
||||
}
|
||||
|
||||
@@ -54,11 +54,12 @@ public abstract class GraphTextWriter {
|
||||
* Highlights specified text as instruction
|
||||
*
|
||||
* @param src
|
||||
* @param firstLineItem
|
||||
* @param pos Offset of instruction
|
||||
* @param data
|
||||
* @return GraphTextWriter
|
||||
*/
|
||||
public GraphTextWriter startOffset(GraphSourceItem src, int pos, HighlightData data) {
|
||||
public GraphTextWriter startOffset(GraphSourceItem src, GraphSourceItem startLineItem, int pos, HighlightData data) {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -85,9 +85,10 @@ public class HighlightedTextWriter extends GraphTextWriter {
|
||||
* @return HighlightedTextWriter
|
||||
*/
|
||||
@Override
|
||||
public HighlightedTextWriter startOffset(GraphSourceItem src, int pos, HighlightData data) {
|
||||
public HighlightedTextWriter startOffset(GraphSourceItem src, GraphSourceItem startLineItem, int pos, HighlightData data) {
|
||||
GraphSourceItemPosition itemPos = new GraphSourceItemPosition();
|
||||
itemPos.graphSourceItem = src;
|
||||
itemPos.startLineItem = startLineItem;
|
||||
itemPos.position = pos;
|
||||
itemPos.data = data;
|
||||
offsets.add(itemPos);
|
||||
@@ -182,6 +183,9 @@ public class HighlightedTextWriter extends GraphTextWriter {
|
||||
ndata.merge(itemPos.data);
|
||||
ndata.merge(data);
|
||||
ndata.offset = src.getOffset() + pos;
|
||||
if (itemPos.startLineItem != null) {
|
||||
ndata.firstLineOffset = itemPos.startLineItem.getOffset();
|
||||
}
|
||||
h = new Highlighting(sb.length() - newLineCount, ndata, HighlightType.OFFSET, str);
|
||||
instructionHilights.add(h);
|
||||
}
|
||||
|
||||
@@ -39,10 +39,14 @@ public class HighlightData implements Cloneable, Serializable {
|
||||
|
||||
public long offset;
|
||||
|
||||
public long firstLineOffset = -1;
|
||||
|
||||
public int regIndex = -1;
|
||||
|
||||
public boolean isEmpty() {
|
||||
return !declaration && declaredType == null && localName == null
|
||||
&& subtype == null && specialValue == null
|
||||
&& index == 0 && offset == 0;
|
||||
&& index == 0 && offset == 0 && regIndex == -1 && firstLineOffset == -1;
|
||||
}
|
||||
|
||||
public void merge(HighlightData data) {
|
||||
@@ -70,6 +74,12 @@ public class HighlightData implements Cloneable, Serializable {
|
||||
if (data.offset != 0) {
|
||||
offset = data.offset;
|
||||
}
|
||||
if (data.regIndex != -1) {
|
||||
regIndex = data.regIndex;
|
||||
}
|
||||
if (data.firstLineOffset != -1) {
|
||||
firstLineOffset = data.firstLineOffset;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user