Fix {read,write}LineNumbers

Signed-off-by: Graham <gpe@openrs2.org>
bzip2
Graham 4 years ago
parent 2b3e9d318a
commit 0e1046d457
  1. 11
      asm/src/main/kotlin/org/openrs2/asm/packclass/PackClass.kt

@ -859,11 +859,12 @@ public object PackClass {
): Array<IntArray?> {
require(attributes.size == pcs.size)
var line = 0
return Array(attributes.size) { i ->
if (attributes[i].contains(ConstantPool.CODE)) {
var line = 0
IntArray(pcs[i]!!.size) {
line += buf.readUnsignedShortSmart()
line += buf.readUnsignedShort()
line and 0xFFFF
}
} else {
@ -1442,20 +1443,20 @@ public object PackClass {
}
private fun writeLineNumbers(buf: ByteBuf, clazz: ClassNode) {
var prevLine = 0
for (method in clazz.methods) {
if (method.instructions.size() == 0) {
continue
}
var prevLine = 0
for (insn in method.instructions) {
if (insn !is LineNumberNode) {
continue
}
val line = insn.line
buf.writeUnsignedShortSmart(line - prevLine)
buf.writeShort(line - prevLine)
prevLine = line
}
}

Loading…
Cancel
Save