Skip to content

Commit 028c6bf

Browse files
committed
Removed unused code
1 parent 35c353d commit 028c6bf

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

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

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ object InlinedSourceMaps:
8989
class RequestCollector(enclosingFile: SourceFile) extends TreeTraverser:
9090
override def traverse(tree: Tree)(using Context): Unit =
9191
tree match
92-
case Inlined(call, bindings, expansion) =>
92+
case inlined @ Inlined(call, bindings, expansion) =>
9393
if expansion.source != enclosingFile && expansion.source != cunit.source then
94-
requests += tree.asInstanceOf[Inlined]
94+
requests += inlined
9595
val topLevelClass = Option.when(!call.isEmpty)(call.symbol.topLevelClass)
9696

9797
topLevelClass match
@@ -131,23 +131,15 @@ object InlinedSourceMaps:
131131

132132
def debugExtension: Option[String] = Some("TODO")
133133

134-
private val inlines = mutable.ListBuffer.empty[Inlined]
135-
136134
def lineFor(tree: Tree): Option[Int] =
137135

138-
tree match
139-
case Inlined(call, binding, expansion) =>
140-
inlines += tree.asInstanceOf[Inlined]
141-
None
142-
case _ =>
143-
val sourcePos = tree.sourcePos
144-
val inline = inlines.findLast(_.expansion.contains(tree))
145-
requests.findLast(r => r.inline.expansion.contains(tree)) match
146-
case Some(request) =>
147-
val offset = sourcePos.startLine - request.inline.expansion.sourcePos.startLine
148-
val virtualLine = request.firstFakeLine + offset
149-
if requests.filter(_.inline.expansion.contains(tree)).size > 1 then None
150-
else Some(virtualLine + 1) // + 1 because the first line is 1 in the LineNumberTable
151-
case None =>
152-
// report.warning(s"${sourcePos.show} was inlined in ${cunit.source} but its inlining position was not recorded.")
153-
None
136+
val sourcePos = tree.sourcePos
137+
requests.findLast(r => r.inline.expansion.contains(tree)) match
138+
case Some(request) =>
139+
val offset = sourcePos.startLine - request.inline.expansion.sourcePos.startLine
140+
val virtualLine = request.firstFakeLine + offset
141+
if requests.filter(_.inline.expansion.contains(tree)).size > 1 then None
142+
else Some(virtualLine + 1) // + 1 because the first line is 1 in the LineNumberTable
143+
case None =>
144+
// report.warning(s"${sourcePos.show} was inlined in ${cunit.source} but its inlining position was not recorded.")
145+
None

0 commit comments

Comments
 (0)