-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
153 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package dotty.tools.dotc | ||
|
||
import dotty.tools.dotc.core.SymDenotations.NoDenotation.exists | ||
import scala.collection.mutable | ||
import core.* | ||
import ast.* | ||
import Symbols.* | ||
import EventLog.* | ||
import Contexts.* | ||
import dotty.tools.dotc.transform.CheckUnused | ||
|
||
class EventLog { | ||
private val entries: mutable.ListBuffer[Entry] = mutable.ListBuffer() | ||
private var state = 0 | ||
|
||
inline def appendEntry(entry: Entry)(using Context): Unit = { | ||
state match { | ||
case Disabled => () | ||
case Enabled => entries += entry | ||
case Uninitialized => | ||
val enabled = ctx.base.allPhases.exists { phase => | ||
logReaderPhasesNames.contains(phase.phaseName) && phase.isRunnable | ||
} | ||
state = | ||
if enabled then | ||
entries += entry | ||
Enabled | ||
else Disabled | ||
} | ||
} | ||
|
||
def toSeq: Seq[Entry] = entries.toSeq | ||
|
||
} | ||
|
||
object EventLog { | ||
|
||
private val logReaderPhasesNames = Set( | ||
CheckUnused.phaseNamePrefix + CheckUnused.afterTyperSuffix, | ||
CheckUnused.phaseNamePrefix + CheckUnused.afterInliningSuffix | ||
) | ||
|
||
private val Uninitialized: Int = 0 | ||
private val Enabled = 1 | ||
private val Disabled = 2 | ||
|
||
sealed trait Entry | ||
case class MatchedImportSelector(importSym: Symbol, selector: untpd.ImportSelector) extends Entry | ||
case class ImplicitIntroducedViaImport(importSym: Symbol, tree: Tree, ref: TermRef) extends Entry | ||
case object FindRefFinished extends Entry | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.