From 9678bbae4bc1dd4d896cbba80f4b394422684873 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Wed, 2 Aug 2023 23:19:52 +0200 Subject: [PATCH] dedup --- codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt b/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt index ff6905d0b..3f6c50750 100644 --- a/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt +++ b/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt @@ -238,9 +238,13 @@ class AsmGen6502Internal ( internal fun isTargetCpu(cpu: CpuType) = options.compTarget.machine.cpu == cpu + private var lastSourceLineNumber: Int = -1 + internal fun outputSourceLine(node: PtNode) { - if(!options.includeSourcelines || node.position===Position.DUMMY) + if(!options.includeSourcelines || node.position===Position.DUMMY || node.position.line==lastSourceLineNumber) return + + lastSourceLineNumber = node.position.line val srcComment = "\t; source: ${node.position.file}:${node.position.line}" val line = SourceLineCache.retrieveLine(node.position) if(line==null)