Skip to content

Commit a3d928e

Browse files
committed
Remove stateful enterSyms.
More unused.
1 parent 54ff628 commit a3d928e

File tree

2 files changed

+3
-44
lines changed

2 files changed

+3
-44
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,29 +1410,6 @@ object desugar {
14101410
FunctionWithMods(params, body, Modifiers(mods))
14111411
}
14121412

1413-
/** Add annotation to tree:
1414-
* tree @fullName
1415-
*
1416-
* The annotation is usually represented as a TypeTree referring to the class
1417-
* with the given name `fullName`. However, if the annotation matches a file name
1418-
* that is still to be entered, the annotation is represented as a cascade of `Selects`
1419-
* following `fullName`. This is necessary so that we avoid reading an annotation from
1420-
* the classpath that is also compiled from source.
1421-
*/
1422-
def makeAnnotated(fullName: String, tree: Tree)(using Context): Annotated = {
1423-
val parts = fullName.split('.')
1424-
val ttree = typerPhase match {
1425-
case phase: TyperPhase if phase.stillToBeEntered(parts.last) =>
1426-
val prefix =
1427-
parts.init.foldLeft(Ident(nme.ROOTPKG): Tree)((qual, name) =>
1428-
Select(qual, name.toTermName))
1429-
Select(prefix, parts.last.toTypeName)
1430-
case _ =>
1431-
TypeTree(requiredClass(fullName).typeRef)
1432-
}
1433-
Annotated(tree, New(ttree, Nil))
1434-
}
1435-
14361413
private def derivedValDef(original: Tree, named: NameTree, tpt: Tree, rhs: Tree, mods: Modifiers)(using Context) = {
14371414
val vdef = ValDef(named.name.asTermName, tpt, rhs)
14381415
.withMods(mods)

compiler/src/dotty/tools/dotc/typer/TyperPhase.scala

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,6 @@ class TyperPhase(addRootImports: Boolean = true) extends Phase {
3131

3232
override def allowsImplicitSearch: Boolean = true
3333

34-
/** The contexts for compilation units that are parsed but not yet entered */
35-
private var remaining: List[Context] = Nil
36-
37-
/** Does a source file ending with `<name>.scala` belong to a compilation unit
38-
* that is parsed but not yet entered?
39-
*/
40-
def stillToBeEntered(name: String): Boolean =
41-
remaining.exists(_.compilationUnit.toString.endsWith(name + ".scala"))
42-
4334
// Run regardless of parsing errors
4435
override def isRunnable(implicit ctx: Context): Boolean = true
4536

@@ -68,13 +59,6 @@ class TyperPhase(addRootImports: Boolean = true) extends Phase {
6859
JavaChecks.check(unit.tpdTree)
6960
}
7061

71-
72-
private def firstTopLevelDef(trees: List[tpd.Tree])(using Context): Symbol = trees match
73-
case PackageDef(_, defs) :: _ => firstTopLevelDef(defs)
74-
case Import(_, _) :: defs => firstTopLevelDef(defs)
75-
case (tree @ TypeDef(_, _)) :: _ => tree.symbol
76-
case _ => NoSymbol
77-
7862
protected def discardAfterTyper(unit: CompilationUnit)(using Context): Boolean =
7963
unit.isJava || unit.suspended
8064

@@ -89,11 +73,9 @@ class TyperPhase(addRootImports: Boolean = true) extends Phase {
8973
else
9074
newCtx
9175

92-
remaining = unitContexts
93-
while remaining.nonEmpty do
94-
enterSyms(using remaining.head)
95-
remaining = remaining.tail
96-
val firstXmlPos = ctx.base.parserPhase match {
76+
unitContexts.foreach(enterSyms(using _))
77+
78+
ctx.base.parserPhase match {
9779
case p: ParserPhase =>
9880
if p.firstXmlPos.exists && !defn.ScalaXmlPackageClass.exists then
9981
report.error(

0 commit comments

Comments
 (0)