Minor. Rename method BodiesResolveContext.getClasses()
This is done to avoid the clash of meanings with TopDownAnalysisContext.getAllClasses()
This commit is contained in:
@@ -47,14 +47,16 @@ public interface BodiesResolveContext extends GlobalContext {
|
||||
Collection<JetFile> getFiles();
|
||||
|
||||
@Mutable
|
||||
Map<JetClassOrObject, ClassDescriptorWithResolutionScopes> getClasses();
|
||||
Map<JetClassOrObject, ClassDescriptorWithResolutionScopes> getDeclaredClasses();
|
||||
@Mutable
|
||||
Map<JetScript, ScriptDescriptor> getScripts();
|
||||
|
||||
@Mutable
|
||||
Map<JetProperty, PropertyDescriptor> getProperties();
|
||||
@Mutable
|
||||
Map<JetNamedFunction, SimpleFunctionDescriptor> getFunctions();
|
||||
|
||||
Function<JetDeclaration, JetScope> getDeclaringScopes();
|
||||
@Mutable
|
||||
Map<JetScript, ScriptDescriptor> getScripts();
|
||||
DataFlowInfo getOuterDataFlowInfo();
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -146,7 +146,7 @@ public class BodyResolver {
|
||||
|
||||
private void resolveDelegationSpecifierLists(@NotNull BodiesResolveContext c) {
|
||||
// TODO : Make sure the same thing is not initialized twice
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getClasses().entrySet()) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getDeclaredClasses().entrySet()) {
|
||||
JetClassOrObject classOrObject = entry.getKey();
|
||||
ClassDescriptorWithResolutionScopes descriptor = entry.getValue();
|
||||
|
||||
@@ -329,13 +329,13 @@ public class BodyResolver {
|
||||
}
|
||||
|
||||
private void resolveClassAnnotations(@NotNull BodiesResolveContext c) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getClasses().entrySet()) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getDeclaredClasses().entrySet()) {
|
||||
resolveAnnotationArguments(entry.getValue().getScopeForClassHeaderResolution(), entry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
private void resolveAnonymousInitializers(@NotNull BodiesResolveContext c) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getClasses().entrySet()) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getDeclaredClasses().entrySet()) {
|
||||
JetClassOrObject classOrObject = entry.getKey();
|
||||
ClassDescriptorWithResolutionScopes descriptor = entry.getValue();
|
||||
resolveAnonymousInitializers(c, classOrObject, descriptor.getUnsubstitutedPrimaryConstructor(),
|
||||
@@ -378,7 +378,7 @@ public class BodyResolver {
|
||||
}
|
||||
|
||||
private void resolvePrimaryConstructorParameters(@NotNull BodiesResolveContext c) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getClasses().entrySet()) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getDeclaredClasses().entrySet()) {
|
||||
if (!(entry.getKey() instanceof JetClass)) continue;
|
||||
JetClass klass = (JetClass) entry.getKey();
|
||||
ClassDescriptorWithResolutionScopes classDescriptor = entry.getValue();
|
||||
@@ -414,7 +414,7 @@ public class BodyResolver {
|
||||
|
||||
// Member properties
|
||||
Set<JetProperty> processed = Sets.newHashSet();
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getClasses().entrySet()) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getDeclaredClasses().entrySet()) {
|
||||
if (!(entry.getKey() instanceof JetClass)) continue;
|
||||
JetClass jetClass = (JetClass) entry.getKey();
|
||||
ClassDescriptorWithResolutionScopes classDescriptor = entry.getValue();
|
||||
|
||||
+2
-3
@@ -27,7 +27,6 @@ import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.WritableScope;
|
||||
import org.jetbrains.jet.storage.ExceptionTracker;
|
||||
import org.jetbrains.jet.storage.StorageManager;
|
||||
|
||||
@@ -52,7 +51,7 @@ public class CachedBodiesResolveContext implements BodiesResolveContext {
|
||||
|
||||
public CachedBodiesResolveContext(TopDownAnalysisContext context) {
|
||||
files = Collections.unmodifiableCollection(context.getFiles());
|
||||
classes = Collections.unmodifiableMap(context.getClasses());
|
||||
classes = Collections.unmodifiableMap(context.getDeclaredClasses());
|
||||
properties = Collections.unmodifiableMap(context.getProperties());
|
||||
functions = Collections.unmodifiableMap(context.getFunctions());
|
||||
declaringScopes = context.getDeclaringScopes();
|
||||
@@ -80,7 +79,7 @@ public class CachedBodiesResolveContext implements BodiesResolveContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<JetClassOrObject, ClassDescriptorWithResolutionScopes> getClasses() {
|
||||
public Map<JetClassOrObject, ClassDescriptorWithResolutionScopes> getDeclaredClasses() {
|
||||
return classes;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ControlFlowAnalyzer {
|
||||
if (!c.completeAnalysisNeeded(file)) continue;
|
||||
checkDeclarationContainer(c, file);
|
||||
}
|
||||
for (JetClassOrObject aClass : c.getClasses().keySet()) {
|
||||
for (JetClassOrObject aClass : c.getDeclaredClasses().keySet()) {
|
||||
if (!c.completeAnalysisNeeded(aClass)) continue;
|
||||
checkDeclarationContainer(c, aClass);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class DeclarationResolver {
|
||||
}
|
||||
|
||||
private void resolveAnnotationConstructors(@NotNull TopDownAnalysisContext c) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getClasses().entrySet()) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getDeclaredClasses().entrySet()) {
|
||||
JetClassOrObject classOrObject = entry.getKey();
|
||||
MutableClassDescriptor classDescriptor = (MutableClassDescriptor) entry.getValue();
|
||||
|
||||
@@ -114,7 +114,7 @@ public class DeclarationResolver {
|
||||
}
|
||||
|
||||
private void resolveConstructorHeaders(@NotNull TopDownAnalysisContext c) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getClasses().entrySet()) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getDeclaredClasses().entrySet()) {
|
||||
JetClassOrObject classOrObject = entry.getKey();
|
||||
MutableClassDescriptor classDescriptor = (MutableClassDescriptor) entry.getValue();
|
||||
|
||||
@@ -125,7 +125,7 @@ public class DeclarationResolver {
|
||||
}
|
||||
|
||||
private void resolveAnnotationStubsOnClassesAndConstructors(@NotNull TopDownAnalysisContext c) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getClasses().entrySet()) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getDeclaredClasses().entrySet()) {
|
||||
JetModifierList modifierList = entry.getKey().getModifierList();
|
||||
if (modifierList != null) {
|
||||
MutableClassDescriptor descriptor = (MutableClassDescriptor) entry.getValue();
|
||||
@@ -143,7 +143,7 @@ public class DeclarationResolver {
|
||||
|
||||
resolveFunctionAndPropertyHeaders(c, file.getDeclarations(), fileScope, fileScope, fileScope, packageBuilder);
|
||||
}
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getClasses().entrySet()) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getDeclaredClasses().entrySet()) {
|
||||
JetClassOrObject classOrObject = entry.getKey();
|
||||
MutableClassDescriptor classDescriptor = (MutableClassDescriptor) entry.getValue();
|
||||
|
||||
@@ -206,7 +206,7 @@ public class DeclarationResolver {
|
||||
}
|
||||
|
||||
private void createFunctionsForDataClasses(@NotNull TopDownAnalysisContext c) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getClasses().entrySet()) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getDeclaredClasses().entrySet()) {
|
||||
JetClassOrObject klass = entry.getKey();
|
||||
MutableClassDescriptor classDescriptor = (MutableClassDescriptor) entry.getValue();
|
||||
|
||||
@@ -337,7 +337,7 @@ public class DeclarationResolver {
|
||||
}
|
||||
|
||||
public void checkRedeclarationsInInnerClassNames(@NotNull TopDownAnalysisContext c) {
|
||||
for (ClassDescriptorWithResolutionScopes classDescriptor : c.getClasses().values()) {
|
||||
for (ClassDescriptorWithResolutionScopes classDescriptor : c.getDeclaredClasses().values()) {
|
||||
if (classDescriptor.getKind() == ClassKind.CLASS_OBJECT) {
|
||||
// Class objects should be considered during analysing redeclarations in classes
|
||||
continue;
|
||||
|
||||
@@ -62,7 +62,7 @@ public class DeclarationsChecker {
|
||||
checkModifiersAndAnnotationsInPackageDirective(file);
|
||||
}
|
||||
|
||||
Map<JetClassOrObject, ClassDescriptorWithResolutionScopes> classes = bodiesResolveContext.getClasses();
|
||||
Map<JetClassOrObject, ClassDescriptorWithResolutionScopes> classes = bodiesResolveContext.getDeclaredClasses();
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : classes.entrySet()) {
|
||||
JetClassOrObject classOrObject = entry.getKey();
|
||||
ClassDescriptorWithResolutionScopes classDescriptor = entry.getValue();
|
||||
|
||||
@@ -54,7 +54,7 @@ public class OverloadResolver {
|
||||
MultiMap<FqNameUnsafe, ConstructorDescriptor> inPackages = MultiMap.create();
|
||||
fillGroupedConstructors(c, inClasses, inPackages);
|
||||
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getClasses().entrySet()) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getDeclaredClasses().entrySet()) {
|
||||
checkOverloadsInAClass(entry.getValue(), entry.getKey(), inClasses.get(entry.getValue()));
|
||||
}
|
||||
checkOverloadsInPackages(c, inPackages);
|
||||
@@ -65,7 +65,7 @@ public class OverloadResolver {
|
||||
@NotNull MultiMap<ClassDescriptor, ConstructorDescriptor> inClasses,
|
||||
@NotNull MultiMap<FqNameUnsafe, ConstructorDescriptor> inPackages
|
||||
) {
|
||||
for (ClassDescriptorWithResolutionScopes klass : c.getClasses().values()) {
|
||||
for (ClassDescriptorWithResolutionScopes klass : c.getDeclaredClasses().values()) {
|
||||
if (klass.getKind().isSingleton()) {
|
||||
// Constructors of singletons aren't callable from the code, so they shouldn't participate in overload name checking
|
||||
continue;
|
||||
|
||||
@@ -208,7 +208,7 @@ public class OverrideResolver {
|
||||
}
|
||||
|
||||
private void checkOverrides(@NotNull TopDownAnalysisContext c) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getClasses().entrySet()) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getDeclaredClasses().entrySet()) {
|
||||
checkOverridesInAClass(c, entry.getValue(), entry.getKey());
|
||||
}
|
||||
}
|
||||
@@ -621,7 +621,7 @@ public class OverrideResolver {
|
||||
}
|
||||
|
||||
private void checkParameterOverridesForAllClasses(@NotNull TopDownAnalysisContext c) {
|
||||
for (ClassDescriptorWithResolutionScopes classDescriptor : c.getClasses().values()) {
|
||||
for (ClassDescriptorWithResolutionScopes classDescriptor : c.getDeclaredClasses().values()) {
|
||||
for (DeclarationDescriptor member : classDescriptor.getDefaultType().getMemberScope().getAllDescriptors()) {
|
||||
if (member instanceof CallableMemberDescriptor) {
|
||||
checkOverridesForParameters((CallableMemberDescriptor) member);
|
||||
|
||||
@@ -110,7 +110,7 @@ public class TopDownAnalysisContext implements BodiesResolveContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<JetClassOrObject, ClassDescriptorWithResolutionScopes> getClasses() {
|
||||
public Map<JetClassOrObject, ClassDescriptorWithResolutionScopes> getDeclaredClasses() {
|
||||
return classes;
|
||||
}
|
||||
|
||||
@@ -213,6 +213,6 @@ public class TopDownAnalysisContext implements BodiesResolveContext {
|
||||
}
|
||||
}
|
||||
);
|
||||
return KotlinPackage.plus(getClasses().values(), scriptClasses);
|
||||
return KotlinPackage.plus(getDeclaredClasses().values(), scriptClasses);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ public class TopDownAnalyzer {
|
||||
(ClassDescriptorWithResolutionScopes) resolveSession.getClassDescriptor(classOrObject)
|
||||
);
|
||||
|
||||
c.getClasses().put(classOrObject, descriptor);
|
||||
c.getDeclaredClasses().put(classOrObject, descriptor);
|
||||
registerDeclarations(classOrObject.getDeclarations());
|
||||
registerTopLevelFqName(classOrObject, descriptor);
|
||||
|
||||
@@ -328,7 +328,7 @@ public class TopDownAnalyzer {
|
||||
}
|
||||
|
||||
private void lockScopes(@NotNull TopDownAnalysisContext c) {
|
||||
for (ClassDescriptorWithResolutionScopes mutableClassDescriptor : c.getClasses().values()) {
|
||||
for (ClassDescriptorWithResolutionScopes mutableClassDescriptor : c.getDeclaredClasses().values()) {
|
||||
((MutableClassDescriptor) mutableClassDescriptor).lockScopes();
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ public class TypeHierarchyResolver {
|
||||
}
|
||||
|
||||
private void createTypeConstructors(@NotNull TopDownAnalysisContext c) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getClasses().entrySet()) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getDeclaredClasses().entrySet()) {
|
||||
JetClassOrObject classOrObject = entry.getKey();
|
||||
MutableClassDescriptor descriptor = (MutableClassDescriptor) entry.getValue();
|
||||
if (classOrObject instanceof JetClass) {
|
||||
@@ -203,7 +203,7 @@ public class TypeHierarchyResolver {
|
||||
}
|
||||
|
||||
private void resolveTypesInClassHeaders(@NotNull TopDownAnalysisContext c) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getClasses().entrySet()) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getDeclaredClasses().entrySet()) {
|
||||
JetClassOrObject classOrObject = entry.getKey();
|
||||
if (classOrObject instanceof JetClass) {
|
||||
ClassDescriptorWithResolutionScopes descriptor = entry.getValue();
|
||||
@@ -213,7 +213,7 @@ public class TypeHierarchyResolver {
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getClasses().entrySet()) {
|
||||
for (Map.Entry<JetClassOrObject, ClassDescriptorWithResolutionScopes> entry : c.getDeclaredClasses().entrySet()) {
|
||||
descriptorResolver.resolveSupertypesForMutableClassDescriptor(entry.getKey(), (MutableClassDescriptor) entry.getValue(), trace);
|
||||
}
|
||||
}
|
||||
@@ -467,7 +467,7 @@ public class TypeHierarchyResolver {
|
||||
boolean isInner = kind == ClassKind.CLASS && klass.isInner();
|
||||
MutableClassDescriptor mutableClassDescriptor = new MutableClassDescriptor(
|
||||
containingDeclaration, outerScope, kind, isInner, JetPsiUtil.safeName(klass.getName()));
|
||||
c.getClasses().put(klass, mutableClassDescriptor);
|
||||
c.getDeclaredClasses().put(klass, mutableClassDescriptor);
|
||||
trace.record(FQNAME_TO_CLASS_DESCRIPTOR, JetNamedDeclarationUtil.getUnsafeFQName(klass), mutableClassDescriptor);
|
||||
|
||||
createClassObjectForEnumClass(mutableClassDescriptor);
|
||||
@@ -492,7 +492,7 @@ public class TypeHierarchyResolver {
|
||||
createPrimaryConstructorForObject(declaration, descriptor);
|
||||
trace.record(BindingContext.CLASS, declaration, descriptor);
|
||||
|
||||
c.getClasses().put(declaration, descriptor);
|
||||
c.getDeclaredClasses().put(declaration, descriptor);
|
||||
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
@@ -456,7 +456,7 @@ public class ResolveElementCache {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<JetClassOrObject, ClassDescriptorWithResolutionScopes> getClasses() {
|
||||
public Map<JetClassOrObject, ClassDescriptorWithResolutionScopes> getDeclaredClasses() {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user