Skip to content

Commit cc77000

Browse files
committed
Identify changes afer ref compiler updated
1 parent 379b3e1 commit cc77000

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

compiler/src/dotty/tools/dotc/reporting/trace.scala

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,18 @@ object trace extends TraceSyntax {
2525
abstract class TraceSyntax {
2626
val isForced: Boolean
2727

28+
// FIXME Use this signature after reference compiler is updated
29+
// inline def onDebug[TD](inline question: String)(inline op: TD)(implicit ctx: Context): TD =
2830
inline def onDebug[TD](question: => String)(op: => TD)(implicit ctx: Context): TD =
2931
conditionally(ctx.settings.YdebugTrace.value, question, false)(op)
3032

33+
// FIXME Use this implementation after reference compiler is updated
34+
// inline def conditionally[TC](inline cond: Boolean, inline question: String, inline show: Boolean)(op: => TC)(implicit ctx: Context): TC =
35+
// inline if (isForced || Config.tracingEnabled) {
36+
// if (cond) apply[TC](question, Printers.default, show)(op)
37+
// else op
38+
// }
39+
// else op
3140
inline def conditionally[TC](cond: Boolean, question: => String, show: Boolean)(op: => TC)(implicit ctx: Context): TC =
3241
inline if (isForced || Config.tracingEnabled) {
3342
def op1 = op
@@ -36,6 +45,13 @@ abstract class TraceSyntax {
3645
}
3746
else op
3847

48+
// FIXME Use this implementation after reference compiler is updated
49+
// inline def apply[T](inline question: String, inline printer: Printers.Printer, inline showOp: Any => String)(op: => T)(implicit ctx: Context): T =
50+
// inline if (isForced || Config.tracingEnabled) {
51+
// if (!isForced && printer.eq(config.Printers.noPrinter)) op
52+
// else doTrace[T](question, printer, showOp)(op)
53+
// }
54+
// else op
3955
inline def apply[T](question: => String, printer: Printers.Printer, showOp: Any => String)(op: => T)(implicit ctx: Context): T =
4056
inline if (isForced || Config.tracingEnabled) {
4157
def op1 = op
@@ -44,6 +60,13 @@ abstract class TraceSyntax {
4460
}
4561
else op
4662

63+
// FIXME Use this implementation after reference compiler is updated
64+
// inline def apply[T](inline question: String, inline printer: Printers.Printer, inline show: Boolean)(op: => T)(implicit ctx: Context): T =
65+
// inline if (isForced || Config.tracingEnabled) {
66+
// if (!isForced && printer.eq(config.Printers.noPrinter)) op
67+
// else doTrace[T](question, printer, if (show) showShowable(_) else alwaysToString)(op)
68+
// }
69+
// else op
4770
inline def apply[T](question: => String, printer: Printers.Printer, show: Boolean)(op: => T)(implicit ctx: Context): T =
4871
inline if (isForced || Config.tracingEnabled) {
4972
def op1 = op
@@ -52,12 +75,18 @@ abstract class TraceSyntax {
5275
}
5376
else op
5477

78+
// FIXME Use this signature after reference compiler is updated
79+
// inline def apply[T](inline question: String, inline printer: Printers.Printer)(inline op: T)(implicit ctx: Context): T =
5580
inline def apply[T](question: => String, printer: Printers.Printer)(op: => T)(implicit ctx: Context): T =
5681
apply[T](question, printer, false)(op)
5782

83+
// FIXME Use this signature after reference compiler is updated
84+
// inline def apply[T](inline question: String, inline show: Boolean)(inline op: T)(implicit ctx: Context): T =
5885
inline def apply[T](question: => String, show: Boolean)(op: => T)(implicit ctx: Context): T =
5986
apply[T](question, Printers.default, show)(op)
6087

88+
// FIXME Use this signature after reference compiler is updated
89+
// inline def apply[T](inline question: String)(inline op: T)(implicit ctx: Context): T =
6190
inline def apply[T](question: => String)(op: => T)(implicit ctx: Context): T =
6291
apply[T](question, Printers.default, false)(op)
6392

compiler/src/dotty/tools/dotc/util/Stats.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import collection.mutable
1919
override def default(key: String): Int = 0
2020
}
2121

22+
// FIXME Use this signature after reference compiler is updated
23+
// inline def record(inline fn: String, inline n: Int = 1): Unit =
2224
inline def record(fn: => String, n: => Int = 1): Unit =
2325
if (enabled) doRecord(fn, n)
2426

@@ -28,16 +30,17 @@ import collection.mutable
2830
hits(name) += n
2931
}
3032

33+
// FIXME Use this signature after reference compiler is updated
34+
// inline def trackTime[T](fn: String)(inline op: T): T =
3135
inline def trackTime[T](fn: String)(op: => T): T =
3236
if (enabled) doTrackTime(fn)(op) else op
3337

3438
def doTrackTime[T](fn: String)(op: => T): T = {
35-
def op1 = op
3639
if (monitored) {
3740
val start = System.nanoTime
38-
try op1 finally record(fn, ((System.nanoTime - start) / 1000).toInt)
41+
try op finally record(fn, ((System.nanoTime - start) / 1000).toInt)
3942
}
40-
else op1
43+
else op
4144
}
4245

4346
final val GroupChar = '/'

0 commit comments

Comments
 (0)