use of org.jetbrains.kotlin.psi.KtQualifiedExpression in project kotlin by JetBrains.
the class KotlinExpressionSurrounder method isApplicable.
@Override
public boolean isApplicable(@NotNull PsiElement[] elements) {
if (elements.length != 1 || !(elements[0] instanceof KtExpression)) {
return false;
}
KtExpression expression = (KtExpression) elements[0];
if (expression instanceof KtCallExpression && expression.getParent() instanceof KtQualifiedExpression) {
return false;
}
KotlinType type = ResolutionUtils.analyze(expression, BodyResolveMode.PARTIAL).getType(expression);
if (type == null || isUnit(type)) {
return false;
}
return isApplicable(expression);
}
use of org.jetbrains.kotlin.psi.KtQualifiedExpression in project kotlin by JetBrains.
the class ReferenceTranslator method canBePropertyAccess.
public static boolean canBePropertyAccess(@NotNull KtExpression expression, @NotNull TranslationContext context) {
KtSimpleNameExpression simpleNameExpression = null;
if (expression instanceof KtQualifiedExpression) {
simpleNameExpression = getSelectorAsSimpleName((KtQualifiedExpression) expression);
} else if (expression instanceof KtSimpleNameExpression) {
simpleNameExpression = (KtSimpleNameExpression) expression;
}
if (simpleNameExpression == null)
return false;
DeclarationDescriptor descriptor = getDescriptorForReferenceExpression(context.bindingContext(), simpleNameExpression);
// Skip ValueParameterDescriptor because sometime we can miss resolved call for it, e.g. when set something to delegated property.
return descriptor instanceof VariableDescriptor && !(descriptor instanceof ValueParameterDescriptor);
}
Aggregations