File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
compiler/src/dotty/tools/dotc/transform/init Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -10,13 +10,14 @@ import config.Printers.Printer
1010import annotation .tailrec
1111
1212object Util {
13- def traceIndented (msg : String , printer : Printer )(using Context ): Unit =
13+ def traceIndented (msg : => String , printer : Printer )(using Context ): Unit =
1414 printer.println(s " ${ctx.base.indentTab * ctx.base.indent} $msg" )
1515
16- def traceOp (msg : String , printer : Printer )(op : => Unit )(using Context ): Unit = {
17- traceIndented(s " ==> ${msg}" , printer)
16+ def traceOp (msg : => String , printer : Printer )(op : => Unit )(using Context ): Unit = {
17+ lazy val computedMsg = msg // Make sure we only compute msg once
18+ traceIndented(s " ==> ${computedMsg}" , printer)
1819 op
19- traceIndented(s " <== ${msg }" , printer)
20+ traceIndented(s " <== ${computedMsg }" , printer)
2021 }
2122
2223 extension (symbol : Symbol ) def hasSource (using Context ): Boolean =
@@ -38,4 +39,4 @@ object Util {
3839 }
3940 loop(cls.info.baseClasses.dropWhile(sym.owner != _))
4041 }
41- }
42+ }
You can’t perform that action at this time.
0 commit comments