Skip to content

Commit a9e750c

Browse files
committed
Refactor completions
Following "name all the things" mantra.
1 parent 154e7cb commit a9e750c

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

compiler/src/dotty/tools/dotc/interactive/Interactive.scala

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import ast.{NavigateAST, Trees, tpd, untpd}
99
import core._, core.Decorators.{sourcePos => _, _}
1010
import Contexts._, Flags._, Names._, NameOps._, Symbols._, SymDenotations._, Trees._, Types._
1111
import util.Positions._, util.SourcePosition
12+
import core.Denotations.SingleDenotation
1213
import NameKinds.SimpleNameKind
1314

1415
/** High-level API to get information out of typed trees, designed to be used by IDEs.
@@ -126,13 +127,11 @@ object Interactive {
126127
safely {
127128
if (boundary != NoSymbol) {
128129
val boundaryCtx = ctx.withOwner(boundary)
129-
prefix.memberDenots(completionsFilter, (name, buf) =>
130-
buf ++= prefix.member(name).altsWith{ d =>
131-
!d.isAbsent &&
132-
!d.is(Synthetic) && !d.is(Artifact) &&
133-
d.symbol.isAccessibleFrom(prefix)(boundaryCtx)
134-
}
135-
).map(_.symbol).toList
130+
def exclude(sym: Symbol) = sym.isAbsent || sym.is(Synthetic) || sym.is(Artifact)
131+
def addMember(name: Name, buf: mutable.Buffer[SingleDenotation]): Unit =
132+
buf ++= prefix.member(name).altsWith(d =>
133+
!exclude(d) && d.symbol.isAccessibleFrom(prefix)(boundaryCtx))
134+
prefix.memberDenots(completionsFilter, addMember).map(_.symbol).toList
136135
}
137136
else Nil
138137
}

0 commit comments

Comments
 (0)