diff --git a/src/main/java/soot/asm/AsmMethodSource.java b/src/main/java/soot/asm/AsmMethodSource.java index 15f7ed2f9e8..b2105b449a3 100644 --- a/src/main/java/soot/asm/AsmMethodSource.java +++ b/src/main/java/soot/asm/AsmMethodSource.java @@ -21,7 +21,6 @@ * . * #L% */ - import static org.objectweb.asm.Opcodes.ACONST_NULL; import static org.objectweb.asm.Opcodes.ALOAD; import static org.objectweb.asm.Opcodes.ANEWARRAY; @@ -528,15 +527,9 @@ private Operand popStackConst(Type t) { return AsmUtil.isDWord(t) ? popStackConstDual() : popStackConst(); } - void setUnit(AbstractInsnNode insn, Unit u) { - if (Options.v().keep_line_number() && lastLineNumber >= 0) { - Tag lineTag = u.getTag(LineNumberTag.NAME); - if (lineTag == null) { - lineTag = new LineNumberTag(lastLineNumber); - u.addTag(lineTag); - } else if (((LineNumberTag) lineTag).getLineNumber() != lastLineNumber) { - throw new RuntimeException("Line tag mismatch"); - } + protected void setUnit(AbstractInsnNode insn, Unit u) { + if (lastLineNumber >= 0) { + setLineNumber(u, lastLineNumber); } Unit o = units.put(insn, u); @@ -545,6 +538,18 @@ void setUnit(AbstractInsnNode insn, Unit u) { } } + protected void setLineNumber(Unit u, int lineNumber) { + if (Options.v().keep_line_number()) { + Tag lineTag = u.getTag(LineNumberTag.NAME); + if (lineTag == null) { + lineTag = new LineNumberTag(lineNumber); + u.addTag(lineTag); + } else if (((LineNumberTag) lineTag).getLineNumber() != lineNumber) { + throw new RuntimeException("Line tag mismatch"); + } + } + } + void mergeUnits(AbstractInsnNode insn, Unit u) { Unit prev = units.put(insn, u); if (prev != null) {