Renames "possibly nothing" to "probably nothing"
This commit is contained in:
@@ -29,5 +29,5 @@ public interface KotlinFunctionStub extends KotlinStubWithFqName<JetNamedFunctio
|
||||
|
||||
boolean hasTypeParameterListBeforeFunctionName();
|
||||
|
||||
boolean isPossiblyNothingType();
|
||||
boolean isProbablyNothingType();
|
||||
}
|
||||
|
||||
@@ -27,5 +27,5 @@ public interface KotlinPropertyStub extends KotlinStubWithFqName<JetProperty> {
|
||||
boolean hasReceiverTypeRef();
|
||||
boolean hasReturnTypeRef();
|
||||
|
||||
boolean isPossiblyNothingType();
|
||||
boolean isProbablyNothingType();
|
||||
}
|
||||
|
||||
+4
-5
@@ -44,10 +44,9 @@ public class JetFunctionElementType extends JetStubElementType<KotlinFunctionStu
|
||||
FqName fqName = ResolveSessionUtils.safeFqNameForLazyResolve(psi);
|
||||
boolean hasBlockBody = psi.hasBlockBody();
|
||||
boolean hasBody = psi.hasBody();
|
||||
boolean isNothing = ElementsPackage.isPossiblyNothing(psi.getTypeReference());
|
||||
return new KotlinFunctionStubImpl(parentStub, StringRef.fromString(psi.getName()), isTopLevel, fqName,
|
||||
isExtension, hasBlockBody, hasBody, psi.hasTypeParameterListBeforeFunctionName(),
|
||||
isNothing);
|
||||
ElementsPackage.isProbablyNothing(psi.getTypeReference()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,7 +61,7 @@ public class JetFunctionElementType extends JetStubElementType<KotlinFunctionStu
|
||||
dataStream.writeBoolean(stub.hasBlockBody());
|
||||
dataStream.writeBoolean(stub.hasBody());
|
||||
dataStream.writeBoolean(stub.hasTypeParameterListBeforeFunctionName());
|
||||
dataStream.writeBoolean(stub.isPossiblyNothingType());
|
||||
dataStream.writeBoolean(stub.isProbablyNothingType());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -78,10 +77,10 @@ public class JetFunctionElementType extends JetStubElementType<KotlinFunctionStu
|
||||
boolean hasBlockBody = dataStream.readBoolean();
|
||||
boolean hasBody = dataStream.readBoolean();
|
||||
boolean hasTypeParameterListBeforeFunctionName = dataStream.readBoolean();
|
||||
boolean possiblyNothingType = dataStream.readBoolean();
|
||||
boolean probablyNothingType = dataStream.readBoolean();
|
||||
|
||||
return new KotlinFunctionStubImpl(parentStub, name, isTopLevel, fqName, isExtension, hasBlockBody, hasBody,
|
||||
hasTypeParameterListBeforeFunctionName, possiblyNothingType);
|
||||
hasTypeParameterListBeforeFunctionName, probablyNothingType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+4
-4
@@ -47,7 +47,7 @@ public class JetPropertyElementType extends JetStubElementType<KotlinPropertyStu
|
||||
psi.isVar(), psi.isTopLevel(), psi.hasDelegate(),
|
||||
psi.hasDelegateExpression(), psi.hasInitializer(),
|
||||
psi.getReceiverTypeReference() != null, psi.getTypeReference() != null,
|
||||
ElementsPackage.isPossiblyNothing(psi.getTypeReference()),
|
||||
ElementsPackage.isProbablyNothing(psi.getTypeReference()),
|
||||
ResolveSessionUtils.safeFqNameForLazyResolve(psi)
|
||||
);
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class JetPropertyElementType extends JetStubElementType<KotlinPropertyStu
|
||||
dataStream.writeBoolean(stub.hasInitializer());
|
||||
dataStream.writeBoolean(stub.hasReceiverTypeRef());
|
||||
dataStream.writeBoolean(stub.hasReturnTypeRef());
|
||||
dataStream.writeBoolean(stub.isPossiblyNothingType());
|
||||
dataStream.writeBoolean(stub.isProbablyNothingType());
|
||||
|
||||
FqName fqName = stub.getFqName();
|
||||
dataStream.writeName(fqName != null ? fqName.asString() : null);
|
||||
@@ -79,13 +79,13 @@ public class JetPropertyElementType extends JetStubElementType<KotlinPropertyStu
|
||||
boolean hasInitializer = dataStream.readBoolean();
|
||||
boolean hasReceiverTypeRef = dataStream.readBoolean();
|
||||
boolean hasReturnTypeRef = dataStream.readBoolean();
|
||||
boolean possiblyNothing = dataStream.readBoolean();
|
||||
boolean probablyNothing = dataStream.readBoolean();
|
||||
|
||||
StringRef fqNameAsString = dataStream.readName();
|
||||
FqName fqName = fqNameAsString != null ? new FqName(fqNameAsString.toString()) : null;
|
||||
|
||||
return new KotlinPropertyStubImpl(parentStub, name, isVar, isTopLevel, hasDelegate,
|
||||
hasDelegateExpression, hasInitializer, hasReceiverTypeRef, hasReturnTypeRef, possiblyNothing,
|
||||
hasDelegateExpression, hasInitializer, hasReceiverTypeRef, hasReturnTypeRef, probablyNothing,
|
||||
fqName);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,5 +19,5 @@ package org.jetbrains.jet.lang.psi.stubs.elements
|
||||
import org.jetbrains.jet.lang.psi.JetUserType
|
||||
import org.jetbrains.jet.lang.psi.JetTypeReference
|
||||
|
||||
fun JetTypeReference?.isPossiblyNothing()
|
||||
fun JetTypeReference?.isProbablyNothing()
|
||||
= (this?.getTypeElement() as? JetUserType)?.getReferencedName() == "Nothing"
|
||||
+5
-5
@@ -34,7 +34,7 @@ public class KotlinFunctionStubImpl extends KotlinStubBaseImpl<JetNamedFunction>
|
||||
private final boolean hasBlockBody;
|
||||
private final boolean hasBody;
|
||||
private final boolean hasTypeParameterListBeforeFunctionName;
|
||||
private final boolean possiblyNothingType;
|
||||
private final boolean probablyNothingType;
|
||||
|
||||
public KotlinFunctionStubImpl(
|
||||
@NotNull StubElement parent,
|
||||
@@ -45,7 +45,7 @@ public class KotlinFunctionStubImpl extends KotlinStubBaseImpl<JetNamedFunction>
|
||||
boolean hasBlockBody,
|
||||
boolean hasBody,
|
||||
boolean hasTypeParameterListBeforeFunctionName,
|
||||
boolean possiblyNothingType
|
||||
boolean probablyNothingType
|
||||
) {
|
||||
super(parent, JetStubElementTypes.FUNCTION);
|
||||
|
||||
@@ -60,7 +60,7 @@ public class KotlinFunctionStubImpl extends KotlinStubBaseImpl<JetNamedFunction>
|
||||
this.hasBlockBody = hasBlockBody;
|
||||
this.hasBody = hasBody;
|
||||
this.hasTypeParameterListBeforeFunctionName = hasTypeParameterListBeforeFunctionName;
|
||||
this.possiblyNothingType = possiblyNothingType;
|
||||
this.probablyNothingType = probablyNothingType;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,7 +100,7 @@ public class KotlinFunctionStubImpl extends KotlinStubBaseImpl<JetNamedFunction>
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPossiblyNothingType() {
|
||||
return possiblyNothingType;
|
||||
public boolean isProbablyNothingType() {
|
||||
return probablyNothingType;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -33,7 +33,7 @@ public class KotlinPropertyStubImpl extends KotlinStubBaseImpl<JetProperty> impl
|
||||
private final boolean hasInitializer;
|
||||
private final boolean hasReceiverTypeRef;
|
||||
private final boolean hasReturnTypeRef;
|
||||
private final boolean possiblyNothingType;
|
||||
private final boolean probablyNothingType;
|
||||
private final FqName fqName;
|
||||
|
||||
public KotlinPropertyStubImpl(
|
||||
@@ -46,7 +46,7 @@ public class KotlinPropertyStubImpl extends KotlinStubBaseImpl<JetProperty> impl
|
||||
boolean hasInitializer,
|
||||
boolean hasReceiverTypeRef,
|
||||
boolean hasReturnTypeRef,
|
||||
boolean possiblyNothingType,
|
||||
boolean probablyNothingType,
|
||||
@Nullable FqName fqName
|
||||
) {
|
||||
super(parent, JetStubElementTypes.PROPERTY);
|
||||
@@ -66,7 +66,7 @@ public class KotlinPropertyStubImpl extends KotlinStubBaseImpl<JetProperty> impl
|
||||
this.hasInitializer = hasInitializer;
|
||||
this.hasReceiverTypeRef = hasReceiverTypeRef;
|
||||
this.hasReturnTypeRef = hasReturnTypeRef;
|
||||
this.possiblyNothingType = possiblyNothingType;
|
||||
this.probablyNothingType = probablyNothingType;
|
||||
this.fqName = fqName;
|
||||
}
|
||||
|
||||
@@ -106,8 +106,8 @@ public class KotlinPropertyStubImpl extends KotlinStubBaseImpl<JetProperty> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPossiblyNothingType() {
|
||||
return possiblyNothingType;
|
||||
public boolean isProbablyNothingType() {
|
||||
return probablyNothingType;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -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
|
||||
@@ -30,10 +30,10 @@ import org.jetbrains.jet.lang.resolve.AdditionalCheckerProvider;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.DefaultNothingCallableNamesService;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.ElementResolver;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.PossiblyNothingCallableNamesService;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.ProbablyNothingCallableNamesService;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.ResolveSession;
|
||||
import org.jetbrains.jet.plugin.stubindex.JetPossiblyNothingFunctionShortNameIndex;
|
||||
import org.jetbrains.jet.plugin.stubindex.JetPossiblyNothingPropertyShortNameIndex;
|
||||
import org.jetbrains.jet.plugin.stubindex.JetProbablyNothingFunctionShortNameIndex;
|
||||
import org.jetbrains.jet.plugin.stubindex.JetProbablyNothingPropertyShortNameIndex;
|
||||
import org.jetbrains.jet.storage.LazyResolveStorageManager;
|
||||
import org.jetbrains.jet.storage.MemoizedFunctionToNotNull;
|
||||
|
||||
@@ -87,14 +87,14 @@ public class ResolveElementCache extends ElementResolver {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected PossiblyNothingCallableNamesService possiblyNothingCallableNamesService() {
|
||||
return new PossiblyNothingCallableNamesService() {
|
||||
protected ProbablyNothingCallableNamesService probablyNothingCallableNamesService() {
|
||||
return new ProbablyNothingCallableNamesService() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<String> functionNames() {
|
||||
// we have to add hardcoded-names until we have Kotlin compiled classes in caches
|
||||
Set<String> hardcodedNames = DefaultNothingCallableNamesService.INSTANCE$.functionNames();
|
||||
Collection<String> indexedNames = JetPossiblyNothingFunctionShortNameIndex.getInstance().getAllKeys(project);
|
||||
Collection<String> indexedNames = JetProbablyNothingFunctionShortNameIndex.getInstance().getAllKeys(project);
|
||||
Set<String> set = new HashSet<String>(hardcodedNames.size() + indexedNames.size());
|
||||
set.addAll(hardcodedNames);
|
||||
set.addAll(indexedNames);
|
||||
@@ -105,7 +105,7 @@ public class ResolveElementCache extends ElementResolver {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<String> propertyNames() {
|
||||
return new HashSet<String>(JetPossiblyNothingPropertyShortNameIndex.getInstance().getAllKeys(project));
|
||||
return new HashSet<String>(JetProbablyNothingPropertyShortNameIndex.getInstance().getAllKeys(project));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
+5
-5
@@ -25,16 +25,16 @@ import org.jetbrains.jet.lang.psi.JetNamedFunction;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class JetPossiblyNothingFunctionShortNameIndex extends StringStubIndexExtension<JetNamedFunction> {
|
||||
private static final StubIndexKey<String, JetNamedFunction> KEY = KotlinIndexUtil.createIndexKey(JetPossiblyNothingFunctionShortNameIndex.class);
|
||||
public class JetProbablyNothingFunctionShortNameIndex extends StringStubIndexExtension<JetNamedFunction> {
|
||||
private static final StubIndexKey<String, JetNamedFunction> KEY = KotlinIndexUtil.createIndexKey(JetProbablyNothingFunctionShortNameIndex.class);
|
||||
|
||||
private static final JetPossiblyNothingFunctionShortNameIndex ourInstance = new JetPossiblyNothingFunctionShortNameIndex();
|
||||
private static final JetProbablyNothingFunctionShortNameIndex ourInstance = new JetProbablyNothingFunctionShortNameIndex();
|
||||
|
||||
public static JetPossiblyNothingFunctionShortNameIndex getInstance() {
|
||||
public static JetProbablyNothingFunctionShortNameIndex getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private JetPossiblyNothingFunctionShortNameIndex() {}
|
||||
private JetProbablyNothingFunctionShortNameIndex() {}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
+5
-5
@@ -25,16 +25,16 @@ import org.jetbrains.jet.lang.psi.JetProperty;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class JetPossiblyNothingPropertyShortNameIndex extends StringStubIndexExtension<JetProperty> {
|
||||
private static final StubIndexKey<String, JetProperty> KEY = KotlinIndexUtil.createIndexKey(JetPossiblyNothingPropertyShortNameIndex.class);
|
||||
public class JetProbablyNothingPropertyShortNameIndex extends StringStubIndexExtension<JetProperty> {
|
||||
private static final StubIndexKey<String, JetProperty> KEY = KotlinIndexUtil.createIndexKey(JetProbablyNothingPropertyShortNameIndex.class);
|
||||
|
||||
private static final JetPossiblyNothingPropertyShortNameIndex ourInstance = new JetPossiblyNothingPropertyShortNameIndex();
|
||||
private static final JetProbablyNothingPropertyShortNameIndex ourInstance = new JetProbablyNothingPropertyShortNameIndex();
|
||||
|
||||
public static JetPossiblyNothingPropertyShortNameIndex getInstance() {
|
||||
public static JetProbablyNothingPropertyShortNameIndex getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private JetPossiblyNothingPropertyShortNameIndex() {}
|
||||
private JetProbablyNothingPropertyShortNameIndex() {}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -114,8 +114,8 @@ public class StubIndexServiceImpl implements StubIndexService {
|
||||
}
|
||||
sink.occurrence(JetFunctionShortNameIndex.getInstance().getKey(), name);
|
||||
|
||||
if (stub.isPossiblyNothingType()) {
|
||||
sink.occurrence(JetPossiblyNothingFunctionShortNameIndex.getInstance().getKey(), name);
|
||||
if (stub.isProbablyNothingType()) {
|
||||
sink.occurrence(JetProbablyNothingFunctionShortNameIndex.getInstance().getKey(), name);
|
||||
}
|
||||
}
|
||||
// can have special fq name in case of syntactically incorrect function with no name
|
||||
@@ -141,8 +141,8 @@ public class StubIndexServiceImpl implements StubIndexService {
|
||||
|
||||
sink.occurrence(JetPropertyShortNameIndex.getInstance().getKey(), name);
|
||||
|
||||
if (stub.isPossiblyNothingType()) {
|
||||
sink.occurrence(JetPossiblyNothingPropertyShortNameIndex.getInstance().getKey(), name);
|
||||
if (stub.isProbablyNothingType()) {
|
||||
sink.occurrence(JetProbablyNothingPropertyShortNameIndex.getInstance().getKey(), name);
|
||||
}
|
||||
}
|
||||
// can have special fq name in case of syntactically incorrect function with no name
|
||||
|
||||
@@ -395,8 +395,8 @@
|
||||
<stubIndex implementation="org.jetbrains.jet.plugin.stubindex.JetTopLevelPropertiesFqnNameIndex"/>
|
||||
<stubIndex implementation="org.jetbrains.jet.plugin.stubindex.JetAnnotationsIndex"/>
|
||||
<stubIndex implementation="org.jetbrains.jet.plugin.stubindex.JetTopLevelObjectShortNameIndex"/>
|
||||
<stubIndex implementation="org.jetbrains.jet.plugin.stubindex.JetPossiblyNothingFunctionShortNameIndex"/>
|
||||
<stubIndex implementation="org.jetbrains.jet.plugin.stubindex.JetPossiblyNothingPropertyShortNameIndex"/>
|
||||
<stubIndex implementation="org.jetbrains.jet.plugin.stubindex.JetProbablyNothingFunctionShortNameIndex"/>
|
||||
<stubIndex implementation="org.jetbrains.jet.plugin.stubindex.JetProbablyNothingPropertyShortNameIndex"/>
|
||||
|
||||
<psi.classFileDecompiler implementation="org.jetbrains.jet.plugin.decompiler.JetClassFileDecompiler"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user