Skip to content

Rewrite to indent 2 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: insert-indent-b
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/backend/jvm/CodeGen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class CodeGen(val int: DottyBackendInterface, val primitives: DottyPrimitives)(
GeneratedDefs(generatedClasses.toList, generatedTasty.toList)

// Creates a callback that will be evaluated in PostProcessor after creating a file
private def onFileCreated(cls: ClassNode, claszSymbol: Symbol, sourceFile: interfaces.SourceFile): AbstractFile => Unit = clsFile =>
private def onFileCreated(cls: ClassNode, claszSymbol: Symbol, sourceFile: interfaces.SourceFile): AbstractFile => Unit = clsFile => {
val (fullClassName, isLocal) = atPhase(sbtExtractDependenciesPhase):
(ExtractDependencies.classNameAsString(claszSymbol), claszSymbol.isLocal)

Expand All @@ -116,6 +116,7 @@ class CodeGen(val int: DottyBackendInterface, val primitives: DottyPrimitives)(
val cb = ctx.sbtCallback
if (isLocal) cb.generatedLocalClass(jSourceFile, clsFile.file)
else cb.generatedNonLocalClass(jSourceFile, clsFile.file, className, fullClassName)
}

/** Convert a `dotty.tools.io.AbstractFile` into a
* `dotty.tools.dotc.interfaces.AbstractFile`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ case class AggregateClassPath(aggregates: Seq[ClassPath]) extends ClassPath:
cp <- aggregates
entry <- getEntries(cp) if !seenNames.contains(entry.name)
}
{
entriesBuffer += entry
seenNames += entry.name
}
entriesBuffer.toIndexedSeq

object AggregateClassPath:
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/core/Comments.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import util.{SourceFile, ReadOnlyMap}
import util.Spans._
import util.CommentParsing._
import util.Property.Key
import parsing.Parsers.Parser
import parsing.Parsers
import reporting.ProperDefinitionNotFound

object Comments:
Expand Down Expand Up @@ -118,7 +118,7 @@ object Comments:
object UseCase:
def apply(code: String, codePos: Span)(using Context): UseCase =
val tree =
val tree = new Parser(SourceFile.virtual("<usecase>", code)).localDef(codePos.start)
val tree = Parsers.parser(SourceFile.virtual("<usecase>", code)).localDef(codePos.start)
tree match
case tree: untpd.DefDef =>
val newName = ctx.compilationUnit.freshNames.newName(tree.name, NameKinds.DocArtifactName)
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/inlines/Inlines.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import SymDenotations.SymDenotation
import config.Printers.inlining
import ErrorReporting.errorTree
import dotty.tools.dotc.util.{SourceFile, SourcePosition, SrcPos}
import parsing.Parsers.Parser
import parsing.Parsers
import transform.{PostTyper, Inlining, CrossVersionChecks}
import staging.StagingLevel

Expand Down Expand Up @@ -323,7 +323,7 @@ object Inlines:
case ConstantType(Constant(code: String)) =>
val source2 = SourceFile.virtual("tasty-reflect", code)
inContext(ctx.fresh.setNewTyperState().setTyper(new Typer(ctx.nestingLevel + 1)).setSource(source2)):
val tree2 = new Parser(source2).block()
val tree2 = Parsers.parser(source2).block()
if ctx.reporter.allErrors.nonEmpty then
ctx.reporter.allErrors.map((ErrorKind.Parser, _))
else
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/parsing/ParserPhase.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Parser extends Phase:
unit.untpdTree =
if (unit.isJava) new JavaParsers.JavaParser(unit.source).parse()
else
val p = new Parsers.Parser(unit.source)
val p = Parsers.parser(unit.source)
// p.in.debugTokenStream = true
val tree = p.parse()
if (p.firstXmlPos.exists && !firstXmlPos.exists)
Expand Down
Loading