Skip to content

Commit cac0803

Browse files
committed
Fix linting and add missing inline modifiers
1 parent 614a9d6 commit cac0803

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

compiler/src/dotty/tools/dotc/profile/Profiler.scala

+13-15
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ private [profile] class RealProfiler(reporter : ProfileReporter)(using Context)
178178
def name: String = this.toString().toLowerCase()
179179
case Run, Phase, File, TypeCheck, Implicit, Macro, Completion
180180
private [profile] val chromeTrace =
181-
if ctx.settings.YprofileTrace.isDefault
182-
then null
181+
if ctx.settings.YprofileTrace.isDefault then null
183182
else
184183
val filename = ctx.settings.YprofileTrace.value
185184
// Compilation units requiring multi-stage compilation (macros) would create a new profiler instances
@@ -312,43 +311,42 @@ private [profile] class RealProfiler(reporter : ProfileReporter)(using Context)
312311
override def afterMacroSplice(event: TracedEventId): Unit = traceDurationEnd(Category.Macro, event, colour = "olive")
313312

314313
override def beforeCompletion(root: Symbol, associatedFile: => AbstractFile): (TracedEventId, String) =
315-
if chromeTrace == null
316-
then (TracedEventId.Empty, "")
314+
if chromeTrace == null then
315+
(TracedEventId.Empty, "")
317316
else
318317
val file = associatedFile
319-
val completionName= this.completionName(root, file)
318+
val completionName = this.completionName(root, file)
320319
val event = TracedEventId(file.name)
321320
chromeTrace.traceDurationEventStart(Category.Completion.name, "", colour = "thread_state_sleeping")
322321
chromeTrace.traceDurationEventStart(Category.File.name, event)
323322
chromeTrace.traceDurationEventStart(Category.Completion.name, completionName)
324323
(event, completionName)
325324

326325
override def afterCompletion(event: TracedEventId, completionName: String): Unit =
327-
if chromeTrace != null
328-
then
326+
if chromeTrace != null then
329327
chromeTrace.traceDurationEventEnd(Category.Completion.name, completionName)
330328
chromeTrace.traceDurationEventEnd(Category.File.name, event)
331329
chromeTrace.traceDurationEventEnd(Category.Completion.name, "", colour = "thread_state_sleeping")
332330

333331

334-
private inline def traceDurationStart(category: Category, inline eventName: String, colour: String = ""): TracedEventId =
335-
if chromeTrace == null
336-
then TracedEventId.Empty
332+
private inline def traceDurationStart(inline category: Category, inline eventName: String, inline colour: String = ""): TracedEventId =
333+
if chromeTrace == null then
334+
TracedEventId.Empty
337335
else
338336
val event = TracedEventId(eventName)
339337
chromeTrace.traceDurationEventStart(category.name, event, colour)
340338
event
341339

342-
private inline def traceDurationEnd(category: Category, event: TracedEventId, colour: String = ""): Unit =
343-
if chromeTrace != null
344-
then chromeTrace.traceDurationEventEnd(category.name, event, colour)
340+
private inline def traceDurationEnd(inline category: Category, inline event: TracedEventId, inline colour: String = ""): Unit =
341+
if chromeTrace != null then
342+
chromeTrace.traceDurationEventEnd(category.name, event, colour)
345343

346344

347345
private def symbolName(sym: Symbol): String = s"${sym.showKind} ${sym.showName}"
348346
private def completionName(root: Symbol, associatedFile: AbstractFile): String =
349347
def isTopLevel = root.owner != NoSymbol && root.owner.is(Flags.Package)
350-
if root.is(Flags.Package) || isTopLevel
351-
then root.javaBinaryName
348+
if root.is(Flags.Package) || isTopLevel then
349+
root.javaBinaryName
352350
else
353351
val enclosing = root.enclosingClass
354352
s"${enclosing.javaBinaryName}::${root.name}"

0 commit comments

Comments
 (0)