File tree 1 file changed +6
-5
lines changed
compiler/src/dotty/tools/dotc/transform/init 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
10
10
import annotation .tailrec
11
11
12
12
object Util {
13
- def traceIndented (msg : String , printer : Printer )(using Context ): Unit =
13
+ def traceIndented (msg : => String , printer : Printer )(using Context ): Unit =
14
14
printer.println(s " ${ctx.base.indentTab * ctx.base.indent} $msg" )
15
15
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)
18
19
op
19
- traceIndented(s " <== ${msg }" , printer)
20
+ traceIndented(s " <== ${computedMsg }" , printer)
20
21
}
21
22
22
23
extension (symbol : Symbol ) def hasSource (using Context ): Boolean =
@@ -38,4 +39,4 @@ object Util {
38
39
}
39
40
loop(cls.info.baseClasses.dropWhile(sym.owner != _))
40
41
}
41
- }
42
+ }
You can’t perform that action at this time.
0 commit comments