Big refactoring continued. Migrating to package views and fragments.

This commit is contained in:
Evgeny Gerashchenko
2013-10-30 11:20:09 +04:00
parent 577fb25777
commit 19d8f1394b
24 changed files with 59 additions and 130 deletions
@@ -101,14 +101,6 @@ public class BindingContextUtils {
return (JetFile) containingFile;
}
// TODO these helper methods are added as a workaround to some compiler bugs in Kotlin...
// NOTE this is used by KDoc
@Nullable
public static NamespaceDescriptor namespaceDescriptor(@NotNull BindingContext context, @NotNull JetFile source) {
return context.get(BindingContext.FILE_TO_NAMESPACE, source);
}
@Nullable
private static PsiElement doGetDescriptorToDeclaration(@NotNull BindingContext context, @NotNull DeclarationDescriptor descriptor) {
return context.get(DESCRIPTOR_TO_DECLARATION, descriptor);
@@ -22,7 +22,7 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
import org.jetbrains.jet.lang.descriptors.CallableMemberDescriptor;
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
import org.jetbrains.jet.lang.descriptors.PackageFragmentDescriptor;
import java.util.Collection;
import java.util.List;
@@ -51,7 +51,7 @@ public class LibrarySourceHacks {
if (!(original instanceof CallableMemberDescriptor)) {
return false;
}
if (!(original.getContainingDeclaration() instanceof NamespaceDescriptor)) {
if (!(original.getContainingDeclaration() instanceof PackageFragmentDescriptor)) {
return false;
}
@@ -111,7 +111,7 @@ public class DataFlowValueFactory {
}
@NotNull
private static IdentifierInfo createNamespaceInfo(Object id) {
private static IdentifierInfo createPackageInfo(Object id) {
return new IdentifierInfo(id, true, true);
}
@@ -156,7 +156,7 @@ public class DataFlowValueFactory {
return getIdForThisReceiver(declarationDescriptor);
}
else if (expression instanceof JetRootNamespaceExpression) {
return createNamespaceInfo(JetModuleUtil.getRootNamespaceType(expression));
return createPackageInfo(JetModuleUtil.getRootNamespaceType(expression));
}
return NO_IDENTIFIER_INFO;
}
@@ -179,8 +179,8 @@ public class DataFlowValueFactory {
VariableDescriptor variableDescriptor = (VariableDescriptor) declarationDescriptor;
return combineInfo(receiverInfo, createInfo(variableDescriptor, isStableVariable(variableDescriptor)));
}
if (declarationDescriptor instanceof NamespaceDescriptor) {
return createNamespaceInfo(declarationDescriptor);
if (declarationDescriptor instanceof PackageViewDescriptor) {
return createPackageInfo(declarationDescriptor);
}
return NO_IDENTIFIER_INFO;
}
@@ -186,21 +186,6 @@ public class WriteThroughScope extends WritableScopeWithImports {
writableWorker.addFunctionAlias(name, functionDescriptor);
}
@Override
public void addNamespace(@NotNull NamespaceDescriptor namespaceDescriptor) {
checkMayWrite();
writableWorker.addNamespace(namespaceDescriptor);
}
@Override
@Nullable
public NamespaceDescriptor getDeclaredNamespace(@NotNull Name name) {
checkMayRead();
return writableWorker.getDeclaredNamespace(name);
}
@NotNull
@Override
public Multimap<Name, DeclarationDescriptor> getDeclaredDescriptorsAccessibleBySimpleName() {