rename Jet* classes to Kt*
This commit is contained in:
@@ -18,14 +18,14 @@ package org.jetbrains.kotlin.cli.common;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.psi.KtFile;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents the context of available state in which a {@link CompilerPlugin} runs such as
|
||||
* the {@link Project}, the {@link BindingContext} and the underlying {@link JetFile} files.
|
||||
* the {@link Project}, the {@link BindingContext} and the underlying {@link KtFile} files.
|
||||
*/
|
||||
public class CompilerPluginContext {
|
||||
@NotNull
|
||||
@@ -34,9 +34,9 @@ public class CompilerPluginContext {
|
||||
@NotNull
|
||||
private final BindingContext context;
|
||||
@NotNull
|
||||
private final List<JetFile> files;
|
||||
private final List<KtFile> files;
|
||||
|
||||
public CompilerPluginContext(Project project, BindingContext context, List<JetFile> files) {
|
||||
public CompilerPluginContext(Project project, BindingContext context, List<KtFile> files) {
|
||||
this.project = project;
|
||||
this.context = context;
|
||||
this.files = files;
|
||||
@@ -48,7 +48,7 @@ public class CompilerPluginContext {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<JetFile> getFiles() {
|
||||
public List<KtFile> getFiles() {
|
||||
return files;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -34,7 +34,7 @@ import org.jetbrains.kotlin.load.java.JavaBindingContext;
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi;
|
||||
import org.jetbrains.kotlin.load.java.components.TraceBasedErrorReporter;
|
||||
import org.jetbrains.kotlin.load.java.components.TraceBasedErrorReporter.AbiVersionErrorData;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.psi.KtFile;
|
||||
import org.jetbrains.kotlin.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
|
||||
@@ -195,8 +195,8 @@ public final class AnalyzerWithCompilerReport {
|
||||
return reportDiagnostics(diagnostics, new DefaultDiagnosticReporter(messageCollector), false);
|
||||
}
|
||||
|
||||
private void reportSyntaxErrors(@NotNull Collection<JetFile> files) {
|
||||
for (JetFile file : files) {
|
||||
private void reportSyntaxErrors(@NotNull Collection<KtFile> files) {
|
||||
for (KtFile file : files) {
|
||||
reportSyntaxErrors(file, messageCollector);
|
||||
}
|
||||
}
|
||||
@@ -262,7 +262,7 @@ public final class AnalyzerWithCompilerReport {
|
||||
return messageCollector.anyReported(CompilerMessageSeverity.ERROR);
|
||||
}
|
||||
|
||||
public void analyzeAndReport(@NotNull Collection<JetFile> files, @NotNull Function0<AnalysisResult> analyzer) {
|
||||
public void analyzeAndReport(@NotNull Collection<KtFile> files, @NotNull Function0<AnalysisResult> analyzer) {
|
||||
analysisResult = analyzer.invoke();
|
||||
reportSyntaxErrors(files);
|
||||
List<AbiVersionErrorData> abiVersionErrors = getAbiVersionErrors();
|
||||
|
||||
@@ -54,7 +54,7 @@ import org.jetbrains.kotlin.js.config.LibrarySourcesConfig;
|
||||
import org.jetbrains.kotlin.js.facade.K2JSTranslator;
|
||||
import org.jetbrains.kotlin.js.facade.MainCallParameters;
|
||||
import org.jetbrains.kotlin.js.facade.TranslationResult;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.psi.KtFile;
|
||||
import org.jetbrains.kotlin.utils.PathUtil;
|
||||
|
||||
import java.io.File;
|
||||
@@ -105,7 +105,7 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
|
||||
KotlinCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.JS_CONFIG_FILES);
|
||||
|
||||
Project project = environmentForJS.getProject();
|
||||
List<JetFile> sourcesFiles = environmentForJS.getSourceFiles();
|
||||
List<KtFile> sourcesFiles = environmentForJS.getSourceFiles();
|
||||
|
||||
if (arguments.outputFile == null) {
|
||||
messageSeverityCollector.report(CompilerMessageSeverity.ERROR, "Specify output file via -output", CompilerMessageLocation.NO_LOCATION);
|
||||
@@ -210,10 +210,10 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
|
||||
return OK;
|
||||
}
|
||||
|
||||
private static void reportCompiledSourcesList(@NotNull MessageCollector messageCollector, @NotNull List<JetFile> sourceFiles) {
|
||||
Iterable<String> fileNames = ContainerUtil.map(sourceFiles, new Function<JetFile, String>() {
|
||||
private static void reportCompiledSourcesList(@NotNull MessageCollector messageCollector, @NotNull List<KtFile> sourceFiles) {
|
||||
Iterable<String> fileNames = ContainerUtil.map(sourceFiles, new Function<KtFile, String>() {
|
||||
@Override
|
||||
public String fun(@Nullable JetFile file) {
|
||||
public String fun(@Nullable KtFile file) {
|
||||
assert file != null;
|
||||
VirtualFile virtualFile = file.getVirtualFile();
|
||||
if (virtualFile != null) {
|
||||
@@ -227,7 +227,7 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
|
||||
}
|
||||
|
||||
private static AnalyzerWithCompilerReport analyzeAndReportErrors(@NotNull MessageCollector messageCollector,
|
||||
@NotNull final List<JetFile> sources, @NotNull final Config config) {
|
||||
@NotNull final List<KtFile> sources, @NotNull final Config config) {
|
||||
AnalyzerWithCompilerReport analyzerWithCompilerReport = new AnalyzerWithCompilerReport(messageCollector);
|
||||
analyzerWithCompilerReport.analyzeAndReport(sources, new Function0<AnalysisResult>() {
|
||||
@Override
|
||||
|
||||
+20
-20
@@ -36,15 +36,15 @@ import org.jetbrains.kotlin.descriptors.PackageViewDescriptor
|
||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil
|
||||
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.JetClassOrObject
|
||||
import org.jetbrains.kotlin.psi.JetDeclaration
|
||||
import org.jetbrains.kotlin.psi.JetFile
|
||||
import org.jetbrains.kotlin.psi.JetPsiUtil
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.KtPsiUtil
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.resolve.lazy.KotlinCodeAnalyzer
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSessionUtils
|
||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.KtScope
|
||||
import org.jetbrains.kotlin.util.slicedMap.ReadOnlySlice
|
||||
import org.jetbrains.kotlin.util.slicedMap.WritableSlice
|
||||
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
||||
@@ -79,11 +79,11 @@ public class CliLightClassGenerationSupport(project: Project) : LightClassGenera
|
||||
trace.setKotlinCodeAnalyzer(codeAnalyzer)
|
||||
}
|
||||
|
||||
override fun getContextForPackage(files: Collection<JetFile>): LightClassConstructionContext {
|
||||
override fun getContextForPackage(files: Collection<KtFile>): LightClassConstructionContext {
|
||||
return getContext()
|
||||
}
|
||||
|
||||
override fun getContextForClassOrObject(classOrObject: JetClassOrObject): LightClassConstructionContext {
|
||||
override fun getContextForClassOrObject(classOrObject: KtClassOrObject): LightClassConstructionContext {
|
||||
return getContext()
|
||||
}
|
||||
|
||||
@@ -91,29 +91,29 @@ public class CliLightClassGenerationSupport(project: Project) : LightClassGenera
|
||||
return LightClassConstructionContext(bindingContext, module)
|
||||
}
|
||||
|
||||
override fun findClassOrObjectDeclarations(fqName: FqName, searchScope: GlobalSearchScope): Collection<JetClassOrObject> {
|
||||
override fun findClassOrObjectDeclarations(fqName: FqName, searchScope: GlobalSearchScope): Collection<KtClassOrObject> {
|
||||
return ResolveSessionUtils.getClassDescriptorsByFqName(module, fqName).map {
|
||||
val element = DescriptorToSourceUtils.getSourceFromDescriptor(it)
|
||||
if (element is JetClassOrObject && PsiSearchScopeUtil.isInScope(searchScope, element)) {
|
||||
if (element is KtClassOrObject && PsiSearchScopeUtil.isInScope(searchScope, element)) {
|
||||
element
|
||||
}
|
||||
else null
|
||||
}.filterNotNull()
|
||||
}
|
||||
|
||||
override fun findFilesForPackage(fqName: FqName, searchScope: GlobalSearchScope): Collection<JetFile> {
|
||||
override fun findFilesForPackage(fqName: FqName, searchScope: GlobalSearchScope): Collection<KtFile> {
|
||||
return bindingContext.get(BindingContext.PACKAGE_TO_FILES, fqName)?.filter {
|
||||
PsiSearchScopeUtil.isInScope(searchScope, it)
|
||||
} ?: emptyList()
|
||||
}
|
||||
|
||||
override fun findClassOrObjectDeclarationsInPackage(
|
||||
packageFqName: FqName, searchScope: GlobalSearchScope): Collection<JetClassOrObject> {
|
||||
packageFqName: FqName, searchScope: GlobalSearchScope): Collection<KtClassOrObject> {
|
||||
val files = findFilesForPackage(packageFqName, searchScope)
|
||||
val result = SmartList<JetClassOrObject>()
|
||||
val result = SmartList<KtClassOrObject>()
|
||||
for (file in files) {
|
||||
for (declaration in file.declarations) {
|
||||
if (declaration is JetClassOrObject) {
|
||||
if (declaration is KtClassOrObject) {
|
||||
result.add(declaration)
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class CliLightClassGenerationSupport(project: Project) : LightClassGenera
|
||||
|
||||
override fun getSubPackages(fqn: FqName, scope: GlobalSearchScope): Collection<FqName> {
|
||||
val packageView = module.getPackage(fqn)
|
||||
val members = packageView.memberScope.getDescriptors(DescriptorKindFilter.PACKAGES, JetScope.ALL_NAME_FILTER)
|
||||
val members = packageView.memberScope.getDescriptors(DescriptorKindFilter.PACKAGES, KtScope.ALL_NAME_FILTER)
|
||||
return ContainerUtil.mapNotNull(members, object : Function<DeclarationDescriptor, FqName> {
|
||||
override fun `fun`(member: DeclarationDescriptor): FqName? {
|
||||
if (member is PackageViewDescriptor) {
|
||||
@@ -138,11 +138,11 @@ public class CliLightClassGenerationSupport(project: Project) : LightClassGenera
|
||||
})
|
||||
}
|
||||
|
||||
override fun getPsiClass(classOrObject: JetClassOrObject): PsiClass? {
|
||||
override fun getPsiClass(classOrObject: KtClassOrObject): PsiClass? {
|
||||
return KotlinLightClassForExplicitDeclaration.create(psiManager, classOrObject)
|
||||
}
|
||||
|
||||
override fun resolveClassToDescriptor(classOrObject: JetClassOrObject): ClassDescriptor? {
|
||||
override fun resolveClassToDescriptor(classOrObject: KtClassOrObject): ClassDescriptor? {
|
||||
return bindingContext.get(BindingContext.CLASS, classOrObject)
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ public class CliLightClassGenerationSupport(project: Project) : LightClassGenera
|
||||
KotlinLightClassForFacade.createForFacade(psiManager, facadeFqName, scope, filesForFacade))
|
||||
}
|
||||
|
||||
override fun findFilesForFacade(facadeFqName: FqName, scope: GlobalSearchScope): Collection<JetFile> {
|
||||
override fun findFilesForFacade(facadeFqName: FqName, scope: GlobalSearchScope): Collection<KtFile> {
|
||||
if (facadeFqName.isRoot) return emptyList()
|
||||
|
||||
return PackagePartClassUtils.getFilesWithCallables(findFilesForPackage(facadeFqName.parent(), scope)).filter {
|
||||
@@ -162,7 +162,7 @@ public class CliLightClassGenerationSupport(project: Project) : LightClassGenera
|
||||
}
|
||||
}
|
||||
|
||||
override fun getContextForFacade(files: Collection<JetFile>): LightClassConstructionContext {
|
||||
override fun getContextForFacade(files: Collection<KtFile>): LightClassConstructionContext {
|
||||
return getContext()
|
||||
}
|
||||
|
||||
@@ -200,8 +200,8 @@ public class CliLightClassGenerationSupport(project: Project) : LightClassGenera
|
||||
|
||||
if (value == null) {
|
||||
if (BindingContext.FUNCTION === slice || BindingContext.VARIABLE === slice) {
|
||||
if (key is JetDeclaration) {
|
||||
if (!JetPsiUtil.isLocal(key)) {
|
||||
if (key is KtDeclaration) {
|
||||
if (!KtPsiUtil.isLocal(key)) {
|
||||
kotlinCodeAnalyzer!!.resolveToDescriptor(key)
|
||||
return super.get<K, V>(slice, key)
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.KtType;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -35,7 +35,7 @@ public class CommandLineScriptUtils {
|
||||
|
||||
public static List<AnalyzerScriptParameter> scriptParameters() {
|
||||
KotlinBuiltIns builtIns = JvmPlatform.INSTANCE$.getBuiltIns();
|
||||
JetType arrayOfStrings = builtIns.getArrayType(INVARIANT, builtIns.getStringType());
|
||||
KtType arrayOfStrings = builtIns.getArrayType(INVARIANT, builtIns.getStringType());
|
||||
AnalyzerScriptParameter argsParameter = new AnalyzerScriptParameter(ARGS_NAME, arrayOfStrings);
|
||||
return Collections.singletonList(argsParameter);
|
||||
}
|
||||
|
||||
@@ -37,9 +37,9 @@ import org.jetbrains.kotlin.cli.common.messages.MessageCollector;
|
||||
import org.jetbrains.kotlin.cli.common.modules.ModuleScriptData;
|
||||
import org.jetbrains.kotlin.cli.common.modules.ModuleXmlParser;
|
||||
import org.jetbrains.kotlin.codegen.ClassFileFactory;
|
||||
import org.jetbrains.kotlin.idea.JetFileType;
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.psi.KtFile;
|
||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||
import org.jetbrains.kotlin.utils.PathUtil;
|
||||
|
||||
@@ -137,7 +137,7 @@ public class CompileEnvironmentUtil {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<JetFile> getJetFiles(
|
||||
public static List<KtFile> getJetFiles(
|
||||
@NotNull final Project project,
|
||||
@NotNull Collection<String> sourceRoots,
|
||||
@NotNull Function1<String, Unit> reportError
|
||||
@@ -145,7 +145,7 @@ public class CompileEnvironmentUtil {
|
||||
final VirtualFileSystem localFileSystem = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.FILE_PROTOCOL);
|
||||
|
||||
final Set<VirtualFile> processedFiles = Sets.newHashSet();
|
||||
final List<JetFile> result = Lists.newArrayList();
|
||||
final List<KtFile> result = Lists.newArrayList();
|
||||
|
||||
for (String sourceRootPath : sourceRoots) {
|
||||
if (sourceRootPath == null) {
|
||||
@@ -157,7 +157,7 @@ public class CompileEnvironmentUtil {
|
||||
reportError.invoke("Source file or directory not found: " + sourceRootPath);
|
||||
continue;
|
||||
}
|
||||
if (!vFile.isDirectory() && vFile.getFileType() != JetFileType.INSTANCE) {
|
||||
if (!vFile.isDirectory() && vFile.getFileType() != KotlinFileType.INSTANCE) {
|
||||
reportError.invoke("Source entry is not a Kotlin file: " + sourceRootPath);
|
||||
continue;
|
||||
}
|
||||
@@ -170,8 +170,8 @@ public class CompileEnvironmentUtil {
|
||||
if (virtualFile != null && !processedFiles.contains(virtualFile)) {
|
||||
processedFiles.add(virtualFile);
|
||||
PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
|
||||
if (psiFile instanceof JetFile) {
|
||||
result.add((JetFile) psiFile);
|
||||
if (psiFile instanceof KtFile) {
|
||||
result.add((KtFile) psiFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,13 +70,13 @@ import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.config.kotlinSourceRoots
|
||||
import org.jetbrains.kotlin.extensions.ExternalDeclarationsProvider
|
||||
import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor
|
||||
import org.jetbrains.kotlin.idea.JetFileType
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmVirtualFileFinderFactory
|
||||
import org.jetbrains.kotlin.load.kotlin.KotlinBinaryClassCache
|
||||
import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager
|
||||
import org.jetbrains.kotlin.parsing.JetParserDefinition
|
||||
import org.jetbrains.kotlin.parsing.JetScriptDefinitionProvider
|
||||
import org.jetbrains.kotlin.psi.JetFile
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.CodeAnalyzerInitializer
|
||||
import org.jetbrains.kotlin.resolve.jvm.KotlinJavaPsiFacade
|
||||
import org.jetbrains.kotlin.resolve.jvm.extensions.AnalysisCompletedHandlerExtension
|
||||
@@ -97,7 +97,7 @@ public class KotlinCoreEnvironment private constructor(
|
||||
registerProjectExtensionPoints(Extensions.getArea(getProject()))
|
||||
}
|
||||
}
|
||||
private val sourceFiles = ArrayList<JetFile>()
|
||||
private val sourceFiles = ArrayList<KtFile>()
|
||||
private val javaRoots = ArrayList<JavaRoot>()
|
||||
|
||||
public val configuration: CompilerConfiguration = configuration.copy().let {
|
||||
@@ -122,8 +122,8 @@ public class KotlinCoreEnvironment private constructor(
|
||||
message ->
|
||||
report(ERROR, message)
|
||||
}))
|
||||
sourceFiles.sortedWith(object : Comparator<JetFile> {
|
||||
override fun compare(o1: JetFile, o2: JetFile): Int {
|
||||
sourceFiles.sortedWith(object : Comparator<KtFile> {
|
||||
override fun compare(o1: KtFile, o2: KtFile): Int {
|
||||
return o1.getVirtualFile().getPath().compareTo(o2.getVirtualFile().getPath(), ignoreCase = true)
|
||||
}
|
||||
})
|
||||
@@ -154,7 +154,7 @@ public class KotlinCoreEnvironment private constructor(
|
||||
|
||||
public val sourceLinesOfCode: Int by lazy { countLinesOfCode(sourceFiles) }
|
||||
|
||||
public fun countLinesOfCode(sourceFiles: List<JetFile>): Int =
|
||||
public fun countLinesOfCode(sourceFiles: List<KtFile>): Int =
|
||||
sourceFiles.sumBy {
|
||||
val text = it.getText()
|
||||
StringUtil.getLineBreakCount(it.getText()) + (if (StringUtil.endsWithLineBreak(text)) 0 else 1)
|
||||
@@ -219,7 +219,7 @@ public class KotlinCoreEnvironment private constructor(
|
||||
return uniqueSourceRoots
|
||||
}
|
||||
|
||||
public fun getSourceFiles(): List<JetFile> = sourceFiles
|
||||
public fun getSourceFiles(): List<KtFile> = sourceFiles
|
||||
|
||||
private fun report(severity: CompilerMessageSeverity, message: String) {
|
||||
val messageCollector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
|
||||
@@ -351,8 +351,8 @@ public class KotlinCoreEnvironment private constructor(
|
||||
@JvmStatic
|
||||
public fun registerApplicationServices(applicationEnvironment: JavaCoreApplicationEnvironment) {
|
||||
with(applicationEnvironment) {
|
||||
registerFileType(JetFileType.INSTANCE, "kt")
|
||||
registerFileType(JetFileType.INSTANCE, JetParserDefinition.STD_SCRIPT_SUFFIX)
|
||||
registerFileType(KotlinFileType.INSTANCE, "kt")
|
||||
registerFileType(KotlinFileType.INSTANCE, JetParserDefinition.STD_SCRIPT_SUFFIX)
|
||||
registerParserDefinition(JetParserDefinition())
|
||||
getApplication().registerService(javaClass<KotlinBinaryClassCache>(), KotlinBinaryClassCache())
|
||||
getApplication().registerService(javaClass<JavaClassSupers>(), javaClass<JavaClassSupersImpl>())
|
||||
|
||||
+5
-6
@@ -47,7 +47,6 @@ import org.jetbrains.kotlin.context.ModuleContext;
|
||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil;
|
||||
import org.jetbrains.kotlin.idea.MainFunctionDetector;
|
||||
import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager;
|
||||
import org.jetbrains.kotlin.load.kotlin.PackageClassUtils;
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache;
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents;
|
||||
import org.jetbrains.kotlin.modules.Module;
|
||||
@@ -57,7 +56,7 @@ import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.parsing.JetScriptDefinition;
|
||||
import org.jetbrains.kotlin.parsing.JetScriptDefinitionProvider;
|
||||
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.psi.KtFile;
|
||||
import org.jetbrains.kotlin.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.BindingTraceContext;
|
||||
@@ -142,7 +141,7 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
|
||||
for (Module module : chunk) {
|
||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
|
||||
List<JetFile> jetFiles = CompileEnvironmentUtil.getJetFiles(
|
||||
List<KtFile> jetFiles = CompileEnvironmentUtil.getJetFiles(
|
||||
environment.getProject(), getAbsolutePaths(directory, module), new Function1<String, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(String s) {
|
||||
@@ -196,10 +195,10 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static FqName findMainClass(@NotNull GenerationState generationState, @NotNull List<JetFile> files) {
|
||||
private static FqName findMainClass(@NotNull GenerationState generationState, @NotNull List<KtFile> files) {
|
||||
MainFunctionDetector mainFunctionDetector = new MainFunctionDetector(generationState.getBindingContext());
|
||||
FqName mainClass = null;
|
||||
for (JetFile file : files) {
|
||||
for (KtFile file : files) {
|
||||
if (mainFunctionDetector.hasMain(file.getDeclarations())) {
|
||||
if (mainClass != null) {
|
||||
// more than one main
|
||||
@@ -357,7 +356,7 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
private static GenerationState generate(
|
||||
@NotNull KotlinCoreEnvironment environment,
|
||||
@NotNull AnalysisResult result,
|
||||
@NotNull List<JetFile> sourceFiles,
|
||||
@NotNull List<KtFile> sourceFiles,
|
||||
@Nullable Module module,
|
||||
File outputDirectory,
|
||||
String moduleName
|
||||
|
||||
@@ -58,8 +58,8 @@ import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl;
|
||||
import org.jetbrains.kotlin.idea.KotlinLanguage;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.parsing.JetParserDefinition;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.psi.JetScript;
|
||||
import org.jetbrains.kotlin.psi.KtFile;
|
||||
import org.jetbrains.kotlin.psi.KtScript;
|
||||
import org.jetbrains.kotlin.resolve.*;
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName;
|
||||
@@ -68,8 +68,8 @@ import org.jetbrains.kotlin.resolve.lazy.FileScopeProvider;
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession;
|
||||
import org.jetbrains.kotlin.resolve.lazy.data.JetClassLikeInfo;
|
||||
import org.jetbrains.kotlin.resolve.lazy.declarations.*;
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.resolve.scopes.KtScope;
|
||||
import org.jetbrains.kotlin.types.KtType;
|
||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||
import org.jetbrains.org.objectweb.asm.Type;
|
||||
|
||||
@@ -93,7 +93,7 @@ public class ReplInterpreter {
|
||||
private int lineNumber = 0;
|
||||
|
||||
@Nullable
|
||||
private JetScope lastLineScope;
|
||||
private KtScope lastLineScope;
|
||||
private final List<EarlierLine> earlierLines = Lists.newArrayList();
|
||||
private final List<String> previousIncompleteLines = Lists.newArrayList();
|
||||
private final ReplClassLoader classLoader;
|
||||
@@ -130,8 +130,8 @@ public class ReplInterpreter {
|
||||
FileScopeProvider.AdditionalScopes scopeProvider = new FileScopeProvider.AdditionalScopes() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<JetScope> getScopes() {
|
||||
return lastLineScope != null ? new SmartList<JetScope>(lastLineScope) : Collections.<JetScope>emptyList();
|
||||
public List<KtScope> getScopes() {
|
||||
return lastLineScope != null ? new SmartList<KtScope>(lastLineScope) : Collections.<KtScope>emptyList();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -275,7 +275,7 @@ public class ReplInterpreter {
|
||||
|
||||
LightVirtualFile virtualFile = new LightVirtualFile("line" + lineNumber + JetParserDefinition.STD_SCRIPT_EXT, KotlinLanguage.INSTANCE, fullText.toString());
|
||||
virtualFile.setCharset(CharsetToolkit.UTF8_CHARSET);
|
||||
JetFile psiFile = (JetFile) psiFileFactory.trySetupPsiForFile(virtualFile, KotlinLanguage.INSTANCE, true, false);
|
||||
KtFile psiFile = (KtFile) psiFileFactory.trySetupPsiForFile(virtualFile, KotlinLanguage.INSTANCE, true, false);
|
||||
assert psiFile != null : "Script file not analyzed at line " + lineNumber + ": " + fullText;
|
||||
|
||||
DiagnosticMessageHolder errorHolder = createDiagnosticHolder();
|
||||
@@ -356,7 +356,7 @@ public class ReplInterpreter {
|
||||
|
||||
earlierLines.add(new EarlierLine(line, scriptDescriptor, scriptClass, scriptInstance, scriptClassType));
|
||||
|
||||
JetType returnType = scriptDescriptor.getScriptCodeDescriptor().getReturnType();
|
||||
KtType returnType = scriptDescriptor.getScriptCodeDescriptor().getReturnType();
|
||||
return LineResult.successful(rv, returnType != null && KotlinBuiltIns.isUnit(returnType));
|
||||
}
|
||||
catch (Throwable e) {
|
||||
@@ -400,7 +400,7 @@ public class ReplInterpreter {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private ScriptDescriptor doAnalyze(@NotNull JetFile psiFile, @NotNull DiagnosticMessageReporter errorReporter) {
|
||||
private ScriptDescriptor doAnalyze(@NotNull KtFile psiFile, @NotNull DiagnosticMessageReporter errorReporter) {
|
||||
scriptDeclarationFactory.setDelegateFactory(
|
||||
new FileBasedDeclarationProviderFactory(resolveSession.getStorageManager(), Collections.singletonList(psiFile)));
|
||||
|
||||
@@ -442,7 +442,7 @@ public class ReplInterpreter {
|
||||
|
||||
PsiElement jetScript = descriptorToDeclaration(earlierDescriptor);
|
||||
if (jetScript != null) {
|
||||
registerClassNameForScript(state.getBindingTrace(), (JetScript) jetScript, earlierClassType, state.getFileClassesProvider());
|
||||
registerClassNameForScript(state.getBindingTrace(), (KtScript) jetScript, earlierClassType, state.getFileClassesProvider());
|
||||
earlierScriptDescriptors.add(earlierDescriptor);
|
||||
}
|
||||
}
|
||||
@@ -450,7 +450,7 @@ public class ReplInterpreter {
|
||||
}
|
||||
|
||||
public static void compileScript(
|
||||
@NotNull JetScript script,
|
||||
@NotNull KtScript script,
|
||||
@NotNull Type classType,
|
||||
@NotNull List<Pair<ScriptDescriptor, Type>> earlierScripts,
|
||||
@NotNull GenerationState state,
|
||||
|
||||
Reference in New Issue
Block a user