decompiler: fixed line mapping for try-catch and nested classes

This commit is contained in:
Egor.Ushakov
2014-10-20 18:06:14 +04:00
parent 47fad13908
commit 0bcd7fba5c
8 changed files with 92 additions and 19 deletions

View File

@@ -254,8 +254,11 @@ public class ClassWriter {
if (hasContent) {
buffer.appendLineSeparator();
startLine++;
}
classToJava(inner, buffer, indent + 1, tracer);
BytecodeMappingTracer class_tracer = new BytecodeMappingTracer(startLine);
classToJava(inner, buffer, indent + 1, class_tracer);
startLine = buffer.countLines();
hasContent = true;
}
@@ -840,7 +843,7 @@ public class ClassWriter {
// save total lines
// TODO: optimize
tracer.setCurrentSourceLine(buffer.countLines(start_index_method));
//tracer.setCurrentSourceLine(buffer.countLines(start_index_method));
return !hideMethod;
}

View File

@@ -280,6 +280,7 @@ public class ClassesProcessor {
}
//buffer.append(lineSeparator);
total_offset_lines = buffer.countLines();
buffer.append(classBuffer);
if (DecompilerContext.getOption(IFernflowerPreferences.BYTECODE_SOURCE_MAPPING)) {

View File

@@ -187,7 +187,6 @@ public class CatchStatement extends Statement {
tracer.incrementCurrentSourceLine();
buf.append(ExprProcessor.jmpWrapper(stats.get(i), indent + 1, true, tracer)).append(indstr)
.append("}");
tracer.incrementCurrentSourceLine();
}
buf.append(new_line_separator);