@@ -62,8 +62,8 @@ object Interactive {
62
62
sourceSymbol(sym.owner)
63
63
else sym
64
64
65
- private def safely [T ](default : T )( op : => T ) =
66
- try op catch { case ex : TypeError => default }
65
+ private def safely [T ](op : => List [ T ]) : List [ T ] =
66
+ try op catch { case ex : TypeError => Nil }
67
67
68
68
/** Possible completions at position `pos` */
69
69
def completions (trees : List [SourceTree ], pos : SourcePosition )(implicit ctx : Context ): List [Symbol ] = {
@@ -89,7 +89,7 @@ object Interactive {
89
89
90
90
/** Possible completions of members of `prefix` which are accessible when called inside `boundary` */
91
91
def completions (prefix : Type , boundary : Symbol )(implicit ctx : Context ): List [Symbol ] =
92
- safely( Nil ) {
92
+ safely {
93
93
val boundaryCtx = ctx.withOwner(boundary)
94
94
prefix.memberDenots(completionsFilter, (name, buf) =>
95
95
buf ++= prefix.member(name).altsWith(d => ! d.isAbsent && d.symbol.isAccessibleFrom(prefix)(boundaryCtx))
@@ -131,7 +131,7 @@ object Interactive {
131
131
* @param includeReferences If true, include references and not just definitions
132
132
*/
133
133
def namedTrees (trees : List [SourceTree ], includeReferences : Boolean , treePredicate : NameTree => Boolean )
134
- (implicit ctx : Context ): List [SourceTree ] = safely( Nil ) {
134
+ (implicit ctx : Context ): List [SourceTree ] = safely {
135
135
val buf = new mutable.ListBuffer [SourceTree ]
136
136
137
137
trees foreach { case SourceTree (topTree, source) =>
0 commit comments