@@ -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