Sort out root namespace names
This commit is contained in:
@@ -79,10 +79,10 @@ public class JetNamespaceHeader extends JetReferenceExpression {
|
||||
return nameIdentifier == null ? "" : nameIdentifier.getText();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
public Name getNameAsName() {
|
||||
PsiElement nameIdentifier = getNameIdentifier();
|
||||
return nameIdentifier == null ? null : Name.identifier(nameIdentifier.getText());
|
||||
return nameIdentifier == null ? JetPsiUtil.ROOT_NAMESPACE_NAME : Name.identifier(nameIdentifier.getText());
|
||||
}
|
||||
|
||||
public boolean isRoot() {
|
||||
|
||||
@@ -40,6 +40,7 @@ import java.util.Set;
|
||||
public class JetPsiUtil {
|
||||
|
||||
public static final Name NO_NAME_PROVIDED = Name.special("<no name provided>");
|
||||
public static final Name ROOT_NAMESPACE_NAME = Name.special("<root namespace>");
|
||||
|
||||
private JetPsiUtil() {
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import org.jetbrains.jet.lang.psi.JetElement;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.lang.types.NamespaceType;
|
||||
|
||||
@@ -27,6 +27,6 @@ import org.jetbrains.jet.lang.types.NamespaceType;
|
||||
public class JetModuleUtil {
|
||||
public static NamespaceType getRootNamespaceType(JetElement expression) {
|
||||
// TODO: this is a stub: at least the modules' root namespaces must be indexed here
|
||||
return new NamespaceType(Name.special("<namespace_root>"), JetScope.EMPTY);
|
||||
return new NamespaceType(JetPsiUtil.ROOT_NAMESPACE_NAME, JetScope.EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user