Skip to content

Commit 5ed661b

Browse files
committed
Also allow to instrument Idents as calls
# Conflicts: # compiler/src/dotty/tools/dotc/transform/Instrumentation.scala
1 parent 673eb7b commit 5ed661b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

compiler/src/dotty/tools/dotc/transform/Instrumentation.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ class Instrumentation extends MiniPhase { thisPhase =>
2828
ctx.settings.YinstrumentClosures.value ||
2929
ctx.settings.YinstrumentAllocations.value
3030

31-
private val namesOfInterest = List("::", "+=", "toString")
31+
private val namesOfInterest = List(
32+
"::", "+=", "toString",
33+
"map", "flatMap", "filter", "withFilter", "collect", "foldLeft", "foldRight", "take",
34+
"reverse", "mapConserve", "mapconserve", "filterConserve", "zip")
3235
private var namesToRecord: Set[Name] = _
3336

3437
private var consName: TermName = _
@@ -46,8 +49,8 @@ class Instrumentation extends MiniPhase { thisPhase =>
4649
override def transformApply(tree: Apply)(using Context): Tree = tree.fun match {
4750
case Select(nu: New, _) =>
4851
cpy.Block(tree)(record(i"alloc/${nu.tpe}", tree) :: Nil, tree)
49-
case Select(_, name) if namesToRecord.contains(name) =>
50-
cpy.Block(tree)(record(i"alloc/$name", tree) :: Nil, tree)
52+
case ref: RefTree if namesToRecord.contains(ref.name) =>
53+
cpy.Block(tree)(record(i"call/${ref.name}", tree) :: Nil, tree)
5154
case _ =>
5255
tree
5356
}

0 commit comments

Comments
 (0)