Skip to content

Commit c0e01e9

Browse files
committed
Remove DottyBackendInterface.sourcePos
1 parent 1e4439a commit c0e01e9

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

compiler/src/dotty/tools/backend/jvm/BCodeBodyBuilder.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
663663
var elemKind = arr.elementType
664664
val argsSize = args.length
665665
if (argsSize > dims) {
666-
ctx.error(s"too many arguments for array constructor: found ${args.length} but array has only $dims dimension(s)", sourcePos(app.span))
666+
ctx.error(s"too many arguments for array constructor: found ${args.length} but array has only $dims dimension(s)", app.sourcePos)
667667
}
668668
if (argsSize < dims) {
669669
/* In one step:

compiler/src/dotty/tools/backend/jvm/BCodeHelpers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
5959
outputDirectory
6060
} catch {
6161
case ex: Throwable =>
62-
ctx.error(s"Couldn't create file for class $cName\n${ex.getMessage}", sourcePos(csym.span))
62+
ctx.error(s"Couldn't create file for class $cName\n${ex.getMessage}", csym.sourcePos)
6363
null
6464
}
6565
}

compiler/src/dotty/tools/backend/jvm/BCodeSkelBuilder.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ trait BCodeSkelBuilder extends BCodeHelpers {
403403
val loc = Local(tk, sym.name.mangledString.toString, nxtIdx, sym.is(Flags.Synthetic))
404404
val existing = slots.put(sym, loc)
405405
if (existing.isDefined)
406-
ctx.error("attempt to create duplicate local var.", sourcePos(sym.span))
406+
ctx.error("attempt to create duplicate local var.", sym.sourcePos)
407407
assert(tk.size > 0, "makeLocal called for a symbol whose type is Unit.")
408408
nxtIdx += tk.size
409409
loc
@@ -453,7 +453,7 @@ trait BCodeSkelBuilder extends BCodeHelpers {
453453
}
454454
def lineNumber(tree: Tree): Unit = {
455455
if (!emitLines || !tree.span.exists) return;
456-
val nr = sourcePos(tree.span).line + 1
456+
val nr = tree.sourcePos.line + 1
457457
if (nr != lastEmittedLineNr) {
458458
lastEmittedLineNr = nr
459459
lastInsn match {
@@ -556,7 +556,7 @@ trait BCodeSkelBuilder extends BCodeHelpers {
556556

557557
if (params.size > MaximumJvmParameters) {
558558
// SI-7324
559-
ctx.error(s"Platform restriction: a parameter list's length cannot exceed $MaximumJvmParameters.", sourcePos(methSymbol.span))
559+
ctx.error(s"Platform restriction: a parameter list's length cannot exceed $MaximumJvmParameters.", methSymbol.sourcePos)
560560
return
561561
}
562562

@@ -585,7 +585,7 @@ trait BCodeSkelBuilder extends BCodeHelpers {
585585
ctx.error("Concrete method has no definition: " + dd + (
586586
if (ctx.settings.Ydebug.value) "(found: " + methSymbol.owner.info.decls.toList.mkString(", ") + ")"
587587
else ""),
588-
sourcePos(NoSpan)
588+
ctx.source.atSpan(NoSpan)
589589
)
590590
case _ =>
591591
bc emitRETURN returnType

compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ class DottyBackendInterface(val outputDirectory: AbstractFile, val superCallsMap
7575
ctx.error(msg)
7676
throw new RuntimeException(msg)
7777
}
78-
def sourcePos(pos: Spans.Span)(implicit ctx: Context): util.SourcePosition =
79-
ctx.source.atSpan(pos)
8078

8179
val perRunCaches: Caches = new Caches {
8280
def newAnyRefMap[K <: AnyRef, V](): mutable.AnyRefMap[K, V] = new mutable.AnyRefMap[K, V]()
@@ -347,7 +345,7 @@ class DottyBackendInterface(val outputDirectory: AbstractFile, val superCallsMap
347345
def _1: Type = field.tpe match {
348346
case JavaArrayType(elem) => elem
349347
case _ =>
350-
ctx.error(s"JavaSeqArray with type ${field.tpe} reached backend: $field", sourcePos(field.span))
348+
ctx.error(s"JavaSeqArray with type ${field.tpe} reached backend: $field", field.sourcePos)
351349
UnspecifiedErrorType
352350
}
353351
def _2: List[Tree] = field.elems

0 commit comments

Comments
 (0)