Removed CompilerSpecialMode from JetCoreEnvironment.
This commit is contained in:
@@ -26,7 +26,6 @@ import org.jetbrains.jet.cli.common.messages.MessageCollector;
|
||||
import org.jetbrains.jet.codegen.BuiltinToJavaTypesMapping;
|
||||
import org.jetbrains.jet.config.CompilerConfiguration;
|
||||
import org.jetbrains.jet.lang.BuiltinsScopeExtensionMode;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.utils.PathUtil;
|
||||
|
||||
import java.io.File;
|
||||
@@ -71,8 +70,8 @@ public class BytecodeCompiler {
|
||||
configuration.putUserData(JVMConfigurationKeys.CLASSPATH_KEY, classpathItems.toArray(new File[classpathItems.size()]));
|
||||
configuration.putUserData(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, new File[]{PathUtil.getJdkAnnotationsPath()});
|
||||
|
||||
JetCoreEnvironment environment = new JetCoreEnvironment(CompileEnvironmentUtil.createMockDisposable(), configuration,
|
||||
CompilerSpecialMode.REGULAR);
|
||||
JetCoreEnvironment environment = new JetCoreEnvironment(CompileEnvironmentUtil.createMockDisposable(), configuration
|
||||
);
|
||||
K2JVMCompileEnvironmentConfiguration
|
||||
env = new K2JVMCompileEnvironmentConfiguration(environment, MessageCollector.PLAIN_TEXT_TO_SYSTEM_ERR, false,
|
||||
BuiltinsScopeExtensionMode.ALL, false, BuiltinToJavaTypesMapping.ENABLED);
|
||||
|
||||
@@ -66,11 +66,11 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments, K2JVMComp
|
||||
arguments.freeArgs.isEmpty() &&
|
||||
(argumentsSourceDirs == null || argumentsSourceDirs.size() == 0)) {
|
||||
|
||||
ReplFromTerminal.run(rootDisposable, compilerConfiguration, mode);
|
||||
ReplFromTerminal.run(rootDisposable, compilerConfiguration);
|
||||
return ExitCode.OK;
|
||||
}
|
||||
|
||||
JetCoreEnvironment environment = JetCoreEnvironment.createCoreEnvironmentForJVM(rootDisposable, compilerConfiguration, mode);
|
||||
JetCoreEnvironment environment = JetCoreEnvironment.createCoreEnvironmentForJVM(rootDisposable, compilerConfiguration);
|
||||
boolean builtins = mode == CompilerSpecialMode.BUILTINS;
|
||||
K2JVMCompileEnvironmentConfiguration configuration = new K2JVMCompileEnvironmentConfiguration(
|
||||
environment, messageCollector, arguments.script,
|
||||
|
||||
@@ -143,8 +143,8 @@ public class CompileEnvironmentUtil {
|
||||
}
|
||||
};
|
||||
CompilerConfiguration configuration = CompilerConfigurationUtl.getDefaultConfiguration(CompilerSpecialMode.REGULAR);
|
||||
JetCoreEnvironment scriptEnvironment = JetCoreEnvironment.createCoreEnvironmentForJVM(disposable, configuration,
|
||||
CompilerSpecialMode.REGULAR);
|
||||
JetCoreEnvironment scriptEnvironment = JetCoreEnvironment.createCoreEnvironmentForJVM(disposable, configuration
|
||||
);
|
||||
scriptEnvironment.addSources(moduleScriptFile);
|
||||
|
||||
GenerationState generationState = KotlinToJVMBytecodeCompiler
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.jetbrains.jet.config.CompilerConfiguration;
|
||||
import org.jetbrains.jet.lang.parsing.JetParser;
|
||||
import org.jetbrains.jet.lang.parsing.JetParserDefinition;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.lang.resolve.java.JetFilesProvider;
|
||||
import org.jetbrains.jet.lang.resolve.java.extAnnotations.CoreAnnotationsProvider;
|
||||
import org.jetbrains.jet.lang.resolve.java.extAnnotations.ExternalAnnotationsProvider;
|
||||
@@ -55,24 +54,17 @@ public class JetCoreEnvironment extends JavaCoreEnvironment {
|
||||
|
||||
@NotNull
|
||||
public static JetCoreEnvironment createCoreEnvironmentForJS(Disposable disposable) {
|
||||
return new JetCoreEnvironment(disposable, new CompilerConfiguration(), CompilerSpecialMode.JS);
|
||||
return new JetCoreEnvironment(disposable, new CompilerConfiguration());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static JetCoreEnvironment createCoreEnvironmentForJVM(Disposable disposable, @NotNull CompilerConfiguration configuration,
|
||||
@NotNull CompilerSpecialMode compilerSpecialMode) {
|
||||
return new JetCoreEnvironment(disposable, configuration, compilerSpecialMode);
|
||||
public static JetCoreEnvironment createCoreEnvironmentForJVM(Disposable disposable, @NotNull CompilerConfiguration configuration) {
|
||||
return new JetCoreEnvironment(disposable, configuration);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private final CompilerSpecialMode compilerSpecialMode;
|
||||
|
||||
public JetCoreEnvironment(Disposable parentDisposable, @NotNull CompilerConfiguration configuration,
|
||||
@NotNull CompilerSpecialMode compilerSpecialMode) {
|
||||
public JetCoreEnvironment(Disposable parentDisposable, @NotNull CompilerConfiguration configuration) {
|
||||
super(parentDisposable);
|
||||
|
||||
this.compilerSpecialMode = compilerSpecialMode;
|
||||
|
||||
registerFileType(JetFileType.INSTANCE, "kt");
|
||||
registerFileType(JetFileType.INSTANCE, "kts");
|
||||
registerFileType(JetFileType.INSTANCE, "ktm");
|
||||
@@ -175,11 +167,6 @@ public class JetCoreEnvironment extends JavaCoreEnvironment {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public CompilerSpecialMode getCompilerSpecialMode() {
|
||||
return compilerSpecialMode;
|
||||
}
|
||||
|
||||
public void configure(@NotNull CompilerConfiguration compilerConfiguration) {
|
||||
File[] classpath = compilerConfiguration.getUserData(JVMConfigurationKeys.CLASSPATH_KEY);
|
||||
File[] annotationsPath = compilerConfiguration.getUserData(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY);
|
||||
|
||||
@@ -22,7 +22,6 @@ import jline.console.ConsoleReader;
|
||||
import jline.console.history.FileHistory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.config.CompilerConfiguration;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.utils.ExceptionUtils;
|
||||
|
||||
import java.io.File;
|
||||
@@ -43,13 +42,12 @@ public class ReplFromTerminal {
|
||||
|
||||
public ReplFromTerminal(
|
||||
@NotNull final Disposable disposable,
|
||||
@NotNull final CompilerConfiguration compilerConfiguration,
|
||||
@NotNull final CompilerSpecialMode mode) {
|
||||
@NotNull final CompilerConfiguration compilerConfiguration) {
|
||||
new Thread("initialize-repl") {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
replInterpreter = new ReplInterpreter(disposable, compilerConfiguration, mode);
|
||||
replInterpreter = new ReplInterpreter(disposable, compilerConfiguration);
|
||||
} catch (Throwable e) {
|
||||
replInitializationFailed = e;
|
||||
}
|
||||
@@ -195,9 +193,8 @@ public class ReplFromTerminal {
|
||||
return Arrays.asList(command.split(" "));
|
||||
}
|
||||
|
||||
public static void run(@NotNull Disposable disposable, @NotNull CompilerConfiguration configuration,
|
||||
@NotNull CompilerSpecialMode mode) {
|
||||
new ReplFromTerminal(disposable, configuration, mode).doRun();
|
||||
public static void run(@NotNull Disposable disposable, @NotNull CompilerConfiguration configuration) {
|
||||
new ReplFromTerminal(disposable, configuration).doRun();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ import org.jetbrains.jet.lang.descriptors.NamespaceLikeBuilderDummy;
|
||||
import org.jetbrains.jet.lang.descriptors.ScriptDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.*;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
@@ -91,8 +90,8 @@ public class ReplInterpreter {
|
||||
@NotNull
|
||||
private final ModuleDescriptor module;
|
||||
|
||||
public ReplInterpreter(@NotNull Disposable disposable, @NotNull CompilerConfiguration configuration, @NotNull CompilerSpecialMode mode) {
|
||||
jetCoreEnvironment = new JetCoreEnvironment(disposable, configuration, mode);
|
||||
public ReplInterpreter(@NotNull Disposable disposable, @NotNull CompilerConfiguration configuration) {
|
||||
jetCoreEnvironment = new JetCoreEnvironment(disposable, configuration);
|
||||
jetCoreEnvironment.configure(configuration);
|
||||
Project project = jetCoreEnvironment.getProject();
|
||||
trace = new BindingTraceContext();
|
||||
|
||||
@@ -182,8 +182,8 @@ public class JetTestUtils {
|
||||
|
||||
public static JetCoreEnvironment createEnvironmentWithMockJdkAndIdeaAnnotations(Disposable disposable, @NotNull CompilerSpecialMode compilerSpecialMode) {
|
||||
JetCoreEnvironment environment = new JetCoreEnvironment(disposable,
|
||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(compilerSpecialMode, true),
|
||||
compilerSpecialMode);
|
||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(compilerSpecialMode, true)
|
||||
);
|
||||
environment.addToClasspath(getAnnotationsJar());
|
||||
return environment;
|
||||
}
|
||||
@@ -255,8 +255,8 @@ public class JetTestUtils {
|
||||
|
||||
public static JetCoreEnvironment createEnvironmentWithFullJdk(Disposable disposable) {
|
||||
return new JetCoreEnvironment(disposable,
|
||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(CompilerSpecialMode.REGULAR, false),
|
||||
CompilerSpecialMode.REGULAR);
|
||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(CompilerSpecialMode.REGULAR, false)
|
||||
);
|
||||
}
|
||||
|
||||
public static PsiFile createFile(@NonNls String name, String text, @NotNull Project project) {
|
||||
|
||||
+1
-1
@@ -152,7 +152,7 @@ public class ResolveDescriptorsFromExternalLibraries {
|
||||
else {
|
||||
CompilerConfiguration configuration =
|
||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(CompilerSpecialMode.STDLIB, false);
|
||||
jetCoreEnvironment = JetCoreEnvironment.createCoreEnvironmentForJVM(junk, configuration, CompilerSpecialMode.STDLIB);
|
||||
jetCoreEnvironment = JetCoreEnvironment.createCoreEnvironmentForJVM(junk, configuration);
|
||||
if (!PathUtil.findRtJar().equals(jar)) {
|
||||
throw new RuntimeException("rt.jar mismatch: " + jar + ", " + PathUtil.findRtJar());
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ public abstract class AbstractLazyResolveTest {
|
||||
};
|
||||
|
||||
protected final JetCoreEnvironment jetCoreEnvironment = new JetCoreEnvironment(rootDisposable,
|
||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(CompilerSpecialMode.JDK_HEADERS, true),
|
||||
CompilerSpecialMode.JDK_HEADERS);
|
||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(CompilerSpecialMode.JDK_HEADERS, true)
|
||||
);
|
||||
protected final Project project = jetCoreEnvironment.getProject();
|
||||
|
||||
@BeforeClass
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ReplInterpreterTest {
|
||||
File[] classpath = configuration.getUserData(JVMConfigurationKeys.CLASSPATH_KEY);
|
||||
assert classpath != null;
|
||||
configuration.putUserData(JVMConfigurationKeys.CLASSPATH_KEY, ArrayUtil.append(classpath, new File("out/production/runtime")));
|
||||
ReplInterpreter repl = new ReplInterpreter(disposable, configuration, CompilerSpecialMode.JDK_HEADERS);
|
||||
ReplInterpreter repl = new ReplInterpreter(disposable, configuration);
|
||||
|
||||
ReplSessionTestFile file = ReplSessionTestFile.load(new File("compiler/testData/repl/" + relativePath));
|
||||
for (ReplSessionTestFile.OneLine t : file.getLines()) {
|
||||
|
||||
@@ -53,7 +53,7 @@ public abstract class TestWithEnvironment extends UsefulTestCase {
|
||||
protected void createEnvironmentWithMockJdkAndIdeaAnnotations() {
|
||||
myEnvironment = JetCoreEnvironment.createCoreEnvironmentForJVM(
|
||||
getTestRootDisposable(),
|
||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(CompilerSpecialMode.JS, true),
|
||||
CompilerSpecialMode.JS);
|
||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(CompilerSpecialMode.JS, true)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user