Minor. Unused code removed
Follow-up for https://github.com/JetBrains/kotlin/commit/db00500404e4862548ed5eb49f7289e1e8eba99c#commitcomment-6242775
This commit is contained in:
@@ -282,7 +282,6 @@ public class KotlinToJVMBytecodeCompiler {
|
|||||||
environment.getSourceFiles(),
|
environment.getSourceFiles(),
|
||||||
sharedTrace,
|
sharedTrace,
|
||||||
Predicates.<PsiFile>alwaysTrue(),
|
Predicates.<PsiFile>alwaysTrue(),
|
||||||
false,
|
|
||||||
sharedModule,
|
sharedModule,
|
||||||
new CliSourcesMemberFilter(environment));
|
new CliSourcesMemberFilter(environment));
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-5
@@ -121,7 +121,6 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
|
|||||||
Collection<JetFile> files,
|
Collection<JetFile> files,
|
||||||
BindingTrace trace,
|
BindingTrace trace,
|
||||||
Predicate<PsiFile> filesToAnalyzeCompletely,
|
Predicate<PsiFile> filesToAnalyzeCompletely,
|
||||||
boolean storeContextForBodiesResolve,
|
|
||||||
ModuleDescriptorImpl module,
|
ModuleDescriptorImpl module,
|
||||||
MemberFilter memberFilter
|
MemberFilter memberFilter
|
||||||
) {
|
) {
|
||||||
@@ -138,10 +137,7 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
|
|||||||
memberFilter);
|
memberFilter);
|
||||||
try {
|
try {
|
||||||
module.addFragmentProvider(DependencyKind.BINARIES, injector.getJavaDescriptorResolver().getPackageFragmentProvider());
|
module.addFragmentProvider(DependencyKind.BINARIES, injector.getJavaDescriptorResolver().getPackageFragmentProvider());
|
||||||
TopDownAnalysisContext topDownAnalysisContext = injector.getTopDownAnalyzer().analyzeFiles(topDownAnalysisParameters, files);
|
injector.getTopDownAnalyzer().analyzeFiles(topDownAnalysisParameters, files);
|
||||||
BodiesResolveContext bodiesResolveContext = storeContextForBodiesResolve ?
|
|
||||||
new CachedBodiesResolveContext(topDownAnalysisContext) :
|
|
||||||
null;
|
|
||||||
return AnalyzeExhaust.success(trace.getBindingContext(), module);
|
return AnalyzeExhaust.success(trace.getBindingContext(), module);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|||||||
@@ -1,129 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2013 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.jet.lang.resolve;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.intellij.psi.PsiElement;
|
|
||||||
import com.intellij.psi.PsiFile;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptorWithResolutionScopes;
|
|
||||||
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
|
||||||
import org.jetbrains.jet.lang.descriptors.ScriptDescriptor;
|
|
||||||
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.storage.ExceptionTracker;
|
|
||||||
import org.jetbrains.jet.storage.StorageManager;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A storage for the part of {@see TopDownAnalysisContext} collected during headers analysis that will be used during resolution of
|
|
||||||
* bodies
|
|
||||||
*/
|
|
||||||
public class CachedBodiesResolveContext implements BodiesResolveContext {
|
|
||||||
private final Collection<JetFile> files;
|
|
||||||
private final Map<JetClassOrObject, ClassDescriptorWithResolutionScopes> classes;
|
|
||||||
private final Map<JetClassInitializer, ClassDescriptorWithResolutionScopes> anonymousInitializers;
|
|
||||||
private final Map<JetProperty, PropertyDescriptor> properties;
|
|
||||||
private final Map<JetNamedFunction, SimpleFunctionDescriptor> functions;
|
|
||||||
private final Function<JetDeclaration, JetScope> declaringScopes;
|
|
||||||
private final Map<JetScript, ScriptDescriptor> scripts;
|
|
||||||
private final DataFlowInfo outerDataFlowInfo;
|
|
||||||
|
|
||||||
private @NotNull TopDownAnalysisParameters topDownAnalysisParameters;
|
|
||||||
|
|
||||||
public CachedBodiesResolveContext(TopDownAnalysisContext context) {
|
|
||||||
files = Collections.unmodifiableCollection(context.getFiles());
|
|
||||||
classes = Collections.unmodifiableMap(context.getDeclaredClasses());
|
|
||||||
anonymousInitializers = Collections.unmodifiableMap(context.getAnonymousInitializers());
|
|
||||||
properties = Collections.unmodifiableMap(context.getProperties());
|
|
||||||
functions = Collections.unmodifiableMap(context.getFunctions());
|
|
||||||
declaringScopes = context.getDeclaringScopes();
|
|
||||||
scripts = Collections.unmodifiableMap(context.getScripts());
|
|
||||||
outerDataFlowInfo = context.getOuterDataFlowInfo();
|
|
||||||
|
|
||||||
topDownAnalysisParameters = context.getTopDownAnalysisParameters();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public StorageManager getStorageManager() {
|
|
||||||
return topDownAnalysisParameters.getStorageManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public ExceptionTracker getExceptionTracker() {
|
|
||||||
return topDownAnalysisParameters.getExceptionTracker();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<JetFile> getFiles() {
|
|
||||||
return files;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<JetClassOrObject, ClassDescriptorWithResolutionScopes> getDeclaredClasses() {
|
|
||||||
return classes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<JetClassInitializer, ClassDescriptorWithResolutionScopes> getAnonymousInitializers() {
|
|
||||||
return anonymousInitializers;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<JetProperty, PropertyDescriptor> getProperties() {
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<JetNamedFunction, SimpleFunctionDescriptor> getFunctions() {
|
|
||||||
return functions;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Function<JetDeclaration, JetScope> getDeclaringScopes() {
|
|
||||||
return declaringScopes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<JetScript, ScriptDescriptor> getScripts() {
|
|
||||||
return scripts;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DataFlowInfo getOuterDataFlowInfo() {
|
|
||||||
return outerDataFlowInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public TopDownAnalysisParameters getTopDownAnalysisParameters() {
|
|
||||||
return topDownAnalysisParameters;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean completeAnalysisNeeded(@NotNull PsiElement element) {
|
|
||||||
PsiFile containingFile = element.getContainingFile();
|
|
||||||
return containingFile != null && topDownAnalysisParameters.getAnalyzeCompletely().apply(containingFile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -53,7 +53,7 @@ public abstract class AbstractJetDiagnosticsTest extends BaseDiagnosticsTest {
|
|||||||
|
|
||||||
BindingContext bindingContext = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(
|
BindingContext bindingContext = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(
|
||||||
getProject(), jetFiles, support.getTrace(),
|
getProject(), jetFiles, support.getTrace(),
|
||||||
Predicates.<PsiFile>alwaysTrue(), false, support.getModule(),
|
Predicates.<PsiFile>alwaysTrue(), support.getModule(),
|
||||||
MemberFilter.ALWAYS_TRUE).getBindingContext();
|
MemberFilter.ALWAYS_TRUE).getBindingContext();
|
||||||
|
|
||||||
boolean ok = true;
|
boolean ok = true;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class JvmResolveUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AnalyzeExhaust analyzeExhaust = analyzeFilesWithJavaIntegration(
|
AnalyzeExhaust analyzeExhaust = analyzeFilesWithJavaIntegration(
|
||||||
project, files, filesToAnalyzeCompletely, false);
|
project, files, filesToAnalyzeCompletely);
|
||||||
|
|
||||||
AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext());
|
AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext());
|
||||||
|
|
||||||
@@ -73,22 +73,11 @@ public class JvmResolveUtil {
|
|||||||
Project project,
|
Project project,
|
||||||
Collection<JetFile> files,
|
Collection<JetFile> files,
|
||||||
Predicate<PsiFile> filesToAnalyzeCompletely
|
Predicate<PsiFile> filesToAnalyzeCompletely
|
||||||
) {
|
|
||||||
return analyzeFilesWithJavaIntegration(
|
|
||||||
project, files, filesToAnalyzeCompletely, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public static AnalyzeExhaust analyzeFilesWithJavaIntegration(
|
|
||||||
Project project,
|
|
||||||
Collection<JetFile> files,
|
|
||||||
Predicate<PsiFile> filesToAnalyzeCompletely,
|
|
||||||
boolean storeContextForBodiesResolve
|
|
||||||
) {
|
) {
|
||||||
BindingTraceContext bindingTraceContext = new BindingTraceContext();
|
BindingTraceContext bindingTraceContext = new BindingTraceContext();
|
||||||
|
|
||||||
return analyzeFilesWithJavaIntegration(project, files, bindingTraceContext, filesToAnalyzeCompletely,
|
return analyzeFilesWithJavaIntegration(project, files, bindingTraceContext, filesToAnalyzeCompletely
|
||||||
storeContextForBodiesResolve);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -96,11 +85,9 @@ public class JvmResolveUtil {
|
|||||||
Project project,
|
Project project,
|
||||||
Collection<JetFile> files,
|
Collection<JetFile> files,
|
||||||
BindingTrace trace,
|
BindingTrace trace,
|
||||||
Predicate<PsiFile> filesToAnalyzeCompletely,
|
Predicate<PsiFile> filesToAnalyzeCompletely
|
||||||
boolean storeContextForBodiesResolve
|
|
||||||
) {
|
) {
|
||||||
return AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(project, files, trace, filesToAnalyzeCompletely,
|
return AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(project, files, trace, filesToAnalyzeCompletely,
|
||||||
storeContextForBodiesResolve,
|
|
||||||
AnalyzerFacadeForJVM.createJavaModule("<module>"),
|
AnalyzerFacadeForJVM.createJavaModule("<module>"),
|
||||||
MemberFilter.ALWAYS_TRUE);
|
MemberFilter.ALWAYS_TRUE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,19 +70,13 @@ public final class AnalyzerFacadeForJS {
|
|||||||
return analyzeFiles(files, Predicates.<PsiFile>alwaysTrue(), config).getBindingContext();
|
return analyzeFiles(files, Predicates.<PsiFile>alwaysTrue(), config).getBindingContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public static AnalyzeExhaust analyzeFiles(
|
|
||||||
@NotNull Collection<JetFile> files,
|
|
||||||
@NotNull Predicate<PsiFile> filesToAnalyzeCompletely, @NotNull Config config) {
|
|
||||||
return analyzeFiles(files, filesToAnalyzeCompletely, config, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: refactor
|
//TODO: refactor
|
||||||
@NotNull
|
@NotNull
|
||||||
public static AnalyzeExhaust analyzeFiles(
|
public static AnalyzeExhaust analyzeFiles(
|
||||||
@NotNull Collection<JetFile> files,
|
@NotNull Collection<JetFile> files,
|
||||||
@NotNull Predicate<PsiFile> filesToAnalyzeCompletely, @NotNull Config config,
|
@NotNull Predicate<PsiFile> filesToAnalyzeCompletely,
|
||||||
boolean storeContextForBodiesResolve) {
|
@NotNull Config config
|
||||||
|
) {
|
||||||
Project project = config.getProject();
|
Project project = config.getProject();
|
||||||
|
|
||||||
ModuleDescriptorImpl owner = createJsModule("<module>");
|
ModuleDescriptorImpl owner = createJsModule("<module>");
|
||||||
@@ -107,11 +101,7 @@ public final class AnalyzerFacadeForJS {
|
|||||||
Collection<JetFile> allFiles = libraryModule != null ?
|
Collection<JetFile> allFiles = libraryModule != null ?
|
||||||
files :
|
files :
|
||||||
Config.withJsLibAdded(files, config);
|
Config.withJsLibAdded(files, config);
|
||||||
TopDownAnalysisContext topDownAnalysisContext =
|
injector.getTopDownAnalyzer().analyzeFiles(topDownAnalysisParameters, allFiles);
|
||||||
injector.getTopDownAnalyzer().analyzeFiles(topDownAnalysisParameters, allFiles);
|
|
||||||
BodiesResolveContext bodiesResolveContext = storeContextForBodiesResolve ?
|
|
||||||
new CachedBodiesResolveContext(topDownAnalysisContext) :
|
|
||||||
null;
|
|
||||||
return AnalyzeExhaust.success(trace.getBindingContext(), owner);
|
return AnalyzeExhaust.success(trace.getBindingContext(), owner);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user