Removed CompilerSpecialMode from JetCoreEnvironment.
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user