Skip to content

Commit e92a834

Browse files
committed
use more descriptive names
1 parent 51abd42 commit e92a834

File tree

3 files changed

+20
-25
lines changed

3 files changed

+20
-25
lines changed

compiler/src/dotty/tools/dotc/Run.scala

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,12 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
189189

190190
def doAdvanceUnit()(using Context): Unit =
191191
trackProgress: progress =>
192-
progress.unitc += 1 // trace that we completed a unit in the current (sub)phase
192+
progress.currentUnitCount += 1 // trace that we completed a unit in the current (sub)phase
193193
progress.refreshProgress()
194194

195195
def doAdvanceLate()(using Context): Unit =
196196
trackProgress: progress =>
197-
progress.latec += 1 // trace that we completed a late compilation
197+
progress.currentLateUnitCount += 1 // trace that we completed a late compilation
198198
progress.refreshProgress()
199199

200200
private def doEnterPhase(currentPhase: Phase)(using Context): Unit =
@@ -210,22 +210,22 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
210210

211211
private def doAdvancePhase(currentPhase: Phase, wasRan: Boolean)(using Context): Unit =
212212
trackProgress: progress =>
213-
progress.unitc = 0 // reset unit count in current (sub)phase
214-
progress.subtraversalc = 0 // reset subphase index to initial
215-
progress.seen += 1 // trace that we've seen a (sub)phase
213+
progress.currentUnitCount = 0 // reset unit count in current (sub)phase
214+
progress.currentCompletedSubtraversalCount = 0 // reset subphase index to initial
215+
progress.seenPhaseCount += 1 // trace that we've seen a (sub)phase
216216
if wasRan then
217217
// add an extra traversal now that we completed a (sub)phase
218-
progress.traversalc += 1
218+
progress.completedTraversalCount += 1
219219
else
220220
// no subphases were ran, remove traversals from expected total
221221
progress.totalTraversals -= currentPhase.traversals
222222

223223
private def doAdvanceSubPhase()(using Context): Unit =
224224
trackProgress: progress =>
225-
progress.unitc = 0 // reset unit count in current (sub)phase
226-
progress.seen += 1 // trace that we've seen a (sub)phase
227-
progress.traversalc += 1 // add an extra traversal now that we completed a (sub)phase
228-
progress.subtraversalc += 1 // record that we've seen a subphase
225+
progress.currentUnitCount = 0 // reset unit count in current (sub)phase
226+
progress.seenPhaseCount += 1 // trace that we've seen a (sub)phase
227+
progress.completedTraversalCount += 1 // add an extra traversal now that we completed a (sub)phase
228+
progress.currentCompletedSubtraversalCount += 1 // record that we've seen a subphase
229229
if !progress.isCancelled() then
230230
progress.tickSubphase()
231231

@@ -498,12 +498,12 @@ object Run {
498498
private class Progress(cb: ProgressCallback, private val run: Run, val initialTraversals: Int):
499499
export cb.{cancel, isCancelled}
500500

501-
private[Run] var totalTraversals: Int = initialTraversals // track how many phases we expect to run
502-
private[Run] var unitc: Int = 0 // current unit count in the current (sub)phase
503-
private[Run] var latec: Int = 0 // current late unit count
504-
private[Run] var traversalc: Int = 0 // completed traversals over all files
505-
private[Run] var subtraversalc: Int = 0 // completed subphases in the current phase
506-
private[Run] var seen: Int = 0 // how many phases we've seen so far
501+
var totalTraversals: Int = initialTraversals // track how many phases we expect to run
502+
var currentUnitCount: Int = 0 // current unit count in the current (sub)phase
503+
var currentLateUnitCount: Int = 0 // current late unit count
504+
var completedTraversalCount: Int = 0 // completed traversals over all files
505+
var currentCompletedSubtraversalCount: Int = 0 // completed subphases in the current phase
506+
var seenPhaseCount: Int = 0 // how many phases we've seen so far
507507

508508
private var currPhase: Phase = uninitialized // initialized by enterPhase
509509
private var subPhases: SubPhases = uninitialized // initialized by enterPhase
@@ -519,21 +519,21 @@ object Run {
519519

520520
/** Compute the current (sub)phase name and next (sub)phase name */
521521
private[Run] def tickSubphase()(using Context): Unit =
522-
val index = subtraversalc
522+
val index = currentCompletedSubtraversalCount
523523
val s = subPhases
524524
currPhaseName = s.subPhase(index)
525525
nextPhaseName =
526526
if index + 1 < s.all.size then s.subPhase(index + 1)
527527
else s.next match
528528
case None => "<end>"
529529
case Some(next0) => next0.subPhase(0)
530-
if seen > 0 then
530+
if seenPhaseCount > 0 then
531531
refreshProgress()
532532

533533

534534
/** Counts the number of completed full traversals over files, plus the number of units in the current phase */
535535
private def currentProgress(): Int =
536-
traversalc * work() + unitc + latec
536+
completedTraversalCount * work() + currentUnitCount + currentLateUnitCount
537537

538538
/**Total progress is computed as the sum of
539539
* - the number of traversals we expect to make over all files

compiler/src/dotty/tools/dotc/core/Contexts.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,6 @@ object Contexts {
186186
val local = progressCallback
187187
if local != null then op(local)
188188

189-
def cancelSignalRecorded: Boolean =
190-
val local = progressCallback
191-
val noSignalRecieved = local == null || !local.isCancelled
192-
!noSignalRecieved // if true then cancel request was recorded
193-
194189
/** The current plain printer */
195190
def printerFn: Context => Printer = store(printerFnLoc)
196191

compiler/src/dotty/tools/dotc/sbt/interfaces/ProgressCallback.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import dotty.tools.dotc.CompilationUnit;
44

55
public interface ProgressCallback {
6-
/** Record that the cancellation signal has been recieved during the Zinc run. */
6+
/** Record that the cancellation signal has been received during the Zinc run. */
77
default void cancel() {}
88

99
/** Report on if there was a cancellation signal for the current Zinc run. */

0 commit comments

Comments
 (0)