Skip to content

Commit 7faeced

Browse files
committed
Compute 'pos.point' only once
1 parent e5fc2be commit 7faeced

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,11 @@ object Trees {
337337
* a calling chain from `viewExists`), in that case the return position is NoPosition.
338338
*/
339339
def namePos =
340-
if (pos.exists)
341-
if (rawMods.is(Synthetic) || name.toTermName == nme.ERROR) Position(pos.point, pos.point)
342-
else Position(pos.point, pos.point + name.stripModuleClassSuffix.lastPart.length, pos.point)
340+
if (pos.exists) {
341+
val point = pos.point
342+
if (rawMods.is(Synthetic) || name.toTermName == nme.ERROR) Position(point)
343+
else Position(point, point + name.stripModuleClassSuffix.lastPart.length, point)
344+
}
343345
else pos
344346
}
345347

0 commit comments

Comments
 (0)