... and rename
This commit is contained in:
+1
-1
@@ -36,7 +36,7 @@ import java.util.*;
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
public class MutableClassDescriptorLite extends MutableDeclarationDescriptor implements ClassDescriptor, NamespaceLike {
|
||||
public class MutableClassDescriptorLite extends MutableDeclarationDescriptor implements ClassDescriptor, NamespaceLikeBuilder {
|
||||
private ConstructorDescriptor primaryConstructor;
|
||||
private final Set<ConstructorDescriptor> constructors = Sets.newLinkedHashSet();
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class NamespaceDescriptorImpl extends AbstractNamespaceDescriptorImpl implements NamespaceLike {
|
||||
public class NamespaceDescriptorImpl extends AbstractNamespaceDescriptorImpl implements NamespaceLikeBuilder {
|
||||
|
||||
private WritableScope memberScope;
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public interface NamespaceLike {
|
||||
public interface NamespaceLikeBuilder {
|
||||
|
||||
@NotNull
|
||||
DeclarationDescriptor getOwnerForChildren();
|
||||
@@ -136,7 +136,7 @@ public class AnalyzingUtils {
|
||||
});
|
||||
|
||||
TopDownAnalyzer.process(project, bindingTraceContext, scope,
|
||||
new NamespaceLike() {
|
||||
new NamespaceLikeBuilder() {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
|
||||
@@ -107,7 +107,7 @@ public class DeclarationResolver {
|
||||
for (Map.Entry<JetFile, WritableScope> entry : context.getNamespaceScopes().entrySet()) {
|
||||
JetFile namespace = entry.getKey();
|
||||
WritableScope namespaceScope = entry.getValue();
|
||||
NamespaceLike namespaceDescriptor = context.getNamespaceDescriptors().get(namespace);
|
||||
NamespaceLikeBuilder namespaceDescriptor = context.getNamespaceDescriptors().get(namespace);
|
||||
|
||||
resolveFunctionAndPropertyHeaders(namespace.getDeclarations(), namespaceScope, namespaceScope, namespaceScope, namespaceDescriptor);
|
||||
}
|
||||
@@ -138,7 +138,7 @@ public class DeclarationResolver {
|
||||
private void resolveFunctionAndPropertyHeaders(@NotNull List<JetDeclaration> declarations,
|
||||
final @NotNull JetScope scopeForFunctions,
|
||||
final @NotNull JetScope scopeForPropertyInitializers, final @NotNull JetScope scopeForPropertyAccessors,
|
||||
final @NotNull NamespaceLike namespaceLike)
|
||||
final @NotNull NamespaceLikeBuilder namespaceLike)
|
||||
{
|
||||
for (JetDeclaration declaration : declarations) {
|
||||
declaration.accept(new JetVisitorVoid() {
|
||||
|
||||
@@ -84,7 +84,7 @@ public class TopDownAnalyzer {
|
||||
public static void process(
|
||||
Project project, @NotNull BindingTrace trace,
|
||||
@NotNull JetScope outerScope,
|
||||
@NotNull NamespaceLike owner,
|
||||
@NotNull NamespaceLikeBuilder owner,
|
||||
@NotNull Collection<JetFile> files,
|
||||
@NotNull Predicate<PsiFile> analyzeCompletely,
|
||||
@NotNull JetControlFlowDataTraceFactory flowDataTraceFactory,
|
||||
@@ -97,7 +97,7 @@ public class TopDownAnalyzer {
|
||||
@NotNull Project project,
|
||||
@NotNull BindingTrace trace,
|
||||
@NotNull JetScope outerScope,
|
||||
@NotNull NamespaceLike owner,
|
||||
@NotNull NamespaceLikeBuilder owner,
|
||||
@NotNull Collection<? extends PsiElement> declarations,
|
||||
@NotNull Predicate<PsiFile> analyzeCompletely,
|
||||
@NotNull JetControlFlowDataTraceFactory flowDataTraceFactory,
|
||||
@@ -110,7 +110,7 @@ public class TopDownAnalyzer {
|
||||
|
||||
private void doProcess(
|
||||
TopDownAnalysisContext context, JetScope outerScope,
|
||||
NamespaceLike owner,
|
||||
NamespaceLikeBuilder owner,
|
||||
Collection<? extends PsiElement> declarations) {
|
||||
// context.enableDebugOutput();
|
||||
context.debug("Enter");
|
||||
@@ -171,7 +171,7 @@ public class TopDownAnalyzer {
|
||||
@NotNull JetScope outerScope,
|
||||
@NotNull final DeclarationDescriptor containingDeclaration,
|
||||
@NotNull JetObjectDeclaration object) {
|
||||
process(project, trace, outerScope, new NamespaceLike() {
|
||||
process(project, trace, outerScope, new NamespaceLikeBuilder() {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
|
||||
@@ -81,7 +81,7 @@ public class TypeHierarchyResolver {
|
||||
}
|
||||
|
||||
|
||||
public void process(@NotNull JetScope outerScope, @NotNull NamespaceLike owner, @NotNull Collection<? extends PsiElement> declarations) {
|
||||
public void process(@NotNull JetScope outerScope, @NotNull NamespaceLikeBuilder owner, @NotNull Collection<? extends PsiElement> declarations) {
|
||||
collectNamespacesAndClassifiers(outerScope, outerScope, owner, declarations); // namespaceScopes, classes
|
||||
|
||||
importsResolver.processTypeImports();
|
||||
@@ -105,7 +105,7 @@ public class TypeHierarchyResolver {
|
||||
private void collectNamespacesAndClassifiers(
|
||||
@NotNull final JetScope outerScope,
|
||||
@NotNull final JetScope outerScopeForStatic,
|
||||
@NotNull final NamespaceLike owner,
|
||||
@NotNull final NamespaceLikeBuilder owner,
|
||||
@NotNull Collection<? extends PsiElement> declarations) {
|
||||
for (PsiElement declaration : declarations) {
|
||||
declaration.accept(new JetVisitorVoid() {
|
||||
@@ -165,7 +165,7 @@ public class TypeHierarchyResolver {
|
||||
classObjectDescriptor.addObjectDescriptor(mutableClassDescriptor);
|
||||
}
|
||||
|
||||
private MutableClassDescriptor createClassDescriptorForObject(@NotNull JetClassOrObject declaration, @NotNull NamespaceLike owner, JetScope scope, ClassKind classKind) {
|
||||
private MutableClassDescriptor createClassDescriptorForObject(@NotNull JetClassOrObject declaration, @NotNull NamespaceLikeBuilder owner, JetScope scope, ClassKind classKind) {
|
||||
MutableClassDescriptor mutableClassDescriptor = new MutableClassDescriptor(context.getTrace(), owner.getOwnerForChildren(), scope, classKind) {
|
||||
@Override
|
||||
public ClassObjectStatus setClassObjectDescriptor(@NotNull MutableClassDescriptorLite classObjectDescriptor) {
|
||||
@@ -210,7 +210,7 @@ public class TypeHierarchyResolver {
|
||||
public void visitClassObject(JetClassObject classObject) {
|
||||
JetObjectDeclaration objectDeclaration = classObject.getObjectDeclaration();
|
||||
if (objectDeclaration != null) {
|
||||
NamespaceLike.ClassObjectStatus status = owner.setClassObjectDescriptor(createClassDescriptorForObject(objectDeclaration, owner, outerScopeForStatic, ClassKind.OBJECT));
|
||||
NamespaceLikeBuilder.ClassObjectStatus status = owner.setClassObjectDescriptor(createClassDescriptorForObject(objectDeclaration, owner, outerScopeForStatic, ClassKind.OBJECT));
|
||||
switch (status) {
|
||||
case DUPLICATE:
|
||||
context.getTrace().report(MANY_CLASS_OBJECTS.on(classObject));
|
||||
@@ -225,10 +225,10 @@ public class TypeHierarchyResolver {
|
||||
}
|
||||
}
|
||||
|
||||
private NamespaceDescriptorImpl createNamespaceDescriptorPathIfNeeded(JetFile file, NamespaceLike owner, JetScope outerScope) {
|
||||
private NamespaceDescriptorImpl createNamespaceDescriptorPathIfNeeded(JetFile file, NamespaceLikeBuilder owner, JetScope outerScope) {
|
||||
JetNamespaceHeader namespaceHeader = file.getNamespaceHeader();
|
||||
|
||||
NamespaceLike currentOwner = owner;
|
||||
NamespaceLikeBuilder currentOwner = owner;
|
||||
|
||||
for (JetSimpleNameExpression nameExpression : namespaceHeader.getParentNamespaceNames()) {
|
||||
String namespaceName = JetPsiUtil.safeName(nameExpression.getReferencedName());
|
||||
@@ -250,7 +250,7 @@ public class TypeHierarchyResolver {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private NamespaceDescriptorImpl createNamespaceDescriptorIfNeeded(@Nullable JetFile file, @NotNull NamespaceLike owner, String name) {
|
||||
private NamespaceDescriptorImpl createNamespaceDescriptorIfNeeded(@Nullable JetFile file, @NotNull NamespaceLikeBuilder owner, String name) {
|
||||
NamespaceDescriptorImpl namespaceDescriptor = owner.getNamespace(name);
|
||||
if (namespaceDescriptor == null) {
|
||||
namespaceDescriptor = new NamespaceDescriptorImpl(
|
||||
|
||||
Reference in New Issue
Block a user