decompiler: fixed bytecode mapping for anonymous classes

This commit is contained in:
Egor.Ushakov
2014-10-17 15:41:17 +04:00
parent b3681fe952
commit 32e7765874
9 changed files with 95 additions and 52 deletions

View File

@@ -115,7 +115,7 @@ public class TextBuffer {
while (currentLine < srcLines.length) {
String line = srcLines[currentLine];
int lineEnd = currentLineStartOffset + line.length() + myLineSeparator.length();
if (markOffset >= currentLineStartOffset && markOffset <= lineEnd) {
if (markOffset <= lineEnd) {
int requiredLine = markLine - 1;
int linesToAdd = requiredLine - dumpedLines;
dumpedLines = requiredLine;
@@ -223,6 +223,14 @@ public class TextBuffer {
return this;
}
public int countLines() {
return countLines(0);
}
public int countLines(int from) {
return count(myLineSeparator, from);
}
public int count(String substring, int from) {
int count = 0, length = substring.length(), p = from;
while ((p = myStringBuilder.indexOf(substring, p)) > 0) {