Renames "possibly nothing" to "probably nothing"
This commit is contained in:
@@ -70,7 +70,7 @@ public abstract class ElementResolver {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected PossiblyNothingCallableNamesService possiblyNothingCallableNamesService() {
|
||||
protected ProbablyNothingCallableNamesService probablyNothingCallableNamesService() {
|
||||
return DefaultNothingCallableNamesService.INSTANCE$;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public abstract class ElementResolver {
|
||||
boolean inBody = body != null && PsiTreeUtil.isAncestor(body, jetElement, false);
|
||||
Function1<JetElement, Boolean> filter;
|
||||
if (inBody) {
|
||||
filter = new PartialBodyResolveFilter(jetElement, body, possiblyNothingCallableNamesService());
|
||||
filter = new PartialBodyResolveFilter(jetElement, body, probablyNothingCallableNamesService());
|
||||
}
|
||||
else { // do as less as possible body-resolve
|
||||
filter = new Function1<JetElement, Boolean>() {
|
||||
|
||||
@@ -30,13 +30,13 @@ import org.jetbrains.jet.lang.psi.psiUtil.isAncestor
|
||||
class PartialBodyResolveFilter(
|
||||
elementToResolve: JetElement,
|
||||
private val body: JetExpression,
|
||||
possiblyNothingCallableNamesService: PossiblyNothingCallableNamesService
|
||||
probablyNothingCallableNamesService: ProbablyNothingCallableNamesService
|
||||
) : (JetElement) -> Boolean {
|
||||
|
||||
private val statementsToResolve = HashSet<JetExpression>()
|
||||
private val processedBlocks = HashSet<JetBlockExpression>()
|
||||
private val possiblyNothingFunctionNames = possiblyNothingCallableNamesService.functionNames()
|
||||
private val possiblyNothingPropertyNames = possiblyNothingCallableNamesService.propertyNames()
|
||||
private val nothingFunctionNames = probablyNothingCallableNamesService.functionNames()
|
||||
private val nothingPropertyNames = probablyNothingCallableNamesService.propertyNames()
|
||||
|
||||
;{
|
||||
assert(body.isAncestor(elementToResolve, strict = false))
|
||||
@@ -286,7 +286,7 @@ class PartialBodyResolveFilter(
|
||||
|
||||
override fun visitCallExpression(expression: JetCallExpression) {
|
||||
val name = (expression.getCalleeExpression() as? JetSimpleNameExpression)?.getReferencedName()
|
||||
if (name != null && name in possiblyNothingFunctionNames) {
|
||||
if (name != null && name in nothingFunctionNames) {
|
||||
result.add(expression)
|
||||
}
|
||||
super.visitCallExpression(expression)
|
||||
@@ -294,7 +294,7 @@ class PartialBodyResolveFilter(
|
||||
|
||||
override fun visitSimpleNameExpression(expression: JetSimpleNameExpression) {
|
||||
val name = expression.getReferencedName()
|
||||
if (name in possiblyNothingPropertyNames) {
|
||||
if (name in nothingPropertyNames) {
|
||||
result.add(expression)
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -16,12 +16,12 @@
|
||||
|
||||
package org.jetbrains.jet.lang.resolve.lazy
|
||||
|
||||
public trait PossiblyNothingCallableNamesService {
|
||||
public trait ProbablyNothingCallableNamesService {
|
||||
public fun functionNames(): Set<String>
|
||||
public fun propertyNames(): Set<String>
|
||||
}
|
||||
|
||||
public object DefaultNothingCallableNamesService : PossiblyNothingCallableNamesService {
|
||||
public object DefaultNothingCallableNamesService : ProbablyNothingCallableNamesService {
|
||||
private val hardcodedNames = setOf("error")
|
||||
|
||||
override fun functionNames() = hardcodedNames
|
||||
Reference in New Issue
Block a user