Take imported from object descriptor into account in pseudocode

So #KT-15566 Fixed
This commit is contained in:
Mikhail Glukhikh
2017-04-21 16:57:39 +03:00
committed by Mikhail Glukhikh
parent 056eebf69c
commit 14e798a1fc
4 changed files with 104 additions and 1 deletions
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.psi.KtElement;
import org.jetbrains.kotlin.psi.KtExpression;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.BindingTrace;
import org.jetbrains.kotlin.resolve.PropertyImportedFromObject;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.calls.resolvedCallUtil.ResolvedCallUtilKt;
import org.jetbrains.kotlin.types.KotlinType;
@@ -98,7 +99,12 @@ public class PseudocodeUtil {
) {
if (instruction instanceof AccessValueInstruction) {
KtElement element = ((AccessValueInstruction) instruction).getElement();
return element instanceof KtDeclaration ? null : extractVariableDescriptorIfAny(instruction, bindingContext);
if (element instanceof KtDeclaration) return null;
VariableDescriptor descriptor = extractVariableDescriptorIfAny(instruction, bindingContext);
if (descriptor instanceof PropertyImportedFromObject) {
return ((PropertyImportedFromObject) descriptor).getCallableFromObject();
}
return descriptor;
}
return null;
}