KT-1666 Invoking "Go to Declaration" for String type offers two variants - Temp boring fix

#KT-1666 fixed
This commit is contained in:
Nikolay Krasko
2012-04-08 20:38:11 +04:00
parent 89b08d6296
commit 4ec080f71f
4 changed files with 26 additions and 14 deletions
@@ -156,11 +156,18 @@ public abstract class ExpectedResolveData {
Position position = entry.getValue();
PsiElement element = position.getElement();
PsiElement ancestorOfType = getAncestorOfType(JetDeclaration.class, element);
if (ancestorOfType == null) {
JetNamespaceHeader header = getAncestorOfType(JetNamespaceHeader.class, element);
assert header != null : "Not a declaration: " + name;
ancestorOfType = element;
PsiElement ancestorOfType;
if (name.equals("file")) {
ancestorOfType = element.getContainingFile();
}
else {
ancestorOfType = getAncestorOfType(JetDeclaration.class, element);
if (ancestorOfType == null) {
JetNamespaceHeader header = getAncestorOfType(JetNamespaceHeader.class, element);
assert header != null : "Not a declaration: " + name;
ancestorOfType = element;
}
}
nameToDeclaration.put(name, ancestorOfType);
declarationToName.put(ancestorOfType, name);