Only use script parameters from definition
Passing parameters of a _single_ script into TopDownAnalyser makes no sense
This commit is contained in:
+9
-1
@@ -41,7 +41,10 @@ import org.jetbrains.jet.codegen.state.Progress;
|
||||
import org.jetbrains.jet.config.CommonConfigurationKeys;
|
||||
import org.jetbrains.jet.config.CompilerConfiguration;
|
||||
import org.jetbrains.jet.lang.descriptors.ModuleDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.parsing.JetScriptDefinition;
|
||||
import org.jetbrains.jet.lang.parsing.JetScriptDefinitionProvider;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.ScriptNameUtil;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
@@ -221,6 +224,12 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
|
||||
@Nullable
|
||||
public static Class<?> compileScript(@NotNull KotlinPaths paths, @NotNull JetCoreEnvironment environment) {
|
||||
List<AnalyzerScriptParameter> scriptParameters = environment.getConfiguration().getList(JVMConfigurationKeys.SCRIPT_PARAMETERS);
|
||||
if (!scriptParameters.isEmpty()) {
|
||||
JetScriptDefinitionProvider.getInstance(environment.getProject()).addScriptDefinition(
|
||||
new JetScriptDefinition(".kts", scriptParameters)
|
||||
);
|
||||
}
|
||||
GenerationState state = analyzeAndGenerate(environment);
|
||||
if (state == null) {
|
||||
return null;
|
||||
@@ -272,7 +281,6 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
environment.getProject(),
|
||||
environment.getSourceFiles(),
|
||||
sharedTrace,
|
||||
environment.getConfiguration().getList(JVMConfigurationKeys.SCRIPT_PARAMETERS),
|
||||
Predicates.<PsiFile>alwaysTrue(),
|
||||
false,
|
||||
sharedModule,
|
||||
|
||||
@@ -108,8 +108,8 @@ public class ReplInterpreter {
|
||||
new ExceptionTracker(), // dummy
|
||||
Predicates.<PsiFile>alwaysTrue(),
|
||||
false,
|
||||
true,
|
||||
Collections.<AnalyzerScriptParameter>emptyList());
|
||||
true
|
||||
);
|
||||
injector = new InjectorForTopDownAnalyzerForJvm(project, topDownAnalysisParameters, trace, module, MemberFilter.ALWAYS_TRUE);
|
||||
topDownAnalysisContext = new TopDownAnalysisContext(topDownAnalysisParameters);
|
||||
module.addFragmentProvider(SOURCES, injector.getTopDownAnalyzer().getPackageFragmentProvider());
|
||||
|
||||
+12
-25
@@ -64,24 +64,22 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
|
||||
public AnalyzeExhaust analyzeFiles(
|
||||
@NotNull Project project,
|
||||
@NotNull Collection<JetFile> files,
|
||||
@NotNull List<AnalyzerScriptParameter> scriptParameters,
|
||||
@NotNull Predicate<PsiFile> filesToAnalyzeCompletely
|
||||
) {
|
||||
return analyzeFilesWithJavaIntegration(project, files, scriptParameters, filesToAnalyzeCompletely, true);
|
||||
return analyzeFilesWithJavaIntegration(project, files, filesToAnalyzeCompletely, true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public AnalyzeExhaust analyzeBodiesInFiles(
|
||||
@NotNull Project project,
|
||||
@NotNull List<AnalyzerScriptParameter> scriptParameters,
|
||||
@NotNull Predicate<PsiFile> filesForBodiesResolve,
|
||||
@NotNull BindingTrace headersTraceContext,
|
||||
@NotNull BodiesResolveContext bodiesResolveContext,
|
||||
@NotNull ModuleDescriptor module
|
||||
) {
|
||||
return AnalyzerFacadeForEverything.analyzeBodiesInFilesWithJavaIntegration(
|
||||
project, scriptParameters, filesForBodiesResolve,
|
||||
project, filesForBodiesResolve,
|
||||
headersTraceContext, bodiesResolveContext, module);
|
||||
}
|
||||
|
||||
@@ -122,12 +120,10 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static AnalyzeExhaust analyzeOneFileWithJavaIntegrationAndCheckForErrors(
|
||||
JetFile file, List<AnalyzerScriptParameter> scriptParameters
|
||||
) {
|
||||
public static AnalyzeExhaust analyzeOneFileWithJavaIntegrationAndCheckForErrors(JetFile file) {
|
||||
AnalyzingUtils.checkForSyntacticErrors(file);
|
||||
|
||||
AnalyzeExhaust analyzeExhaust = analyzeOneFileWithJavaIntegration(file, scriptParameters);
|
||||
AnalyzeExhaust analyzeExhaust = analyzeOneFileWithJavaIntegration(file);
|
||||
|
||||
AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext());
|
||||
|
||||
@@ -135,10 +131,8 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static AnalyzeExhaust analyzeOneFileWithJavaIntegration(
|
||||
JetFile file, List<AnalyzerScriptParameter> scriptParameters
|
||||
) {
|
||||
return analyzeFilesWithJavaIntegration(file.getProject(), Collections.singleton(file), scriptParameters,
|
||||
public static AnalyzeExhaust analyzeOneFileWithJavaIntegration(JetFile file) {
|
||||
return analyzeFilesWithJavaIntegration(file.getProject(), Collections.singleton(file),
|
||||
Predicates.<PsiFile>alwaysTrue());
|
||||
}
|
||||
|
||||
@@ -146,7 +140,6 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
|
||||
public static AnalyzeExhaust analyzeFilesWithJavaIntegrationAndCheckForErrors(
|
||||
Project project,
|
||||
Collection<JetFile> files,
|
||||
List<AnalyzerScriptParameter> scriptParameters,
|
||||
Predicate<PsiFile> filesToAnalyzeCompletely
|
||||
) {
|
||||
for (JetFile file : files) {
|
||||
@@ -154,7 +147,7 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
|
||||
}
|
||||
|
||||
AnalyzeExhaust analyzeExhaust = analyzeFilesWithJavaIntegration(
|
||||
project, files, scriptParameters, filesToAnalyzeCompletely, false);
|
||||
project, files, filesToAnalyzeCompletely, false);
|
||||
|
||||
AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext());
|
||||
|
||||
@@ -165,24 +158,22 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
|
||||
public static AnalyzeExhaust analyzeFilesWithJavaIntegration(
|
||||
Project project,
|
||||
Collection<JetFile> files,
|
||||
List<AnalyzerScriptParameter> scriptParameters,
|
||||
Predicate<PsiFile> filesToAnalyzeCompletely
|
||||
) {
|
||||
return analyzeFilesWithJavaIntegration(
|
||||
project, files, scriptParameters, filesToAnalyzeCompletely, false);
|
||||
project, files, filesToAnalyzeCompletely, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static AnalyzeExhaust analyzeFilesWithJavaIntegration(
|
||||
Project project,
|
||||
Collection<JetFile> files,
|
||||
List<AnalyzerScriptParameter> scriptParameters,
|
||||
Predicate<PsiFile> filesToAnalyzeCompletely,
|
||||
boolean storeContextForBodiesResolve
|
||||
) {
|
||||
BindingTraceContext bindingTraceContext = new BindingTraceContext();
|
||||
|
||||
return analyzeFilesWithJavaIntegration(project, files, bindingTraceContext, scriptParameters, filesToAnalyzeCompletely,
|
||||
return analyzeFilesWithJavaIntegration(project, files, bindingTraceContext, filesToAnalyzeCompletely,
|
||||
storeContextForBodiesResolve);
|
||||
}
|
||||
|
||||
@@ -191,11 +182,10 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
|
||||
Project project,
|
||||
Collection<JetFile> files,
|
||||
BindingTrace trace,
|
||||
List<AnalyzerScriptParameter> scriptParameters,
|
||||
Predicate<PsiFile> filesToAnalyzeCompletely,
|
||||
boolean storeContextForBodiesResolve
|
||||
) {
|
||||
return analyzeFilesWithJavaIntegration(project, files, trace, scriptParameters, filesToAnalyzeCompletely,
|
||||
return analyzeFilesWithJavaIntegration(project, files, trace, filesToAnalyzeCompletely,
|
||||
storeContextForBodiesResolve, createJavaModule("<module>"), MemberFilter.ALWAYS_TRUE);
|
||||
}
|
||||
|
||||
@@ -204,14 +194,13 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
|
||||
Project project,
|
||||
Collection<JetFile> files,
|
||||
BindingTrace trace,
|
||||
List<AnalyzerScriptParameter> scriptParameters,
|
||||
Predicate<PsiFile> filesToAnalyzeCompletely,
|
||||
boolean storeContextForBodiesResolve,
|
||||
ModuleDescriptorImpl module,
|
||||
MemberFilter memberFilter
|
||||
) {
|
||||
GlobalContext globalContext = ContextPackage.GlobalContext();
|
||||
return analyzeFilesWithJavaIntegrationInGlobalContext(project, files, trace, scriptParameters, filesToAnalyzeCompletely,
|
||||
return analyzeFilesWithJavaIntegrationInGlobalContext(project, files, trace, filesToAnalyzeCompletely,
|
||||
storeContextForBodiesResolve, module, globalContext, memberFilter);
|
||||
}
|
||||
|
||||
@@ -220,7 +209,6 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
|
||||
Project project,
|
||||
Collection<JetFile> files,
|
||||
BindingTrace trace,
|
||||
List<AnalyzerScriptParameter> scriptParameters,
|
||||
Predicate<PsiFile> filesToAnalyzeCompletely,
|
||||
boolean storeContextForBodiesResolve,
|
||||
ModuleDescriptorImpl module,
|
||||
@@ -232,8 +220,7 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
|
||||
globalContext.getExceptionTracker(),
|
||||
filesToAnalyzeCompletely,
|
||||
false,
|
||||
false,
|
||||
scriptParameters
|
||||
false
|
||||
);
|
||||
|
||||
InjectorForTopDownAnalyzerForJvm injector = new InjectorForTopDownAnalyzerForJvm(project, topDownAnalysisParameters, trace, module,
|
||||
|
||||
@@ -22,13 +22,11 @@ import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.BodiesResolveContext;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.ResolveSession;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public interface AnalyzerFacade {
|
||||
|
||||
@@ -36,14 +34,12 @@ public interface AnalyzerFacade {
|
||||
AnalyzeExhaust analyzeFiles(
|
||||
@NotNull Project project,
|
||||
@NotNull Collection<JetFile> files,
|
||||
@NotNull List<AnalyzerScriptParameter> scriptParameters,
|
||||
@NotNull Predicate<PsiFile> filesToAnalyzeCompletely
|
||||
);
|
||||
|
||||
@NotNull
|
||||
AnalyzeExhaust analyzeBodiesInFiles(
|
||||
@NotNull Project project,
|
||||
@NotNull List<AnalyzerScriptParameter> scriptParameters,
|
||||
@NotNull Predicate<PsiFile> filesForBodiesResolve,
|
||||
@NotNull BindingTrace traceContext,
|
||||
@NotNull BodiesResolveContext bodiesResolveContext,
|
||||
|
||||
@@ -32,18 +32,18 @@ public class AnalyzerFacadeForEverything {
|
||||
}
|
||||
|
||||
public static AnalyzeExhaust analyzeBodiesInFilesWithJavaIntegration(
|
||||
Project project, List<AnalyzerScriptParameter> scriptParameters, Predicate<PsiFile> filesToAnalyzeCompletely,
|
||||
Project project, Predicate<PsiFile> filesToAnalyzeCompletely,
|
||||
@NotNull BindingTrace traceContext,
|
||||
@NotNull BodiesResolveContext bodiesResolveContext,
|
||||
@NotNull ModuleDescriptor module) {
|
||||
@NotNull ModuleDescriptor module
|
||||
) {
|
||||
|
||||
TopDownAnalysisParameters topDownAnalysisParameters = new TopDownAnalysisParameters(
|
||||
bodiesResolveContext.getStorageManager(),
|
||||
bodiesResolveContext.getExceptionTracker(),
|
||||
filesToAnalyzeCompletely,
|
||||
false,
|
||||
false,
|
||||
scriptParameters
|
||||
false
|
||||
);
|
||||
|
||||
bodiesResolveContext.setTopDownAnalysisParameters(topDownAnalysisParameters);
|
||||
|
||||
@@ -96,7 +96,6 @@ public class ScriptHeaderResolver {
|
||||
ScriptDescriptorImpl descriptor = (ScriptDescriptorImpl) e.getValue();
|
||||
|
||||
List<ValueParameterDescriptor> valueParameters = scriptParameterResolver.resolveScriptParameters(
|
||||
c.getTopDownAnalysisParameters(),
|
||||
declaration,
|
||||
descriptor
|
||||
);
|
||||
|
||||
@@ -49,7 +49,6 @@ public class ScriptParameterResolver {
|
||||
|
||||
@NotNull
|
||||
public List<ValueParameterDescriptor> resolveScriptParameters(
|
||||
@NotNull TopDownAnalysisParameters topDownAnalysisParameters,
|
||||
@NotNull JetScript declaration,
|
||||
@NotNull ScriptDescriptor scriptDescriptor
|
||||
) {
|
||||
@@ -59,11 +58,7 @@ public class ScriptParameterResolver {
|
||||
JetScriptDefinition scriptDefinition = JetScriptDefinitionProvider.getInstance(file.getProject()).findScriptDefinition(file);
|
||||
|
||||
int index = 0;
|
||||
List<AnalyzerScriptParameter> scriptParameters = !scriptDefinition.getScriptParameters().isEmpty()
|
||||
? scriptDefinition.getScriptParameters()
|
||||
: topDownAnalysisParameters.getScriptParameters();
|
||||
|
||||
for (AnalyzerScriptParameter scriptParameter : scriptParameters) {
|
||||
for (AnalyzerScriptParameter scriptParameter : scriptDefinition.getScriptParameters()) {
|
||||
ValueParameterDescriptor parameter = resolveScriptParameter(scriptParameter, index, scriptDescriptor);
|
||||
valueParameters.add(parameter);
|
||||
++index;
|
||||
|
||||
+1
-12
@@ -23,8 +23,6 @@ import org.jetbrains.jet.context.GlobalContext;
|
||||
import org.jetbrains.jet.storage.ExceptionTracker;
|
||||
import org.jetbrains.jet.storage.StorageManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Various junk that cannot be placed into context (yet).
|
||||
*/
|
||||
@@ -37,23 +35,19 @@ public class TopDownAnalysisParameters implements GlobalContext {
|
||||
private final Predicate<PsiFile> analyzeCompletely;
|
||||
private final boolean analyzingBootstrapLibrary;
|
||||
private final boolean declaredLocally;
|
||||
@NotNull
|
||||
private final List<AnalyzerScriptParameter> scriptParameters;
|
||||
|
||||
public TopDownAnalysisParameters(
|
||||
@NotNull StorageManager storageManager,
|
||||
@NotNull ExceptionTracker exceptionTracker,
|
||||
@NotNull Predicate<PsiFile> analyzeCompletely,
|
||||
boolean analyzingBootstrapLibrary,
|
||||
boolean declaredLocally,
|
||||
@NotNull List<AnalyzerScriptParameter> scriptParameters
|
||||
boolean declaredLocally
|
||||
) {
|
||||
this.storageManager = storageManager;
|
||||
this.exceptionTracker = exceptionTracker;
|
||||
this.analyzeCompletely = analyzeCompletely;
|
||||
this.analyzingBootstrapLibrary = analyzingBootstrapLibrary;
|
||||
this.declaredLocally = declaredLocally;
|
||||
this.scriptParameters = scriptParameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,9 +74,4 @@ public class TopDownAnalysisParameters implements GlobalContext {
|
||||
public boolean isDeclaredLocally() {
|
||||
return declaredLocally;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<AnalyzerScriptParameter> getScriptParameters() {
|
||||
return scriptParameters;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,8 +389,7 @@ public class TopDownAnalyzer {
|
||||
globalContext.getExceptionTracker(),
|
||||
Predicates.equalTo(object.getContainingFile()),
|
||||
false,
|
||||
true,
|
||||
Collections.<AnalyzerScriptParameter>emptyList()
|
||||
true
|
||||
);
|
||||
|
||||
InjectorForTopDownAnalyzerBasic injector = new InjectorForTopDownAnalyzerBasic(
|
||||
|
||||
+1
-2
@@ -54,7 +54,6 @@ import org.jetbrains.jet.lang.resolve.TemporaryBindingTrace
|
||||
public class LazyScriptDescriptor(
|
||||
val resolveSession: ResolveSession,
|
||||
scriptParameterResolver: ScriptParameterResolver,
|
||||
topDownAnalysisParameters: TopDownAnalysisParameters,
|
||||
scriptBodyResolver: ScriptBodyResolver,
|
||||
val jetScript: JetScript,
|
||||
val _priority: Int
|
||||
@@ -83,7 +82,7 @@ public class LazyScriptDescriptor(
|
||||
val result = ScriptCodeDescriptor(this)
|
||||
result.initialize(
|
||||
_implicitReceiver,
|
||||
scriptParameterResolver.resolveScriptParameters(topDownAnalysisParameters, jetScript, this),
|
||||
scriptParameterResolver.resolveScriptParameters(jetScript, this),
|
||||
DeferredType.create(resolveSession.getStorageManager(), resolveSession.getTrace()) {
|
||||
scriptBodyResolver.resolveScriptReturnType(jetScript, this, resolveSession.getTrace())
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
// this script expected parameter num : Int
|
||||
|
||||
fun fib(n: Int): Int {
|
||||
val v = if(n < 2) 1 else fib(n-1) + fib(n-2)
|
||||
System.out.println("fib($n)=$v")
|
||||
return v
|
||||
}
|
||||
|
||||
System.out.println("num: $num")
|
||||
val result = fib(num)
|
||||
@@ -226,14 +226,13 @@ public class JetTestUtils {
|
||||
|
||||
@NotNull
|
||||
public static AnalyzeExhaust analyzeFile(@NotNull JetFile file) {
|
||||
return AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(file, Collections.<AnalyzerScriptParameter>emptyList());
|
||||
return AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(file);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static AnalyzeExhaust analyzeFileWithoutBody(@NotNull JetFile file) {
|
||||
return AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(file.getProject(),
|
||||
Collections.singleton(file),
|
||||
Collections.<AnalyzerScriptParameter>emptyList(),
|
||||
Predicates.<PsiFile>alwaysFalse());
|
||||
}
|
||||
|
||||
|
||||
@@ -56,13 +56,6 @@ public class ScriptTest {
|
||||
aClass.getConstructor(int.class).newInstance(4);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScriptStandardExt() throws Exception {
|
||||
Class<?> aClass = compileScript("fib.kt", numIntParam(), Collections.<JetScriptDefinition>emptyList());
|
||||
Assert.assertNotNull(aClass);
|
||||
aClass.getConstructor(int.class).newInstance(4);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScriptWithScriptDefinition() throws Exception {
|
||||
Class<?> aClass = compileScript("fib.fib.kt", null,
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.jetbrains.jet.descriptors.serialization.descriptors.MemberFilter;
|
||||
import org.jetbrains.jet.lang.diagnostics.DiagnosticUtils;
|
||||
import org.jetbrains.jet.lang.psi.JetElement;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall;
|
||||
@@ -34,7 +33,6 @@ import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCallWithTrace;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -48,7 +46,7 @@ public abstract class AbstractJetDiagnosticsTest extends BaseDiagnosticsTest {
|
||||
|
||||
BindingContext bindingContext = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(
|
||||
getProject(), jetFiles, support.getTrace(),
|
||||
Collections.<AnalyzerScriptParameter>emptyList(), Predicates.<PsiFile>alwaysTrue(), false, support.getModule(),
|
||||
Predicates.<PsiFile>alwaysTrue(), false, support.getModule(),
|
||||
MemberFilter.ALWAYS_TRUE).getBindingContext();
|
||||
|
||||
boolean ok = true;
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.jetbrains.jet.JetLiteFixture;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
|
||||
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
|
||||
@@ -109,7 +108,7 @@ public class CheckerTestUtilTest extends JetLiteFixture {
|
||||
|
||||
public void test(@NotNull PsiFile psiFile) {
|
||||
BindingContext bindingContext = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(
|
||||
(JetFile) psiFile,Collections.<AnalyzerScriptParameter>emptyList())
|
||||
(JetFile) psiFile)
|
||||
.getBindingContext();
|
||||
|
||||
String expectedText = CheckerTestUtil.addDiagnosticMarkersToText(psiFile, CheckerTestUtil.getDiagnosticsIncludingSyntaxErrors(bindingContext, psiFile)).toString();
|
||||
|
||||
@@ -23,6 +23,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.JetTestCaseBuilder;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.checkers.CheckerTestUtil;
|
||||
import org.jetbrains.jet.lang.parsing.JetScriptDefinition;
|
||||
import org.jetbrains.jet.lang.parsing.JetScriptDefinitionProvider;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
@@ -42,18 +44,15 @@ public class CodegenTestFiles {
|
||||
@NotNull
|
||||
private final List<Pair<String, String>> expectedValues;
|
||||
@NotNull
|
||||
private final List<AnalyzerScriptParameter> scriptParameterTypes;
|
||||
@NotNull
|
||||
private final List<Object> scriptParameterValues;
|
||||
|
||||
private CodegenTestFiles(
|
||||
@NotNull List<JetFile> psiFiles,
|
||||
@NotNull List<Pair<String, String>> expectedValues,
|
||||
@NotNull List<AnalyzerScriptParameter> scriptParameterTypes,
|
||||
@NotNull List<Object> scriptParameterValues) {
|
||||
@NotNull List<Object> scriptParameterValues
|
||||
) {
|
||||
this.psiFiles = psiFiles;
|
||||
this.expectedValues = expectedValues;
|
||||
this.scriptParameterTypes = scriptParameterTypes;
|
||||
this.scriptParameterValues = scriptParameterValues;
|
||||
}
|
||||
|
||||
@@ -68,11 +67,6 @@ public class CodegenTestFiles {
|
||||
return expectedValues;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<AnalyzerScriptParameter> getScriptParameterTypes() {
|
||||
return scriptParameterTypes;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<Object> getScriptParameterValues() {
|
||||
return scriptParameterValues;
|
||||
@@ -96,7 +90,7 @@ public class CodegenTestFiles {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return new CodegenTestFiles(files, Collections.<Pair<String, String>>emptyList(), Collections.<AnalyzerScriptParameter>emptyList(), Collections.emptyList());
|
||||
return new CodegenTestFiles(files, Collections.<Pair<String, String>>emptyList(), Collections.emptyList());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -146,8 +140,15 @@ public class CodegenTestFiles {
|
||||
scriptParameterTypes.add(new AnalyzerScriptParameter(Name.identifier(name), JetTypeName.parse(type)));
|
||||
scriptParameterValues.add(value);
|
||||
}
|
||||
|
||||
JetScriptDefinitionProvider.getInstance(project).addScriptDefinition(
|
||||
new JetScriptDefinition(
|
||||
".kts",
|
||||
scriptParameterTypes
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return new CodegenTestFiles(Collections.singletonList(file), expectedValues, scriptParameterTypes, scriptParameterValues);
|
||||
return new CodegenTestFiles(Collections.singletonList(file), expectedValues, scriptParameterValues);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ public class CodegenTestUtil {
|
||||
AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegrationAndCheckForErrors(
|
||||
environment.getProject(),
|
||||
files.getPsiFiles(),
|
||||
files.getScriptParameterTypes(),
|
||||
Predicates.<PsiFile>alwaysTrue());
|
||||
analyzeExhaust.throwIfError();
|
||||
AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext());
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.jetbrains.jet.analyzer.AnalyzeExhaust;
|
||||
import org.jetbrains.jet.cli.common.arguments.CompilerArgumentsUtil;
|
||||
import org.jetbrains.jet.codegen.state.GenerationState;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -43,14 +42,14 @@ public class GenerationUtils {
|
||||
@NotNull
|
||||
public static GenerationState compileFileGetGenerationStateForTest(@NotNull JetFile psiFile) {
|
||||
AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegrationAndCheckForErrors(
|
||||
psiFile, Collections.<AnalyzerScriptParameter>emptyList());
|
||||
psiFile);
|
||||
return compileFilesGetGenerationState(psiFile.getProject(), analyzeExhaust, Collections.singletonList(psiFile));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static GenerationState compileManyFilesGetGenerationStateForTest(@NotNull Project project, @NotNull List<JetFile> files) {
|
||||
AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegrationAndCheckForErrors(
|
||||
project, files, Collections.<AnalyzerScriptParameter>emptyList(), Predicates.<PsiFile>alwaysTrue());
|
||||
project, files, Predicates.<PsiFile>alwaysTrue());
|
||||
return compileFilesGetGenerationState(project,analyzeExhaust, files);
|
||||
}
|
||||
|
||||
|
||||
@@ -146,8 +146,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
||||
new ExceptionTracker(), // dummy
|
||||
Predicates.<PsiFile>alwaysFalse(),
|
||||
false,
|
||||
false,
|
||||
Collections.<AnalyzerScriptParameter>emptyList()
|
||||
false
|
||||
);
|
||||
InjectorForTopDownAnalyzerForJvm injectorForAnalyzer = new InjectorForTopDownAnalyzerForJvm(
|
||||
environment.getProject(),
|
||||
|
||||
+2
-5
@@ -32,7 +32,6 @@ import org.jetbrains.jet.config.CompilerConfiguration;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.PackageViewDescriptor;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
import org.jetbrains.jet.test.TestCaseWithTmpdir;
|
||||
@@ -84,8 +83,7 @@ public class CompileKotlinAgainstCustomBinariesTest extends TestCaseWithTmpdir {
|
||||
Project project = createEnvironment(Arrays.asList(extraClassPath)).getProject();
|
||||
|
||||
AnalyzeExhaust exhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(
|
||||
JetTestUtils.loadJetFile(project, getTestDataFileWithExtension("kt")),
|
||||
Collections.<AnalyzerScriptParameter>emptyList()
|
||||
JetTestUtils.loadJetFile(project, getTestDataFileWithExtension("kt"))
|
||||
);
|
||||
|
||||
PackageViewDescriptor packageView = exhaust.getModuleDescriptor().getPackage(LoadDescriptorUtil.TEST_PACKAGE_FQNAME);
|
||||
@@ -177,8 +175,7 @@ public class CompileKotlinAgainstCustomBinariesTest extends TestCaseWithTmpdir {
|
||||
Project project = createEnvironment(Collections.singletonList(tmpdir)).getProject();
|
||||
|
||||
AnalyzeExhaust exhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(
|
||||
JetTestUtils.loadJetFile(project, getTestDataFileWithExtension("kt")),
|
||||
Collections.<AnalyzerScriptParameter>emptyList()
|
||||
JetTestUtils.loadJetFile(project, getTestDataFileWithExtension("kt"))
|
||||
);
|
||||
exhaust.throwIfError();
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ import org.jetbrains.jet.di.InjectorForJavaDescriptorResolver;
|
||||
import org.jetbrains.jet.di.InjectorForJavaDescriptorResolverUtil;
|
||||
import org.jetbrains.jet.lang.descriptors.PackageViewDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTraceContext;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
@@ -156,7 +155,7 @@ public final class LoadDescriptorUtil {
|
||||
}
|
||||
});
|
||||
AnalyzeExhaust exhaust = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(
|
||||
jetCoreEnvironment.getProject(), jetFiles, Collections.<AnalyzerScriptParameter>emptyList(), Predicates.<PsiFile>alwaysTrue());
|
||||
jetCoreEnvironment.getProject(), jetFiles, Predicates.<PsiFile>alwaysTrue());
|
||||
return new JetFilesAndExhaust(jetFiles, exhaust);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,17 +32,12 @@ import org.jetbrains.jet.lang.descriptors.DependencyKind;
|
||||
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ModuleDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetPackageDirective;
|
||||
import org.jetbrains.jet.lang.psi.JetSimpleNameExpression;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.TopDownAnalysisParameters;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.resolve.name.SpecialNames;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -55,7 +50,7 @@ public class LazyResolveTestUtil {
|
||||
|
||||
GlobalContextImpl globalContext = ContextPackage.GlobalContext();
|
||||
TopDownAnalysisParameters params = new TopDownAnalysisParameters(
|
||||
globalContext.getStorageManager(), globalContext.getExceptionTracker(), Predicates.<PsiFile>alwaysTrue(), false, false, Collections.<AnalyzerScriptParameter>emptyList());
|
||||
globalContext.getStorageManager(), globalContext.getExceptionTracker(), Predicates.<PsiFile>alwaysTrue(), false, false);
|
||||
CliLightClassGenerationSupport support = CliLightClassGenerationSupport.getInstanceForCli(environment.getProject());
|
||||
BindingTrace sharedTrace = support.getTrace();
|
||||
ModuleDescriptorImpl sharedModule = support.getModule();
|
||||
|
||||
@@ -31,14 +31,12 @@ import org.jetbrains.jet.lang.descriptors.PackageViewDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetElement;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetVisitorVoid;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class DescriptorRendererTest extends JetLiteFixture {
|
||||
@@ -93,7 +91,7 @@ public class DescriptorRendererTest extends JetLiteFixture {
|
||||
String fileName = getTestName(false) + ".kt";
|
||||
JetFile psiFile = createPsiFile(null, fileName, loadFile(fileName));
|
||||
AnalyzeExhaust analyzeExhaust =
|
||||
AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(psiFile, Collections.<AnalyzerScriptParameter>emptyList());
|
||||
AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(psiFile);
|
||||
final BindingContext bindingContext = analyzeExhaust.getBindingContext();
|
||||
final List<DeclarationDescriptor> descriptors = new ArrayList<DeclarationDescriptor>();
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.jetbrains.jet.lang.diagnostics.Diagnostic;
|
||||
import org.jetbrains.jet.lang.diagnostics.DiagnosticUtils;
|
||||
import org.jetbrains.jet.lang.diagnostics.Errors;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
@@ -43,7 +42,6 @@ import org.jetbrains.jet.lang.types.TypeConstructor;
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
import org.jetbrains.jet.renderer.DescriptorRenderer;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -148,7 +146,7 @@ public abstract class ExpectedResolveData {
|
||||
|
||||
Project project = files.iterator().next().getProject();
|
||||
AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(
|
||||
project, files, Collections.<AnalyzerScriptParameter>emptyList(), Predicates.<PsiFile>alwaysTrue());
|
||||
project, files, Predicates.<PsiFile>alwaysTrue());
|
||||
return analyzeExhaust.getBindingContext();
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public abstract class AbstractResolvedCallsTest() : JetLiteFixture() {
|
||||
|
||||
fun analyzeFileAndGetResolvedCallEntries(): Map<JetElement, ResolvedCall<*>> {
|
||||
val psiFile = JetTestUtils.loadJetFile(getProject(), file)
|
||||
val analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(psiFile, Collections.emptyList())
|
||||
val analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(psiFile)
|
||||
val bindingContext = analyzeExhaust.getBindingContext()
|
||||
return bindingContext.getSliceContents(BindingContext.RESOLVED_CALL)
|
||||
}
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ abstract public class AbstractConstraintSystemTest() : JetLiteFixture() {
|
||||
val fileName = "declarations/declarations.kt"
|
||||
|
||||
val psiFile = createPsiFile(null, fileName, loadFile(fileName))
|
||||
val analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(psiFile, Collections.emptyList<AnalyzerScriptParameter>())!!
|
||||
val analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(psiFile)
|
||||
val bindingContext = analyzeExhaust.getBindingContext()
|
||||
return MyDeclarations(bindingContext, getProject(), typeResolver)
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.jetbrains.jet.di.InjectorForTests;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.MutableClassDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorResolver;
|
||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
||||
@@ -37,7 +36,6 @@ import org.jetbrains.jet.lang.resolve.scopes.WritableScope;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.WritableScopeImpl;
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class JetDefaultModalityModifiersTest extends JetLiteFixture {
|
||||
@@ -81,8 +79,8 @@ public class JetDefaultModalityModifiersTest extends JetLiteFixture {
|
||||
List<JetDeclaration> declarations = file.getDeclarations();
|
||||
JetDeclaration aClass = declarations.get(0);
|
||||
assert aClass instanceof JetClass;
|
||||
AnalyzeExhaust bindingContext = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(file,
|
||||
Collections.<AnalyzerScriptParameter>emptyList());
|
||||
AnalyzeExhaust bindingContext = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(file
|
||||
);
|
||||
DeclarationDescriptor classDescriptor = bindingContext.getBindingContext().get(BindingContext.DECLARATION_TO_DESCRIPTOR, aClass);
|
||||
WritableScopeImpl scope = new WritableScopeImpl(
|
||||
libraryScope, root, RedeclarationHandler.DO_NOTHING, "JetDefaultModalityModifiersTest");
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.intellij.psi.util.PsiModificationTracker;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.analyzer.AnalyzeExhaust;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTraceContext;
|
||||
@@ -36,8 +35,6 @@ import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
import org.jetbrains.jet.lang.resolve.java.JetFilesProvider;
|
||||
import org.jetbrains.jet.plugin.project.TargetPlatform;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
class JvmDeclarationsCacheProvider extends DeclarationsCacheProvider {
|
||||
private final CachedValueProvider<KotlinDeclarationsCache> declarationsProvider;
|
||||
private final Key<CachedValue<KotlinDeclarationsCache>> cachedKey;
|
||||
@@ -65,7 +62,6 @@ class JvmDeclarationsCacheProvider extends DeclarationsCacheProvider {
|
||||
project,
|
||||
JetFilesProvider.getInstance(project).allInScope(GlobalSearchScope.allScope(project)),
|
||||
incompleteTrace,
|
||||
Collections.<AnalyzerScriptParameter>emptyList(),
|
||||
Predicates.<PsiFile>alwaysFalse(),
|
||||
true);
|
||||
}
|
||||
|
||||
@@ -198,7 +198,6 @@ public final class AnalyzerFacadeWithCache {
|
||||
fileToCache.getProject(),
|
||||
Collections.singleton(fileToCache),
|
||||
new BindingTraceContext(),
|
||||
Collections.<AnalyzerScriptParameter>emptyList(),
|
||||
Predicates.<PsiFile>alwaysFalse(),
|
||||
true,
|
||||
AnalyzerFacadeForJVM.createJavaModule("<module>"),
|
||||
@@ -218,7 +217,6 @@ public final class AnalyzerFacadeWithCache {
|
||||
// Need to resolve bodies in given file and all in the same package
|
||||
return AnalyzerFacadeProvider.getAnalyzerFacadeForFile(file).analyzeBodiesInFiles(
|
||||
file.getProject(),
|
||||
Collections.<AnalyzerScriptParameter>emptyList(),
|
||||
new JetFilesProvider.SameJetFilePredicate(file),
|
||||
new DelegatingBindingTrace(analyzeExhaustHeaders.getBindingContext(),
|
||||
"trace to resolve bodies in file", file.getName()),
|
||||
|
||||
@@ -24,14 +24,12 @@ import org.jetbrains.jet.analyzer.AnalyzeExhaust;
|
||||
import org.jetbrains.jet.analyzer.AnalyzerFacade;
|
||||
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.BodiesResolveContext;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.ResolveSession;
|
||||
import org.jetbrains.k2js.analyze.AnalyzerFacadeForJS;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public enum JSAnalyzerFacadeForIDEA implements AnalyzerFacade {
|
||||
|
||||
@@ -45,7 +43,6 @@ public enum JSAnalyzerFacadeForIDEA implements AnalyzerFacade {
|
||||
public AnalyzeExhaust analyzeFiles(
|
||||
@NotNull Project project,
|
||||
@NotNull Collection<JetFile> files,
|
||||
@NotNull List<AnalyzerScriptParameter> scriptParameters,
|
||||
@NotNull Predicate<PsiFile> filesToAnalyzeCompletely
|
||||
) {
|
||||
return AnalyzerFacadeForJS.analyzeFiles(files, filesToAnalyzeCompletely, new IDEAConfig(project), true);
|
||||
@@ -55,7 +52,6 @@ public enum JSAnalyzerFacadeForIDEA implements AnalyzerFacade {
|
||||
@Override
|
||||
public AnalyzeExhaust analyzeBodiesInFiles(
|
||||
@NotNull Project project,
|
||||
@NotNull List<AnalyzerScriptParameter> scriptParameters,
|
||||
@NotNull Predicate<PsiFile> filesForBodiesResolve,
|
||||
@NotNull BindingTrace traceContext,
|
||||
@NotNull BodiesResolveContext bodiesResolveContext,
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.jetbrains.jet.lang.resolve.lazy.descriptors.LazyPackageDescriptor;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.WritableScope;
|
||||
import org.jetbrains.jet.lang.types.TypeConstructor;
|
||||
import org.jetbrains.jet.storage.ExceptionTracker;
|
||||
import org.jetbrains.jet.storage.LazyResolveStorageManager;
|
||||
@@ -336,7 +335,7 @@ public class ResolveElementCache {
|
||||
private static TopDownAnalysisParameters createParameters(@NotNull ResolveSession resolveSession) {
|
||||
return new TopDownAnalysisParameters(
|
||||
resolveSession.getStorageManager(), resolveSession.getExceptionTracker(),
|
||||
Predicates.<PsiFile>alwaysTrue(), false, true, Collections.<AnalyzerScriptParameter>emptyList());
|
||||
Predicates.<PsiFile>alwaysTrue(), false, true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.jetbrains.jet.analyzer.AnalyzeExhaust;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BodiesResolveContext;
|
||||
import org.jetbrains.jet.lang.resolve.DelegatingBindingTrace;
|
||||
@@ -37,7 +36,6 @@ import org.jetbrains.jet.plugin.project.AnalyzerFacadeProvider;
|
||||
import org.jetbrains.jet.plugin.project.PluginJetFilesProvider;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
public class MigrateSureInProjectFix extends JetIntentionAction<PsiElement> {
|
||||
public MigrateSureInProjectFix(@NotNull PsiElement element) {
|
||||
@@ -149,7 +147,6 @@ public class MigrateSureInProjectFix extends JetIntentionAction<PsiElement> {
|
||||
AnalyzeExhaust analyzeExhaustHeaders = AnalyzerFacadeProvider.getAnalyzerFacadeForFile(initialFile).analyzeFiles(
|
||||
initialFile.getProject(),
|
||||
files,
|
||||
Collections.<AnalyzerScriptParameter>emptyList(),
|
||||
Predicates.<PsiFile>alwaysFalse());
|
||||
|
||||
BodiesResolveContext context = analyzeExhaustHeaders.getBodiesResolveContext();
|
||||
@@ -158,7 +155,6 @@ public class MigrateSureInProjectFix extends JetIntentionAction<PsiElement> {
|
||||
// Need to resolve bodies in given file and all in the same package
|
||||
return AnalyzerFacadeProvider.getAnalyzerFacadeForFile(initialFile).analyzeBodiesInFiles(
|
||||
initialFile.getProject(),
|
||||
Collections.<AnalyzerScriptParameter>emptyList(),
|
||||
Predicates.<PsiFile>alwaysTrue(),
|
||||
new DelegatingBindingTrace(analyzeExhaustHeaders.getBindingContext(), "trace in migrate sure fix"),
|
||||
context,
|
||||
|
||||
@@ -91,7 +91,7 @@ public class BuiltInsReferenceResolver extends AbstractProjectComponent {
|
||||
TopDownAnalysisParameters topDownAnalysisParameters = new TopDownAnalysisParameters(
|
||||
globalContext.getStorageManager(),
|
||||
globalContext.getExceptionTracker(),
|
||||
Predicates.<PsiFile>alwaysFalse(), true, false, Collections.<AnalyzerScriptParameter>emptyList());
|
||||
Predicates.<PsiFile>alwaysFalse(), true, false);
|
||||
ModuleDescriptorImpl module = new ModuleDescriptorImpl(
|
||||
Name.special("<fake_module>"), Collections.<ImportPath>emptyList(), PlatformToKotlinClassMap.EMPTY);
|
||||
BindingTraceContext trace = new BindingTraceContext();
|
||||
|
||||
@@ -32,14 +32,12 @@ import org.jetbrains.jet.lang.diagnostics.Diagnostic;
|
||||
import org.jetbrains.jet.lang.diagnostics.Errors;
|
||||
import org.jetbrains.jet.lang.diagnostics.rendering.DefaultErrorMessages;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -82,7 +80,7 @@ public abstract class AbstractDiagnosticMessageTest extends JetLiteFixture {
|
||||
MessageType messageType = getMessageTypeDirective(directives);
|
||||
|
||||
JetFile psiFile = createPsiFile(null, fileName, loadFile(fileName));
|
||||
AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(psiFile, Collections.<AnalyzerScriptParameter>emptyList());
|
||||
AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(psiFile);
|
||||
BindingContext bindingContext = analyzeExhaust.getBindingContext();
|
||||
|
||||
List<Diagnostic> diagnostics = ContainerUtil.filter(bindingContext.getDiagnostics().all(), new Condition<Diagnostic>() {
|
||||
|
||||
@@ -42,7 +42,6 @@ import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
import org.jetbrains.k2js.config.Config;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.jet.lang.resolve.lazy.declarations.DeclarationProviderFactoryService.createDeclarationProviderFactory;
|
||||
@@ -93,7 +92,7 @@ public final class AnalyzerFacadeForJS {
|
||||
|
||||
GlobalContextImpl globalContext = ContextPackage.GlobalContext();
|
||||
TopDownAnalysisParameters topDownAnalysisParameters = new TopDownAnalysisParameters(
|
||||
globalContext.getStorageManager(), globalContext.getExceptionTracker(), completely, false, false, Collections.<AnalyzerScriptParameter>emptyList());
|
||||
globalContext.getStorageManager(), globalContext.getExceptionTracker(), completely, false, false);
|
||||
|
||||
ModuleDescriptor libraryModule = config.getLibraryModule();
|
||||
if (libraryModule != null) {
|
||||
@@ -131,7 +130,7 @@ public final class AnalyzerFacadeForJS {
|
||||
Predicate<PsiFile> completely = Predicates.and(notLibFiles(config.getLibFiles()), filesToAnalyzeCompletely);
|
||||
|
||||
return AnalyzerFacadeForEverything.analyzeBodiesInFilesWithJavaIntegration(
|
||||
config.getProject(), Collections.<AnalyzerScriptParameter>emptyList(), completely, traceContext, bodiesResolveContext,
|
||||
config.getProject(), completely, traceContext, bodiesResolveContext,
|
||||
module);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user