Stub for object

This commit is contained in:
Nikolay Krasko
2012-06-29 14:27:46 +04:00
parent fed9df9858
commit ede771935f
14 changed files with 267 additions and 8 deletions
@@ -30,6 +30,7 @@ import java.util.Collection;
*/
public class JetAllShortFunctionNameIndex extends StringStubIndexExtension<JetNamedFunction> {
private static final JetShortClassNameIndex ourInstance = new JetShortClassNameIndex();
public static JetShortClassNameIndex getInstance() {
return ourInstance;
}
@@ -34,6 +34,6 @@ public class JetExtensionFunctionNameIndex extends StringStubIndexExtension<JetN
@NotNull
@Override
public StubIndexKey<String, JetNamedFunction> getKey() {
return JetIndexKeys.EXTENSION_FUNCTION_SHORT_NAME_KEY;
return JetIndexKeys.TOP_LEVEL_EXTENSION_FUNCTION_SHORT_NAME_KEY;
}
}
@@ -29,8 +29,8 @@ import java.util.Collection;
* @author Nikolay Krasko
*/
public class JetFullClassNameIndex extends StringStubIndexExtension<JetClassOrObject> {
private static final JetFullClassNameIndex ourInstance = new JetFullClassNameIndex();
public static JetFullClassNameIndex getInstance() {
return ourInstance;
}
@@ -29,10 +29,9 @@ public interface JetIndexKeys {
StubIndexKey<String, JetClassOrObject> FQN_KEY = StubIndexKey.createIndexKey("jet.fqn");
StubIndexKey<String, JetNamedFunction> TOP_LEVEL_FUNCTION_SHORT_NAME_KEY = StubIndexKey.createIndexKey("jet.top.level.function.short.name");
StubIndexKey<String, JetNamedFunction> TOP_LEVEL_FUNCTION_FQNAME_KEY = StubIndexKey.createIndexKey("jet.top.level.function.fqname");
StubIndexKey<String, JetNamedFunction> TOP_LEVEL_EXTENSION_FUNCTION_SHORT_NAME_KEY = StubIndexKey.createIndexKey("jet.top.level.extension.function.short.name");
StubIndexKey<String, JetNamedFunction> EXTENSION_FUNCTION_SHORT_NAME_KEY = StubIndexKey.createIndexKey("jet.top.level.extension.function.short.name");
StubIndexKey<String, JetNamedFunction> EXTENSION_FUNCTION_FQNAME_KEY = StubIndexKey.createIndexKey("jet.top.level.extension.function.fqname");
StubIndexKey<String, JetNamedFunction> TOP_LEVEL_FUNCTIONS_FQN_NAME_KEY = StubIndexKey.createIndexKey("jet.top.level.functions.fqn.name");
StubIndexKey<String, JetNamedFunction> FUNCTIONS_SHORT_NAME_KEY = StubIndexKey.createIndexKey("jet.functions.short.name");
}
@@ -30,6 +30,7 @@ import java.util.Collection;
*/
public class JetShortClassNameIndex extends StringStubIndexExtension<JetClassOrObject> {
private static final JetShortClassNameIndex ourInstance = new JetShortClassNameIndex();
public static JetShortClassNameIndex getInstance() {
return ourInstance;
}
@@ -19,6 +19,7 @@ package org.jetbrains.jet.plugin.stubindex;
import com.intellij.psi.stubs.IndexSink;
import org.jetbrains.jet.lang.psi.stubs.PsiJetClassStub;
import org.jetbrains.jet.lang.psi.stubs.PsiJetFunctionStub;
import org.jetbrains.jet.lang.psi.stubs.PsiJetObjectStub;
import org.jetbrains.jet.lang.psi.stubs.elements.StubIndexService;
/**
@@ -43,6 +44,15 @@ public class StubIndexServiceImpl implements StubIndexService {
}
}
@Override
public void indexObject(PsiJetObjectStub stub, IndexSink sink) {
String name = stub.getName();
assert name != null;
sink.occurrence(JetIndexKeys.SHORT_NAME_KEY, name);
sink.occurrence(JetIndexKeys.FQN_KEY, stub.getFQName().toString());
}
@Override
public void indexFunction(PsiJetFunctionStub stub, IndexSink sink) {
String name = stub.getName();
@@ -54,12 +64,13 @@ public class StubIndexServiceImpl implements StubIndexService {
// sink.occurrence(JetIndexKeys.TOP_LEVEL_FUNCTION_FQNAME_KEY, name);
}
else {
sink.occurrence(JetIndexKeys.EXTENSION_FUNCTION_SHORT_NAME_KEY, name);
sink.occurrence(JetIndexKeys.TOP_LEVEL_EXTENSION_FUNCTION_SHORT_NAME_KEY, name);
// sink.occurrence(JetIndexKeys.EXTENSION_FUNCTION_FQNAME_KEY, name);
}
}
sink.occurrence(JetIndexKeys.FUNCTIONS_SHORT_NAME_KEY, name);
// sink.occurrence(JetIndexKeys.FUNCTIONS_FQN_NAME_KEY);
}
}
}