JetSimpleNameExpression's name is not null
Modify usages accordingly
This commit is contained in:
@@ -293,7 +293,6 @@ public class JetControlFlowProcessor {
|
||||
if (baseExpression == null) return;
|
||||
if (JetTokens.LABELS.contains(operationType)) {
|
||||
String referencedName = operationSign.getReferencedName();
|
||||
referencedName = referencedName == null ? " <?>" : referencedName;
|
||||
visitLabeledExpression(referencedName.substring(1), baseExpression);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.jetbrains.jet.lang.psi;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.impl.CheckUtil;
|
||||
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil;
|
||||
@@ -339,7 +338,7 @@ public class JetPsiUtil {
|
||||
}
|
||||
|
||||
//noinspection ConstantConditions
|
||||
return StringUtil.isNotEmpty(aliasName) ? Name.identifier(aliasName) : null;
|
||||
return !aliasName.isEmpty() ? Name.identifier(aliasName) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -72,19 +72,16 @@ public class JetSimpleNameExpression extends JetReferenceExpression {
|
||||
parent.getParent() instanceof JetImportDirective;
|
||||
}
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
@NotNull
|
||||
public String getReferencedName() {
|
||||
String text = getReferencedNameElement().getNode().getText();
|
||||
return text != null ? JetPsiUtil.unquoteIdentifierOrFieldReference(text) : null;
|
||||
return JetPsiUtil.unquoteIdentifierOrFieldReference(text);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
public Name getReferencedNameAsName() {
|
||||
String name = getReferencedName();
|
||||
if (name != null && name.length() == 0) {
|
||||
// TODO: fix parser or do something // stepan.koltsov@
|
||||
}
|
||||
return name != null ? Name.identifierNoValidate(name) : null;
|
||||
return Name.identifierNoValidate(name);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -592,9 +592,6 @@ public class DescriptorResolver {
|
||||
continue;
|
||||
}
|
||||
Name referencedName = subjectTypeParameterName.getReferencedNameAsName();
|
||||
if (referencedName == null) {
|
||||
continue;
|
||||
}
|
||||
TypeParameterDescriptorImpl typeParameterDescriptor = parameterByName.get(referencedName);
|
||||
JetTypeReference boundTypeReference = constraint.getBoundTypeReference();
|
||||
JetType bound = null;
|
||||
|
||||
@@ -78,7 +78,7 @@ public class NamespaceFactoryImpl implements NamespaceFactory {
|
||||
}
|
||||
|
||||
for (JetSimpleNameExpression nameExpression : namespaceHeader.getParentNamespaceNames()) {
|
||||
Name namespaceName = JetPsiUtil.safeName(nameExpression.getReferencedName());
|
||||
Name namespaceName = Name.identifier(nameExpression.getReferencedName());
|
||||
|
||||
NamespaceDescriptorImpl namespaceDescriptor = createNamespaceDescriptorIfNeeded(
|
||||
null, currentOwner, namespaceName, nameExpression, handler);
|
||||
|
||||
@@ -227,12 +227,7 @@ public class QualifiedExpressionResolver {
|
||||
@NotNull
|
||||
private LookupResult lookupSimpleNameReference(@NotNull JetSimpleNameExpression referenceExpression,
|
||||
@NotNull JetScope outerScope, boolean onlyClasses, boolean namespaceLevel) {
|
||||
|
||||
Name referencedName = referenceExpression.getReferencedNameAsName();
|
||||
if (referencedName == null) {
|
||||
//to store a scope where we tried to resolve this reference
|
||||
return new SuccessfulLookupResult(Collections.<DeclarationDescriptor>emptyList(), outerScope, namespaceLevel);
|
||||
}
|
||||
|
||||
Set<DeclarationDescriptor> descriptors = Sets.newHashSet();
|
||||
NamespaceDescriptor namespaceDescriptor = outerScope.getNamespace(referencedName);
|
||||
|
||||
@@ -90,9 +90,6 @@ public class CallResolver {
|
||||
assert calleeExpression instanceof JetSimpleNameExpression;
|
||||
JetSimpleNameExpression nameExpression = (JetSimpleNameExpression) calleeExpression;
|
||||
Name referencedName = nameExpression.getReferencedNameAsName();
|
||||
if (referencedName == null) {
|
||||
return OverloadResolutionResultsImpl.nameNotFound();
|
||||
}
|
||||
List<CallableDescriptorCollector<? extends VariableDescriptor>> callableDescriptorCollectors = Lists.newArrayList();
|
||||
if (nameExpression.getReferencedNameElementType() == JetTokens.FIELD_IDENTIFIER) {
|
||||
referencedName = Name.identifier(referencedName.getName().substring(1));
|
||||
@@ -146,7 +143,6 @@ public class CallResolver {
|
||||
ExpressionTypingUtils.checkWrappingInRef(expression, context.trace, context.scope);
|
||||
|
||||
Name name = expression.getReferencedNameAsName();
|
||||
if (name == null) return checkArgumentTypesAndFail(context);
|
||||
|
||||
prioritizedTasks = TaskPrioritizer.<CallableDescriptor, FunctionDescriptor>computePrioritizedTasks(context, name, functionReference, CallableDescriptorCollectors.FUNCTIONS_AND_VARIABLES);
|
||||
ResolutionTask.DescriptorCheckStrategy abstractConstructorCheck = new ResolutionTask.DescriptorCheckStrategy() {
|
||||
|
||||
+3
-6
@@ -1017,7 +1017,6 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
assert JetTokens.LABELS.contains(operationSign.getReferencedNameElementType());
|
||||
|
||||
String referencedName = operationSign.getReferencedName();
|
||||
referencedName = referencedName == null ? " <?>" : referencedName;
|
||||
context.labelResolver.enterLabeledElement(new LabelName(referencedName.substring(1)), baseExpression);
|
||||
// TODO : Some processing for the label?
|
||||
JetTypeInfo typeInfo = facade.getTypeInfo(baseExpression, context, isStatement);
|
||||
@@ -1062,11 +1061,9 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
DataFlowInfo dataFlowInfo = context.dataFlowInfo;
|
||||
if (operationType == JetTokens.IDENTIFIER) {
|
||||
Name referencedName = operationSign.getReferencedNameAsName();
|
||||
if (referencedName != null) {
|
||||
JetTypeInfo typeInfo = getTypeInfoForBinaryCall(context.scope, referencedName, context, expression);
|
||||
result = typeInfo.getType();
|
||||
dataFlowInfo = typeInfo.getDataFlowInfo();
|
||||
}
|
||||
JetTypeInfo typeInfo = getTypeInfoForBinaryCall(context.scope, referencedName, context, expression);
|
||||
result = typeInfo.getType();
|
||||
dataFlowInfo = typeInfo.getDataFlowInfo();
|
||||
}
|
||||
else if (OperatorConventions.BINARY_OPERATION_NAMES.containsKey(operationType)) {
|
||||
JetTypeInfo typeInfo = getTypeInfoForBinaryCall(context.scope, OperatorConventions.BINARY_OPERATION_NAMES.get(operationType),
|
||||
|
||||
@@ -198,7 +198,6 @@ public class JetImportOptimizer implements ImportOptimizer {
|
||||
FqName fqName = null;
|
||||
for (JetSimpleNameExpression nameExpression : simpleNameExpressions) {
|
||||
Name referencedName = nameExpression.getReferencedNameAsName();
|
||||
assert referencedName != null;
|
||||
if (fqName == null) {
|
||||
fqName = new FqName(referencedName.getName());
|
||||
} else {
|
||||
|
||||
@@ -86,8 +86,6 @@ public class ImportClassAndFunFix extends JetHintAction<JetSimpleNameExpression>
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
assert referenceName != null;
|
||||
|
||||
ResolveSession resolveSession = WholeProjectAnalyzerFacade.getLazyResolveSessionForFile((JetFile) element.getContainingFile());
|
||||
|
||||
List<FqName> result = Lists.newArrayList();
|
||||
|
||||
@@ -200,7 +200,6 @@ public class JetNameSuggester {
|
||||
@Override
|
||||
public void visitSimpleNameExpression(JetSimpleNameExpression expression) {
|
||||
String referenceName = expression.getReferencedName();
|
||||
if (referenceName == null) return;
|
||||
if (referenceName.equals(referenceName.toUpperCase())) {
|
||||
addName(result, referenceName, validator);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user