Skip to content

Commit ad6c699

Browse files
Don't generate mappings for the quotes compiled at runtime by the staging compiler
1 parent d8ed01f commit ad6c699

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

compiler/src/dotty/tools/backend/jvm/InlinedSourceMaps.scala

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,18 @@ object InlinedSourceMaps:
107107
else traverseChildren(tree)
108108
end RequestCollector
109109

110-
var lastLine = cunit.tpdTree.sourcePos.endLine
111-
def allocate(origPos: SourcePosition): Int =
112-
val line = lastLine + 1
113-
lastLine += origPos.lines.length
114-
line
115-
116-
RequestCollector(cunit.source).traverse(cunit.tpdTree)
117-
val allocated = requests.sortBy(_._1.start).map(r => Request(r._1, r._2, allocate(r._2)))
118-
InlinedSourceMap(cunit, allocated.toList, internalNames)
110+
// Don't generate mappings for the quotes compiled at runtime by the staging compiler
111+
if cunit.source.file.isVirtual then InlinedSourceMap(cunit, Nil, Map.empty[SourceFile, String])
112+
else
113+
var lastLine = cunit.tpdTree.sourcePos.endLine
114+
def allocate(origPos: SourcePosition): Int =
115+
val line = lastLine + 1
116+
lastLine += origPos.lines.length
117+
line
118+
119+
RequestCollector(cunit.source).traverse(cunit.tpdTree)
120+
val allocated = requests.sortBy(_._1.start).map(r => Request(r._1, r._2, allocate(r._2)))
121+
InlinedSourceMap(cunit, allocated.toList, internalNames)
119122
end sourceMapFor
120123

121124
class InlinedSourceMap private[InlinedSourceMaps] (

0 commit comments

Comments
 (0)