Skip to content

Commit

Permalink
use explicit unitContext
Browse files Browse the repository at this point in the history
  • Loading branch information
bishabosha committed Oct 25, 2023
1 parent e92a834 commit 550c316
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/fromtasty/ReadTasty.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ReadTasty extends Phase {
withMode(Mode.ReadPositions) {
val nextUnits = collection.mutable.ListBuffer.empty[CompilationUnit]
val unitContexts = units.view.map(ctx.fresh.setCompilationUnit)
for given Context <- unitContexts if addTasty(nextUnits += _) do ()
for unitContext <- unitContexts if addTasty(nextUnits += _)(using unitContext) do ()
nextUnits.toList
}

Expand Down
6 changes: 3 additions & 3 deletions compiler/src/dotty/tools/dotc/parsing/ParserPhase.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ class Parser extends Phase {

val unitContexts0 =
for
given Context <- unitContexts
if parse
yield ctx
unitContext <- unitContexts
if parse(using unitContext)
yield unitContext

record("parsedTrees", ast.Trees.ntrees)

Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/transform/init/Checker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Checker extends Phase:
val unitContexts = units.map(unit => checkCtx.fresh.setCompilationUnit(unit))

val units0 =
for given Context <- unitContexts if traverse(traverser) yield ctx.compilationUnit
for unitContext <- unitContexts if traverse(traverser)(using unitContext) yield unitContext.compilationUnit

cancellable {
val classes = traverser.getClasses()
Expand Down
18 changes: 9 additions & 9 deletions compiler/src/dotty/tools/dotc/typer/TyperPhase.scala
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ class TyperPhase(addRootImports: Boolean = true) extends Phase {
val unitContexts0 =
try
for
given Context <- unitContexts
if enterSyms
yield ctx
unitContext <- unitContexts
if enterSyms(using unitContext)
yield unitContext
finally
ctx.run.advanceSubPhase() // tick from "typer (indexing)" to "typer (typechecking)"

Expand All @@ -94,19 +94,19 @@ class TyperPhase(addRootImports: Boolean = true) extends Phase {
val unitContexts1 =
try
for
given Context <- unitContexts0
if typeCheck
yield ctx
unitContext <- unitContexts0
if typeCheck(using unitContext)
yield unitContext
finally
ctx.run.advanceSubPhase() // tick from "typer (typechecking)" to "typer (java checking)"

record("total trees after typer", ast.Trees.ntrees)

val unitContexts2 =
for
given Context <- unitContexts1
if javaCheck // after typechecking to avoid cycles
yield ctx
unitContext <- unitContexts1
if javaCheck(using unitContext) // after typechecking to avoid cycles
yield unitContext

val newUnits = unitContexts2.map(_.compilationUnit).filterNot(discardAfterTyper)
ctx.run.nn.checkSuspendedUnits(newUnits)
Expand Down

0 comments on commit 550c316

Please sign in to comment.