Navigation: Implement proper getOriginalElement() for Kotlin declarations.

Run find usages tests with library for both original and navigation elements. Drop duplicating tests. Simplify test class.
TODO: Some usages are not found yet since light methods built from library files do not retain original declarations
This commit is contained in:
Alexey Sedunov
2015-06-05 16:28:18 +03:00
parent ba0000dde1
commit ca8e2d4956
69 changed files with 730 additions and 293 deletions
@@ -127,11 +127,8 @@ public object OptionalParametersHelper {
//TODO: parameter in overriding method!
//TODO: it's a temporary code while we don't have default values accessible from descriptors
var declaration = DescriptorToSourceUtilsIde.getAnyDeclaration(project, parameter) as? JetParameter ?: return null
if (declaration.getContainingJetFile().isCompiled()) {
declaration = JetSourceNavigationHelper.replaceBySourceDeclarationIfPresent(declaration) as? JetParameter ?: return null
}
val expression = declaration.getDefaultValue() ?: return null
val declaration = DescriptorToSourceUtilsIde.getAnyDeclaration(project, parameter)?.getNavigationElement() as? JetParameter
val expression = declaration?.getDefaultValue() ?: return null
val allParameters = (parameter.getContainingDeclaration() as CallableDescriptor).getValueParameters().toSet()