Fixed completion for method calls.

Initial support of Parameter Info (Ctrl+P) feature (including named parameters reordering).
Todo list:
1. Constructors are not working now (even primary constructor).
2. Tests.
This commit is contained in:
unknown
2012-01-18 21:05:30 +04:00
parent 01b405c86a
commit 16ceb446a3
7 changed files with 369 additions and 16 deletions
@@ -23,6 +23,35 @@ public class JetSimpleNameExpression extends JetReferenceExpression {
super(node);
}
/**
* null if it's not a code expression
* @return receiver expression
*/
@Nullable
public JetExpression getReceiverExpression() {
PsiElement parent = getParent();
if (parent instanceof JetQualifiedExpression && !isImportDirectiveExpression()) {
JetQualifiedExpression qualifiedExpression = (JetQualifiedExpression) parent;
return qualifiedExpression.getReceiverExpression();
} else if (parent instanceof JetCallExpression) {
//This is in case `a().b()`
JetCallExpression callExpression = (JetCallExpression) parent;
parent = callExpression.getParent();
if (parent instanceof JetQualifiedExpression) {
JetQualifiedExpression qualifiedExpression = (JetQualifiedExpression) parent;
return qualifiedExpression.getReceiverExpression();
}
}
return null;
}
public boolean isImportDirectiveExpression() {
PsiElement parent = getParent();
if (parent == null) return false;
else return parent instanceof JetImportDirective ||
parent.getParent() instanceof JetImportDirective;
}
@Nullable @IfNotParsed
public String getReferencedName() {
PsiElement referencedNameElement = getReferencedNameElement();
@@ -12,7 +12,7 @@ public class JetVisibilityChecker {
* @param subject the descriptor whose visibility is being checked
* @return <code>true</code> iff subject is visible locationOwner
*/
public boolean isVisible(@NotNull DeclarationDescriptor locationOwner, @NotNull DeclarationDescriptor subject) {
public static boolean isVisible(@NotNull DeclarationDescriptor locationOwner, @NotNull DeclarationDescriptor subject) {
// TODO : stub implementation
return true;
}
@@ -241,6 +241,7 @@ public class CallResolver {
ResolutionDebugInfo.Data debugInfo = ResolutionDebugInfo.create();
trace.record(ResolutionDebugInfo.RESOLUTION_DEBUG_INFO, call.getCallElement(), debugInfo);
trace.record(RESOLUTION_SCOPE, call.getCalleeExpression(), scope);
debugInfo.set(ResolutionDebugInfo.TASKS, prioritizedTasks);
@@ -3,11 +3,13 @@ package org.jetbrains.jet.lang.types;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.descriptors.annotations.Annotated;
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.lang.types.checker.JetTypeChecker;
import java.util.List;
/**
* @author abreslav
* @see JetTypeChecker#isSubtypeOf(JetType, JetType)
*/
public interface JetType extends Annotated {
@NotNull TypeConstructor getConstructor();