added 'getFiles' method to BodiesResolveContext interface
This commit is contained in:
@@ -24,12 +24,14 @@ import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.WritableScope;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Nikolay Krasko
|
||||
*/
|
||||
public interface BodiesResolveContext {
|
||||
Collection<JetFile> getFiles();
|
||||
Map<JetClass, MutableClassDescriptor> getClasses();
|
||||
Map<JetObjectDeclaration, MutableClassDescriptor> getObjects();
|
||||
Map<JetProperty, PropertyDescriptor> getProperties();
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.WritableScope;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -35,6 +36,7 @@ import java.util.Map;
|
||||
* @author Nikolay Krasko
|
||||
*/
|
||||
public class CachedBodiesResolveContext implements BodiesResolveContext {
|
||||
private final Collection<JetFile> files;
|
||||
private final Map<JetClass, MutableClassDescriptor> classes;
|
||||
private final Map<JetObjectDeclaration, MutableClassDescriptor> objects;
|
||||
private final Map<JetProperty, PropertyDescriptor> properties;
|
||||
@@ -46,6 +48,7 @@ public class CachedBodiesResolveContext implements BodiesResolveContext {
|
||||
private @NotNull TopDownAnalysisParameters topDownAnalysisParameters;
|
||||
|
||||
public CachedBodiesResolveContext(TopDownAnalysisContext context) {
|
||||
files = Collections.unmodifiableCollection(context.getFiles());
|
||||
classes = Collections.unmodifiableMap(context.getClasses());
|
||||
objects = Collections.unmodifiableMap(context.getObjects());
|
||||
properties = Collections.unmodifiableMap(context.getProperties());
|
||||
@@ -57,6 +60,11 @@ public class CachedBodiesResolveContext implements BodiesResolveContext {
|
||||
topDownAnalysisParameters = context.getTopDownAnalysisParameters();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<JetFile> getFiles() {
|
||||
return files;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<JetClass, MutableClassDescriptor> getClasses() {
|
||||
return classes;
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.jetbrains.jet.lang.resolve.scopes.WritableScope;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.PrintStream;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -118,6 +119,11 @@ public class TopDownAnalysisContext implements BodiesResolveContext {
|
||||
return namespaceDescriptors;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<JetFile> getFiles() {
|
||||
return namespaceDescriptors.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Map<JetScript, ScriptDescriptor> getScripts() {
|
||||
|
||||
@@ -63,6 +63,11 @@ public class ResolveSessionUtils {
|
||||
this.declaringScopes = declaringScopes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<JetFile> getFiles() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<JetClass, MutableClassDescriptor> getClasses() {
|
||||
return Collections.emptyMap();
|
||||
|
||||
Reference in New Issue
Block a user