Got rid of "namespace" term in descriptors module.
This commit is contained in:
@@ -59,7 +59,7 @@ public class JetNamespaceHeader extends JetReferenceExpression {
|
|||||||
@NotNull
|
@NotNull
|
||||||
public Name getNameAsName() {
|
public Name getNameAsName() {
|
||||||
PsiElement nameIdentifier = getNameIdentifier();
|
PsiElement nameIdentifier = getNameIdentifier();
|
||||||
return nameIdentifier == null ? SpecialNames.ROOT_NAMESPACE : Name.identifier(nameIdentifier.getText());
|
return nameIdentifier == null ? SpecialNames.ROOT_PACKAGE : Name.identifier(nameIdentifier.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRoot() {
|
public boolean isRoot() {
|
||||||
|
|||||||
@@ -25,6 +25,6 @@ import org.jetbrains.jet.lang.types.PackageType;
|
|||||||
public class JetModuleUtil {
|
public class JetModuleUtil {
|
||||||
public static PackageType getRootPackageType(JetElement expression) {
|
public static PackageType getRootPackageType(JetElement expression) {
|
||||||
// TODO: this is a stub: at least the modules' root namespaces must be indexed here
|
// TODO: this is a stub: at least the modules' root namespaces must be indexed here
|
||||||
return new PackageType(SpecialNames.ROOT_NAMESPACE, JetScope.EMPTY, ReceiverValue.NO_RECEIVER);
|
return new PackageType(SpecialNames.ROOT_PACKAGE, JetScope.EMPTY, ReceiverValue.NO_RECEIVER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public class LazyResolveTestUtil {
|
|||||||
JetNamespaceHeader header = file.getNamespaceHeader();
|
JetNamespaceHeader header = file.getNamespaceHeader();
|
||||||
if (header != null) {
|
if (header != null) {
|
||||||
List<JetSimpleNameExpression> names = header.getNamespaceNames();
|
List<JetSimpleNameExpression> names = header.getNamespaceNames();
|
||||||
Name name = names.isEmpty() ? SpecialNames.ROOT_NAMESPACE : names.get(0).getReferencedNameAsName();
|
Name name = names.isEmpty() ? SpecialNames.ROOT_PACKAGE : names.get(0).getReferencedNameAsName();
|
||||||
shortNames.add(name);
|
shortNames.add(name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -463,7 +463,7 @@ public class DescriptorUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true iff {@code descriptor}'s first non-class container is a namespace
|
* @return true iff {@code descriptor}'s first non-class container is a package
|
||||||
*/
|
*/
|
||||||
public static boolean isTopLevelOrInnerClass(@NotNull ClassDescriptor descriptor) {
|
public static boolean isTopLevelOrInnerClass(@NotNull ClassDescriptor descriptor) {
|
||||||
DeclarationDescriptor containing = descriptor.getContainingDeclaration();
|
DeclarationDescriptor containing = descriptor.getContainingDeclaration();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
public class SpecialNames {
|
public class SpecialNames {
|
||||||
public static final Name NO_NAME_PROVIDED = Name.special("<no name provided>");
|
public static final Name NO_NAME_PROVIDED = Name.special("<no name provided>");
|
||||||
public static final Name ROOT_NAMESPACE = Name.special("<root namespace>");
|
public static final Name ROOT_PACKAGE = Name.special("<root package>");
|
||||||
|
|
||||||
private static final String CLASS_OBJECT_FOR = "<class-object-for-";
|
private static final String CLASS_OBJECT_FOR = "<class-object-for-";
|
||||||
|
|
||||||
|
|||||||
@@ -240,8 +240,8 @@ public class WritableScopeImpl extends WritableScopeWithImports {
|
|||||||
public VariableDescriptor getLocalVariable(@NotNull Name name) {
|
public VariableDescriptor getLocalVariable(@NotNull Name name) {
|
||||||
checkMayRead();
|
checkMayRead();
|
||||||
|
|
||||||
Map<Name, DeclarationDescriptor> variableClassOrNamespaceDescriptors = getVariableOrClassDescriptors();
|
Map<Name, DeclarationDescriptor> variableOrClassDescriptors = getVariableOrClassDescriptors();
|
||||||
DeclarationDescriptor descriptor = variableClassOrNamespaceDescriptors.get(name);
|
DeclarationDescriptor descriptor = variableOrClassDescriptors.get(name);
|
||||||
if (descriptor instanceof VariableDescriptor && !getPropertyGroups().get(name).contains(descriptor)) {
|
if (descriptor instanceof VariableDescriptor && !getPropertyGroups().get(name).contains(descriptor)) {
|
||||||
return (VariableDescriptor) descriptor;
|
return (VariableDescriptor) descriptor;
|
||||||
}
|
}
|
||||||
@@ -368,8 +368,8 @@ public class WritableScopeImpl extends WritableScopeWithImports {
|
|||||||
public ClassifierDescriptor getClassifier(@NotNull Name name) {
|
public ClassifierDescriptor getClassifier(@NotNull Name name) {
|
||||||
checkMayRead();
|
checkMayRead();
|
||||||
|
|
||||||
Map<Name, DeclarationDescriptor> variableClassOrNamespaceDescriptors = getVariableOrClassDescriptors();
|
Map<Name, DeclarationDescriptor> variableOrClassDescriptors = getVariableOrClassDescriptors();
|
||||||
DeclarationDescriptor descriptor = variableClassOrNamespaceDescriptors.get(name);
|
DeclarationDescriptor descriptor = variableOrClassDescriptors.get(name);
|
||||||
if (descriptor instanceof ClassifierDescriptor) return (ClassifierDescriptor) descriptor;
|
if (descriptor instanceof ClassifierDescriptor) return (ClassifierDescriptor) descriptor;
|
||||||
|
|
||||||
ClassifierDescriptor classifierDescriptor = getWorkerScope().getClassifier(name);
|
ClassifierDescriptor classifierDescriptor = getWorkerScope().getClassifier(name);
|
||||||
|
|||||||
Reference in New Issue
Block a user