Added dummy navigation to functions (without distinguishing parameter types yet).
This commit is contained in:
@@ -23,6 +23,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.lang.psi.JetClass;
|
import org.jetbrains.jet.lang.psi.JetClass;
|
||||||
import org.jetbrains.jet.lang.psi.JetDeclaration;
|
import org.jetbrains.jet.lang.psi.JetDeclaration;
|
||||||
|
import org.jetbrains.jet.lang.psi.JetFunction;
|
||||||
import org.jetbrains.jet.lang.psi.JetProperty;
|
import org.jetbrains.jet.lang.psi.JetProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,6 +54,12 @@ public class JetClsNavigationPolicy implements ClsCustomNavigationPolicy {
|
|||||||
return sourceProperty;
|
return sourceProperty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (jetDeclaration instanceof JetFunction) {
|
||||||
|
JetDeclaration sourceFunction = JetSourceNavigationHelper.getSourceFunction((JetFunction) jetDeclaration);
|
||||||
|
if (sourceFunction != null) {
|
||||||
|
return sourceFunction;
|
||||||
|
}
|
||||||
|
}
|
||||||
return jetDeclaration;
|
return jetDeclaration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -200,6 +200,22 @@ public class JetSourceNavigationHelper {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static JetDeclaration getSourceFunction(final @NotNull JetFunction decompiledFunction) {
|
||||||
|
return getSourcePropertyOrFunction(decompiledFunction, decompiledFunction.getReceiverTypeRef(), new Matcher<JetFunction, FunctionDescriptor>() {
|
||||||
|
@Override
|
||||||
|
public boolean areSame(JetFunction declaration, FunctionDescriptor descriptor) {
|
||||||
|
// TODO check parameters
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<FunctionDescriptor> getCandidatesFromScope(JetScope scope, String name) {
|
||||||
|
return scope.getFunctions(name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private interface Matcher<Decl extends JetDeclaration, Descr extends CallableDescriptor> {
|
private interface Matcher<Decl extends JetDeclaration, Descr extends CallableDescriptor> {
|
||||||
boolean areSame(Decl declaration, Descr descriptor);
|
boolean areSame(Decl declaration, Descr descriptor);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user