Skip to content

Commit

Permalink
refactor names
Browse files Browse the repository at this point in the history
  • Loading branch information
bishabosha committed May 27, 2021
1 parent 88b39db commit b982522
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/ast/Desugar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ object desugar {
val modul = ValDef(moduleName, clsRef, New(clsRef, Nil))
.withMods(mods.toTermFlags & RetainedModuleValFlags | ModuleValCreationFlags)
.withSpan(mdef.span.startPos)
.withEndIndex(copyFrom=mdef)
.withEndIndex(copyFrom = mdef)
val ValDef(selfName, selfTpt, _) = impl.self
val selfMods = impl.self.mods
if (!selfTpt.isEmpty) report.error(ObjectMayNotHaveSelfType(mdef), impl.self.srcPos)
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/ast/Trees.scala
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ object Trees {
self.withAttachment(EndIndex, index)

final def withEndIndex(copyFrom: WithEndMarker): self.type =
copyFrom.endIndex.foreach(index => withEndIndex(index))
copyFrom.endIndex.foreach(withEndIndex)
this

final def dropEndIndex: self.type =
Expand Down
6 changes: 3 additions & 3 deletions compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1293,20 +1293,20 @@ object Parsers {
case _: (ForYield | ForDo) => in.token == FOR
case _ => false

def matchesWithUpdated(stat: Tree): Boolean = {
def matchesAndSetEnd(stat: Tree): Boolean = {
val didMatch = matches(stat)
if didMatch then
stat match
case stat: WithEndMarker =>
stat.withEndIndex(index=in.lastCharOffset)
stat.withEndIndex(index = in.lastCharOffset)
case _ =>
()
didMatch
}

if in.token == END then
val start = in.skipToken()
if stats.isEmpty || !matchesWithUpdated(stats.last) then
if stats.isEmpty || !matchesAndSetEnd(stats.last) then
syntaxError("misaligned end marker", Span(start, in.lastCharOffset))
in.token = IDENTIFIER // Leaving it as the original token can confuse newline insertion
in.nextToken()
Expand Down

0 comments on commit b982522

Please sign in to comment.