more renames to get rid of "Jet" in class and method names
This commit is contained in:
@@ -27,7 +27,7 @@ public class CodegenStatementVisitor extends KtVisitor<StackValue, StackValue> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StackValue visitJetElement(@NotNull KtElement element, StackValue receiver) {
|
public StackValue visitKtElement(@NotNull KtElement element, StackValue receiver) {
|
||||||
return element.accept(codegen, receiver);
|
return element.accept(codegen, receiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2324,7 +2324,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Type asmType =
|
final Type asmType =
|
||||||
state.getSamWrapperClasses().getSamWrapperClass(samType, expression.getContainingJetFile(), getParentCodegen());
|
state.getSamWrapperClasses().getSamWrapperClass(samType, expression.getContainingKtFile(), getParentCodegen());
|
||||||
|
|
||||||
return StackValue.operation(asmType, new Function1<InstructionAdapter, Unit>() {
|
return StackValue.operation(asmType, new Function1<InstructionAdapter, Unit>() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1191,7 +1191,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
|||||||
|
|
||||||
KtVisitorVoid visitor = new KtVisitorVoid() {
|
KtVisitorVoid visitor = new KtVisitorVoid() {
|
||||||
@Override
|
@Override
|
||||||
public void visitJetElement(@NotNull KtElement e) {
|
public void visitKtElement(@NotNull KtElement e) {
|
||||||
e.acceptChildren(this);
|
e.acceptChildren(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ public abstract class MemberCodegen<T extends KtElement/* TODO: & JetDeclaration
|
|||||||
return implementationOwnerType;
|
return implementationOwnerType;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return FileClasses.getFileClassType(fileClassesProvider, element.getContainingJetFile());
|
return FileClasses.getFileClassType(fileClassesProvider, element.getContainingKtFile());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*disabled cause of KT-7775
|
/*disabled cause of KT-7775
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ data public class SourceInfo(val source: String, val pathOrCleanFQN: String, val
|
|||||||
val isTopLevel = element is KtFile || (element is KtNamedFunction && element.getParent() is KtFile)
|
val isTopLevel = element is KtFile || (element is KtNamedFunction && element.getParent() is KtFile)
|
||||||
val cleanedClassFqName = if (!isTopLevel) internalClassName else internalClassName.substringBefore('$')
|
val cleanedClassFqName = if (!isTopLevel) internalClassName else internalClassName.substringBefore('$')
|
||||||
|
|
||||||
return SourceInfo(element.getContainingJetFile().getName(), cleanedClassFqName, lineNumbers!!)
|
return SourceInfo(element.getContainingKtFile().getName(), cleanedClassFqName, lineNumbers!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -153,13 +153,13 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitJetElement(@NotNull KtElement element) {
|
public void visitKtElement(@NotNull KtElement element) {
|
||||||
super.visitJetElement(element);
|
super.visitKtElement(element);
|
||||||
element.acceptChildren(this);
|
element.acceptChildren(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitJetFile(@NotNull KtFile file) {
|
public void visitKtFile(@NotNull KtFile file) {
|
||||||
if (file.isScript()) {
|
if (file.isScript()) {
|
||||||
// TODO: replace with visitScript override
|
// TODO: replace with visitScript override
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
@@ -518,7 +518,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
|||||||
super.visitWhenExpression(expression);
|
super.visitWhenExpression(expression);
|
||||||
if (!isWhenWithEnums(expression)) return;
|
if (!isWhenWithEnums(expression)) return;
|
||||||
|
|
||||||
String currentClassName = getCurrentTopLevelClassOrPackagePartInternalName(expression.getContainingJetFile());
|
String currentClassName = getCurrentTopLevelClassOrPackagePartInternalName(expression.getContainingKtFile());
|
||||||
|
|
||||||
if (bindingContext.get(MAPPINGS_FOR_WHENS_BY_ENUM_IN_CLASS_FILE, currentClassName) == null) {
|
if (bindingContext.get(MAPPINGS_FOR_WHENS_BY_ENUM_IN_CLASS_FILE, currentClassName) == null) {
|
||||||
bindingTrace.record(MAPPINGS_FOR_WHENS_BY_ENUM_IN_CLASS_FILE, currentClassName, new ArrayList<WhenByEnumsMapping>(1));
|
bindingTrace.record(MAPPINGS_FOR_WHENS_BY_ENUM_IN_CLASS_FILE, currentClassName, new ArrayList<WhenByEnumsMapping>(1));
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public final class PsiCodegenPredictor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
KtFile containingFile = declaration.getContainingJetFile();
|
KtFile containingFile = declaration.getContainingKtFile();
|
||||||
|
|
||||||
if (declaration instanceof KtNamedFunction) {
|
if (declaration instanceof KtNamedFunction) {
|
||||||
Name name = ((KtNamedFunction) declaration).getNameAsName();
|
Name name = ((KtNamedFunction) declaration).getNameAsName();
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ public class MappingsClassesForWhenByEnum {
|
|||||||
|
|
||||||
Type mappingsClassType = Type.getObjectType(mapping.getMappingsClassInternalName());
|
Type mappingsClassType = Type.getObjectType(mapping.getMappingsClassInternalName());
|
||||||
|
|
||||||
mappingsCodegen.generate(mappings, mappingsClassType, expression.getContainingJetFile());
|
mappingsCodegen.generate(mappings, mappingsClassType, expression.getContainingKtFile());
|
||||||
generatedMappingClasses.add(mapping.getMappingsClassInternalName());
|
generatedMappingClasses.add(mapping.getMappingsClassInternalName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ class ModuleVisibilityHelperImpl : ModuleVisibilityHelper {
|
|||||||
val whatSource = getSourceElement(what)
|
val whatSource = getSourceElement(what)
|
||||||
if (whatSource is KotlinSourceElement) {
|
if (whatSource is KotlinSourceElement) {
|
||||||
if (moduleVisibilityManager.chunk.size > 1 && fromSource is KotlinSourceElement) {
|
if (moduleVisibilityManager.chunk.size > 1 && fromSource is KotlinSourceElement) {
|
||||||
val fromSourceKotlinFile = fromSource.psi.getContainingJetFile()
|
val fromSourceKotlinFile = fromSource.psi.getContainingKtFile()
|
||||||
val whatSourceKotlinFile = whatSource.psi.getContainingJetFile()
|
val whatSourceKotlinFile = whatSource.psi.getContainingKtFile()
|
||||||
return findModule(whatSourceKotlinFile) === findModule(fromSourceKotlinFile)
|
return findModule(whatSourceKotlinFile) === findModule(fromSourceKotlinFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ public class CompileEnvironmentUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static List<KtFile> getJetFiles(
|
public static List<KtFile> getKtFiles(
|
||||||
@NotNull final Project project,
|
@NotNull final Project project,
|
||||||
@NotNull Collection<String> sourceRoots,
|
@NotNull Collection<String> sourceRoots,
|
||||||
@NotNull Function1<String, Unit> reportError
|
@NotNull Function1<String, Unit> reportError
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ import org.jetbrains.kotlin.idea.KotlinFileType
|
|||||||
import org.jetbrains.kotlin.load.kotlin.JvmVirtualFileFinderFactory
|
import org.jetbrains.kotlin.load.kotlin.JvmVirtualFileFinderFactory
|
||||||
import org.jetbrains.kotlin.load.kotlin.KotlinBinaryClassCache
|
import org.jetbrains.kotlin.load.kotlin.KotlinBinaryClassCache
|
||||||
import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager
|
import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager
|
||||||
import org.jetbrains.kotlin.parsing.JetParserDefinition
|
import org.jetbrains.kotlin.parsing.KotlinParserDefinition
|
||||||
import org.jetbrains.kotlin.parsing.JetScriptDefinitionProvider
|
import org.jetbrains.kotlin.parsing.KotlinScriptDefinitionProvider
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
import org.jetbrains.kotlin.resolve.CodeAnalyzerInitializer
|
import org.jetbrains.kotlin.resolve.CodeAnalyzerInitializer
|
||||||
import org.jetbrains.kotlin.resolve.jvm.KotlinJavaPsiFacade
|
import org.jetbrains.kotlin.resolve.jvm.KotlinJavaPsiFacade
|
||||||
@@ -119,7 +119,7 @@ public class KotlinCoreEnvironment private constructor(
|
|||||||
val index = JvmDependenciesIndex(javaRoots)
|
val index = JvmDependenciesIndex(javaRoots)
|
||||||
(fileManager as KotlinCliJavaFileManagerImpl).initIndex(index)
|
(fileManager as KotlinCliJavaFileManagerImpl).initIndex(index)
|
||||||
|
|
||||||
sourceFiles.addAll(CompileEnvironmentUtil.getJetFiles(project, getSourceRootsCheckingForDuplicates(), {
|
sourceFiles.addAll(CompileEnvironmentUtil.getKtFiles(project, getSourceRootsCheckingForDuplicates(), {
|
||||||
message ->
|
message ->
|
||||||
report(ERROR, message)
|
report(ERROR, message)
|
||||||
}))
|
}))
|
||||||
@@ -129,7 +129,7 @@ public class KotlinCoreEnvironment private constructor(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
JetScriptDefinitionProvider.getInstance(project).addScriptDefinitions(configuration.getList(CommonConfigurationKeys.SCRIPT_DEFINITIONS_KEY))
|
KotlinScriptDefinitionProvider.getInstance(project).addScriptDefinitions(configuration.getList(CommonConfigurationKeys.SCRIPT_DEFINITIONS_KEY))
|
||||||
|
|
||||||
project.registerService(javaClass<JvmVirtualFileFinderFactory>(), JvmCliVirtualFileFinderFactory(index))
|
project.registerService(javaClass<JvmVirtualFileFinderFactory>(), JvmCliVirtualFileFinderFactory(index))
|
||||||
|
|
||||||
@@ -356,8 +356,8 @@ public class KotlinCoreEnvironment private constructor(
|
|||||||
public fun registerApplicationServices(applicationEnvironment: JavaCoreApplicationEnvironment) {
|
public fun registerApplicationServices(applicationEnvironment: JavaCoreApplicationEnvironment) {
|
||||||
with(applicationEnvironment) {
|
with(applicationEnvironment) {
|
||||||
registerFileType(KotlinFileType.INSTANCE, "kt")
|
registerFileType(KotlinFileType.INSTANCE, "kt")
|
||||||
registerFileType(KotlinFileType.INSTANCE, JetParserDefinition.STD_SCRIPT_SUFFIX)
|
registerFileType(KotlinFileType.INSTANCE, KotlinParserDefinition.STD_SCRIPT_SUFFIX)
|
||||||
registerParserDefinition(JetParserDefinition())
|
registerParserDefinition(KotlinParserDefinition())
|
||||||
getApplication().registerService(javaClass<KotlinBinaryClassCache>(), KotlinBinaryClassCache())
|
getApplication().registerService(javaClass<KotlinBinaryClassCache>(), KotlinBinaryClassCache())
|
||||||
getApplication().registerService(javaClass<JavaClassSupers>(), javaClass<JavaClassSupersImpl>())
|
getApplication().registerService(javaClass<JavaClassSupers>(), javaClass<JavaClassSupersImpl>())
|
||||||
}
|
}
|
||||||
@@ -372,7 +372,7 @@ public class KotlinCoreEnvironment private constructor(
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
public fun registerProjectServices(projectEnvironment: JavaCoreProjectEnvironment) {
|
public fun registerProjectServices(projectEnvironment: JavaCoreProjectEnvironment) {
|
||||||
with (projectEnvironment.getProject()) {
|
with (projectEnvironment.getProject()) {
|
||||||
registerService(javaClass<JetScriptDefinitionProvider>(), JetScriptDefinitionProvider())
|
registerService(javaClass<KotlinScriptDefinitionProvider>(), KotlinScriptDefinitionProvider())
|
||||||
registerService(javaClass<KotlinJavaPsiFacade>(), KotlinJavaPsiFacade(this))
|
registerService(javaClass<KotlinJavaPsiFacade>(), KotlinJavaPsiFacade(this))
|
||||||
registerService(javaClass<KtLightClassForFacade.FacadeStubCache>(), KtLightClassForFacade.FacadeStubCache(this))
|
registerService(javaClass<KtLightClassForFacade.FacadeStubCache>(), KtLightClassForFacade.FacadeStubCache(this))
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -53,8 +53,8 @@ import org.jetbrains.kotlin.modules.Module;
|
|||||||
import org.jetbrains.kotlin.modules.TargetId;
|
import org.jetbrains.kotlin.modules.TargetId;
|
||||||
import org.jetbrains.kotlin.modules.TargetIdKt;
|
import org.jetbrains.kotlin.modules.TargetIdKt;
|
||||||
import org.jetbrains.kotlin.name.FqName;
|
import org.jetbrains.kotlin.name.FqName;
|
||||||
import org.jetbrains.kotlin.parsing.JetScriptDefinition;
|
import org.jetbrains.kotlin.parsing.KotlinScriptDefinition;
|
||||||
import org.jetbrains.kotlin.parsing.JetScriptDefinitionProvider;
|
import org.jetbrains.kotlin.parsing.KotlinScriptDefinitionProvider;
|
||||||
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus;
|
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus;
|
||||||
import org.jetbrains.kotlin.psi.KtFile;
|
import org.jetbrains.kotlin.psi.KtFile;
|
||||||
import org.jetbrains.kotlin.resolve.AnalyzerScriptParameter;
|
import org.jetbrains.kotlin.resolve.AnalyzerScriptParameter;
|
||||||
@@ -148,7 +148,7 @@ public class KotlinToJVMBytecodeCompiler {
|
|||||||
|
|
||||||
for (Module module : chunk) {
|
for (Module module : chunk) {
|
||||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
|
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
|
||||||
List<KtFile> jetFiles = CompileEnvironmentUtil.getJetFiles(
|
List<KtFile> jetFiles = CompileEnvironmentUtil.getKtFiles(
|
||||||
environment.getProject(), getAbsolutePaths(directory, module), new Function1<String, Unit>() {
|
environment.getProject(), getAbsolutePaths(directory, module), new Function1<String, Unit>() {
|
||||||
@Override
|
@Override
|
||||||
public Unit invoke(String s) {
|
public Unit invoke(String s) {
|
||||||
@@ -276,8 +276,8 @@ public class KotlinToJVMBytecodeCompiler {
|
|||||||
) {
|
) {
|
||||||
List<AnalyzerScriptParameter> scriptParameters = environment.getConfiguration().getList(JVMConfigurationKeys.SCRIPT_PARAMETERS);
|
List<AnalyzerScriptParameter> scriptParameters = environment.getConfiguration().getList(JVMConfigurationKeys.SCRIPT_PARAMETERS);
|
||||||
if (!scriptParameters.isEmpty()) {
|
if (!scriptParameters.isEmpty()) {
|
||||||
JetScriptDefinitionProvider.getInstance(environment.getProject()).addScriptDefinition(
|
KotlinScriptDefinitionProvider.getInstance(environment.getProject()).addScriptDefinition(
|
||||||
new JetScriptDefinition(".kts", scriptParameters)
|
new KotlinScriptDefinition(".kts", scriptParameters)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
GenerationState state = analyzeAndGenerate(environment);
|
GenerationState state = analyzeAndGenerate(environment);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ import org.jetbrains.kotlin.descriptors.impl.CompositePackageFragmentProvider;
|
|||||||
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl;
|
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl;
|
||||||
import org.jetbrains.kotlin.idea.KotlinLanguage;
|
import org.jetbrains.kotlin.idea.KotlinLanguage;
|
||||||
import org.jetbrains.kotlin.name.FqName;
|
import org.jetbrains.kotlin.name.FqName;
|
||||||
import org.jetbrains.kotlin.parsing.JetParserDefinition;
|
import org.jetbrains.kotlin.parsing.KotlinParserDefinition;
|
||||||
import org.jetbrains.kotlin.psi.KtFile;
|
import org.jetbrains.kotlin.psi.KtFile;
|
||||||
import org.jetbrains.kotlin.psi.KtScript;
|
import org.jetbrains.kotlin.psi.KtScript;
|
||||||
import org.jetbrains.kotlin.resolve.*;
|
import org.jetbrains.kotlin.resolve.*;
|
||||||
@@ -270,7 +270,7 @@ public class ReplInterpreter {
|
|||||||
}
|
}
|
||||||
fullText.append(line);
|
fullText.append(line);
|
||||||
|
|
||||||
LightVirtualFile virtualFile = new LightVirtualFile("line" + lineNumber + JetParserDefinition.STD_SCRIPT_EXT, KotlinLanguage.INSTANCE, fullText.toString());
|
LightVirtualFile virtualFile = new LightVirtualFile("line" + lineNumber + KotlinParserDefinition.STD_SCRIPT_EXT, KotlinLanguage.INSTANCE, fullText.toString());
|
||||||
virtualFile.setCharset(CharsetToolkit.UTF8_CHARSET);
|
virtualFile.setCharset(CharsetToolkit.UTF8_CHARSET);
|
||||||
KtFile psiFile = (KtFile) 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;
|
assert psiFile != null : "Script file not analyzed at line " + lineNumber + ": " + fullText;
|
||||||
@@ -459,8 +459,8 @@ public class ReplInterpreter {
|
|||||||
state.beforeCompile();
|
state.beforeCompile();
|
||||||
KotlinCodegenFacade.generatePackage(
|
KotlinCodegenFacade.generatePackage(
|
||||||
state,
|
state,
|
||||||
script.getContainingJetFile().getPackageFqName(),
|
script.getContainingKtFile().getPackageFqName(),
|
||||||
Collections.singleton(script.getContainingJetFile()),
|
Collections.singleton(script.getContainingKtFile()),
|
||||||
errorHandler
|
errorHandler
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -16,5 +16,5 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.asJava;
|
package org.jetbrains.kotlin.asJava;
|
||||||
|
|
||||||
public interface JetJavaMirrorMarker {
|
public interface KtJavaMirrorMarker {
|
||||||
}
|
}
|
||||||
@@ -129,6 +129,6 @@ public val KtFile.javaFileFacadeFqName: FqName
|
|||||||
}
|
}
|
||||||
|
|
||||||
public fun KtDeclaration.isInsideJvmMultifileClassFile() = JvmFileClassUtil.findAnnotationEntryOnFileNoResolve(
|
public fun KtDeclaration.isInsideJvmMultifileClassFile() = JvmFileClassUtil.findAnnotationEntryOnFileNoResolve(
|
||||||
getContainingJetFile(),
|
getContainingKtFile(),
|
||||||
JvmFileClassUtil.JVM_MULTIFILE_CLASS_SHORT
|
JvmFileClassUtil.JVM_MULTIFILE_CLASS_SHORT
|
||||||
) != null
|
) != null
|
||||||
|
|||||||
+2
-2
@@ -22,7 +22,7 @@ import kotlin.ArraysKt;
|
|||||||
import kotlin.jvm.functions.Function1;
|
import kotlin.jvm.functions.Function1;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.asJava.JetJavaMirrorMarker;
|
import org.jetbrains.kotlin.asJava.KtJavaMirrorMarker;
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility;
|
import org.jetbrains.kotlin.descriptors.Visibility;
|
||||||
import org.jetbrains.kotlin.load.java.structure.*;
|
import org.jetbrains.kotlin.load.java.structure.*;
|
||||||
import org.jetbrains.kotlin.name.FqName;
|
import org.jetbrains.kotlin.name.FqName;
|
||||||
@@ -163,7 +163,7 @@ public class JavaClassImpl extends JavaClassifierImpl<PsiClass> implements JavaC
|
|||||||
@NotNull
|
@NotNull
|
||||||
public OriginKind getOriginKind() {
|
public OriginKind getOriginKind() {
|
||||||
PsiClass psiClass = getPsi();
|
PsiClass psiClass = getPsi();
|
||||||
if (psiClass instanceof JetJavaMirrorMarker) {
|
if (psiClass instanceof KtJavaMirrorMarker) {
|
||||||
return OriginKind.KOTLIN_LIGHT_CLASS;
|
return OriginKind.KOTLIN_LIGHT_CLASS;
|
||||||
}
|
}
|
||||||
else if (psiClass instanceof PsiCompiledElement) {
|
else if (psiClass instanceof PsiCompiledElement) {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.psi.*;
|
|||||||
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
|
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
|
||||||
|
|
||||||
public interface KtNodeTypes {
|
public interface KtNodeTypes {
|
||||||
IFileElementType JET_FILE = new IFileElementType(KotlinLanguage.INSTANCE);
|
IFileElementType KT_FILE = new IFileElementType(KotlinLanguage.INSTANCE);
|
||||||
|
|
||||||
IElementType CLASS = KtStubElementTypes.CLASS;
|
IElementType CLASS = KtStubElementTypes.CLASS;
|
||||||
IElementType FUN = KtStubElementTypes.FUNCTION;
|
IElementType FUN = KtStubElementTypes.FUNCTION;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ import org.jetbrains.kotlin.lexer.KtToken;
|
|||||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
import org.jetbrains.kotlin.psi.*;
|
import org.jetbrains.kotlin.psi.*;
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||||
import org.jetbrains.kotlin.resolve.BindingContextUtils;
|
import org.jetbrains.kotlin.resolve.BindingContextUtils;
|
||||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||||
@@ -169,7 +169,7 @@ public class JetControlFlowProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitJetElement(@NotNull KtElement element) {
|
public void visitKtElement(@NotNull KtElement element) {
|
||||||
throw new UnsupportedOperationException("[JetControlFlowProcessor] " + element.toString());
|
throw new UnsupportedOperationException("[JetControlFlowProcessor] " + element.toString());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -467,7 +467,7 @@ public class JetControlFlowProcessor {
|
|||||||
Map<PseudoValue, ReceiverValue> receiverValues = SmartFMap.emptyMap();
|
Map<PseudoValue, ReceiverValue> receiverValues = SmartFMap.emptyMap();
|
||||||
AccessTarget accessTarget = AccessTarget.BlackBox.INSTANCE$;
|
AccessTarget accessTarget = AccessTarget.BlackBox.INSTANCE$;
|
||||||
if (left instanceof KtSimpleNameExpression || left instanceof KtQualifiedExpression) {
|
if (left instanceof KtSimpleNameExpression || left instanceof KtQualifiedExpression) {
|
||||||
accessTarget = getResolvedCallAccessTarget(JetPsiUtilKt.getQualifiedElementSelector(left));
|
accessTarget = getResolvedCallAccessTarget(KtPsiUtilKt.getQualifiedElementSelector(left));
|
||||||
if (accessTarget instanceof AccessTarget.Call) {
|
if (accessTarget instanceof AccessTarget.Call) {
|
||||||
receiverValues = getReceiverValues(((AccessTarget.Call) accessTarget).getResolvedCall());
|
receiverValues = getReceiverValues(((AccessTarget.Call) accessTarget).getResolvedCall());
|
||||||
}
|
}
|
||||||
@@ -1210,7 +1210,7 @@ public class JetControlFlowProcessor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
visitJetElement(expression);
|
visitKtElement(expression);
|
||||||
createNonSyntheticValue(expression, MagicKind.UNSUPPORTED_ELEMENT, left);
|
createNonSyntheticValue(expression, MagicKind.UNSUPPORTED_ELEMENT, left);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1451,7 +1451,7 @@ public class JetControlFlowProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitJetFile(@NotNull KtFile file) {
|
public void visitKtFile(@NotNull KtFile file) {
|
||||||
for (KtDeclaration declaration : file.getDeclarations()) {
|
for (KtDeclaration declaration : file.getDeclarations()) {
|
||||||
if (declaration instanceof KtProperty) {
|
if (declaration instanceof KtProperty) {
|
||||||
generateInstructions(declaration);
|
generateInstructions(declaration);
|
||||||
@@ -1466,7 +1466,7 @@ public class JetControlFlowProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitJetElement(@NotNull KtElement element) {
|
public void visitKtElement(@NotNull KtElement element) {
|
||||||
createNonSyntheticValue(element, MagicKind.UNSUPPORTED_ELEMENT);
|
createNonSyntheticValue(element, MagicKind.UNSUPPORTED_ELEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ public class JetFlowInformationProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitJetElement(@NotNull KtElement element) {
|
public void visitKtElement(@NotNull KtElement element) {
|
||||||
if (!(element instanceof KtExpression || element instanceof KtWhenCondition)) return;
|
if (!(element instanceof KtExpression || element instanceof KtWhenCondition)) return;
|
||||||
|
|
||||||
if (blockBody && !noExpectedType(expectedReturnType)
|
if (blockBody && !noExpectedType(expectedReturnType)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.config;
|
package org.jetbrains.kotlin.config;
|
||||||
|
|
||||||
import org.jetbrains.kotlin.parsing.JetScriptDefinition;
|
import org.jetbrains.kotlin.parsing.KotlinScriptDefinition;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -27,5 +27,5 @@ public class CommonConfigurationKeys {
|
|||||||
// roots, including dependencies and own source
|
// roots, including dependencies and own source
|
||||||
public static final CompilerConfigurationKey<List<ContentRoot>> CONTENT_ROOTS = CompilerConfigurationKey.create("content roots");
|
public static final CompilerConfigurationKey<List<ContentRoot>> CONTENT_ROOTS = CompilerConfigurationKey.create("content roots");
|
||||||
|
|
||||||
public static final CompilerConfigurationKey<List<JetScriptDefinition>> SCRIPT_DEFINITIONS_KEY = CompilerConfigurationKey.create("script definitions");
|
public static final CompilerConfigurationKey<List<KotlinScriptDefinition>> SCRIPT_DEFINITIONS_KEY = CompilerConfigurationKey.create("script definitions");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class KotlinLookupLocation(val element: KtElement) : LookupLocation {
|
|||||||
|
|
||||||
override val location: LocationInfo?
|
override val location: LocationInfo?
|
||||||
get() {
|
get() {
|
||||||
val containingJetFile = element.getContainingJetFile()
|
val containingJetFile = element.getContainingKtFile()
|
||||||
|
|
||||||
if (containingJetFile.doNotAnalyze != null) return null
|
if (containingJetFile.doNotAnalyze != null) return null
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -32,7 +32,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import static org.jetbrains.kotlin.lexer.KtTokens.*;
|
import static org.jetbrains.kotlin.lexer.KtTokens.*;
|
||||||
|
|
||||||
/*package*/ abstract class AbstractJetParsing {
|
/*package*/ abstract class AbstractKotlinParsing {
|
||||||
private static final Map<String, KtKeywordToken> SOFT_KEYWORD_TEXTS = new HashMap<String, KtKeywordToken>();
|
private static final Map<String, KtKeywordToken> SOFT_KEYWORD_TEXTS = new HashMap<String, KtKeywordToken>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@@ -52,7 +52,7 @@ import static org.jetbrains.kotlin.lexer.KtTokens.*;
|
|||||||
|
|
||||||
protected final SemanticWhitespaceAwarePsiBuilder myBuilder;
|
protected final SemanticWhitespaceAwarePsiBuilder myBuilder;
|
||||||
|
|
||||||
public AbstractJetParsing(SemanticWhitespaceAwarePsiBuilder builder) {
|
public AbstractKotlinParsing(SemanticWhitespaceAwarePsiBuilder builder) {
|
||||||
this.myBuilder = builder;
|
this.myBuilder = builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,9 +362,9 @@ import static org.jetbrains.kotlin.lexer.KtTokens.*;
|
|||||||
TrailingCommentsBinder.INSTANCE$);
|
TrailingCommentsBinder.INSTANCE$);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract JetParsing create(SemanticWhitespaceAwarePsiBuilder builder);
|
protected abstract KotlinParsing create(SemanticWhitespaceAwarePsiBuilder builder);
|
||||||
|
|
||||||
protected JetParsing createTruncatedBuilder(int eofPosition) {
|
protected KotlinParsing createTruncatedBuilder(int eofPosition) {
|
||||||
return create(new TruncatedSemanticWhitespaceAwarePsiBuilder(myBuilder, eofPosition));
|
return create(new TruncatedSemanticWhitespaceAwarePsiBuilder(myBuilder, eofPosition));
|
||||||
}
|
}
|
||||||
|
|
||||||
+13
-13
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.KtNodeType;
|
|||||||
import org.jetbrains.kotlin.KtNodeTypes;
|
import org.jetbrains.kotlin.KtNodeTypes;
|
||||||
import org.jetbrains.kotlin.lexer.KtToken;
|
import org.jetbrains.kotlin.lexer.KtToken;
|
||||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||||
import org.jetbrains.kotlin.parsing.JetParsing.NameParsingMode;
|
import org.jetbrains.kotlin.parsing.KotlinParsing.NameParsingMode;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -33,9 +33,9 @@ import java.util.Set;
|
|||||||
|
|
||||||
import static org.jetbrains.kotlin.KtNodeTypes.*;
|
import static org.jetbrains.kotlin.KtNodeTypes.*;
|
||||||
import static org.jetbrains.kotlin.lexer.KtTokens.*;
|
import static org.jetbrains.kotlin.lexer.KtTokens.*;
|
||||||
import static org.jetbrains.kotlin.parsing.JetParsing.AnnotationParsingMode.DEFAULT;
|
import static org.jetbrains.kotlin.parsing.KotlinParsing.AnnotationParsingMode.DEFAULT;
|
||||||
|
|
||||||
public class JetExpressionParsing extends AbstractJetParsing {
|
public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
||||||
private static final TokenSet WHEN_CONDITION_RECOVERY_SET = TokenSet.create(RBRACE, IN_KEYWORD, NOT_IN, IS_KEYWORD, NOT_IS, ELSE_KEYWORD);
|
private static final TokenSet WHEN_CONDITION_RECOVERY_SET = TokenSet.create(RBRACE, IN_KEYWORD, NOT_IN, IS_KEYWORD, NOT_IS, ELSE_KEYWORD);
|
||||||
private static final TokenSet WHEN_CONDITION_RECOVERY_SET_WITH_ARROW = TokenSet.create(RBRACE, IN_KEYWORD, NOT_IN, IS_KEYWORD, NOT_IS, ELSE_KEYWORD, ARROW, DOT);
|
private static final TokenSet WHEN_CONDITION_RECOVERY_SET_WITH_ARROW = TokenSet.create(RBRACE, IN_KEYWORD, NOT_IN, IS_KEYWORD, NOT_IS, ELSE_KEYWORD, ARROW, DOT);
|
||||||
|
|
||||||
@@ -140,20 +140,20 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
PREFIX(MINUS, PLUS, MINUSMINUS, PLUSPLUS, EXCL) { // annotations
|
PREFIX(MINUS, PLUS, MINUSMINUS, PLUSPLUS, EXCL) { // annotations
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void parseHigherPrecedence(JetExpressionParsing parser) {
|
public void parseHigherPrecedence(KotlinExpressionParsing parser) {
|
||||||
throw new IllegalStateException("Don't call this method");
|
throw new IllegalStateException("Don't call this method");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
AS(AS_KEYWORD, AS_SAFE) {
|
AS(AS_KEYWORD, AS_SAFE) {
|
||||||
@Override
|
@Override
|
||||||
public KtNodeType parseRightHandSide(IElementType operation, JetExpressionParsing parser) {
|
public KtNodeType parseRightHandSide(IElementType operation, KotlinExpressionParsing parser) {
|
||||||
parser.myJetParsing.parseTypeRef();
|
parser.myJetParsing.parseTypeRef();
|
||||||
return BINARY_WITH_TYPE;
|
return BINARY_WITH_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void parseHigherPrecedence(JetExpressionParsing parser) {
|
public void parseHigherPrecedence(KotlinExpressionParsing parser) {
|
||||||
parser.parsePrefixExpression();
|
parser.parsePrefixExpression();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -165,7 +165,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
ELVIS(KtTokens.ELVIS),
|
ELVIS(KtTokens.ELVIS),
|
||||||
IN_OR_IS(IN_KEYWORD, NOT_IN, IS_KEYWORD, NOT_IS) {
|
IN_OR_IS(IN_KEYWORD, NOT_IN, IS_KEYWORD, NOT_IS) {
|
||||||
@Override
|
@Override
|
||||||
public KtNodeType parseRightHandSide(IElementType operation, JetExpressionParsing parser) {
|
public KtNodeType parseRightHandSide(IElementType operation, KotlinExpressionParsing parser) {
|
||||||
if (operation == IS_KEYWORD || operation == NOT_IS) {
|
if (operation == IS_KEYWORD || operation == NOT_IS) {
|
||||||
parser.myJetParsing.parseTypeRef();
|
parser.myJetParsing.parseTypeRef();
|
||||||
return IS_EXPRESSION;
|
return IS_EXPRESSION;
|
||||||
@@ -197,7 +197,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
this.operations = TokenSet.create(operations);
|
this.operations = TokenSet.create(operations);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void parseHigherPrecedence(JetExpressionParsing parser) {
|
public void parseHigherPrecedence(KotlinExpressionParsing parser) {
|
||||||
assert higher != null;
|
assert higher != null;
|
||||||
parser.parseBinaryExpression(higher);
|
parser.parseBinaryExpression(higher);
|
||||||
}
|
}
|
||||||
@@ -208,7 +208,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
* @param parser the parser object
|
* @param parser the parser object
|
||||||
* @return node type of the result
|
* @return node type of the result
|
||||||
*/
|
*/
|
||||||
public KtNodeType parseRightHandSide(IElementType operation, JetExpressionParsing parser) {
|
public KtNodeType parseRightHandSide(IElementType operation, KotlinExpressionParsing parser) {
|
||||||
parseHigherPrecedence(parser);
|
parseHigherPrecedence(parser);
|
||||||
return BINARY_EXPRESSION;
|
return BINARY_EXPRESSION;
|
||||||
}
|
}
|
||||||
@@ -257,9 +257,9 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final JetParsing myJetParsing;
|
private final KotlinParsing myJetParsing;
|
||||||
|
|
||||||
public JetExpressionParsing(SemanticWhitespaceAwarePsiBuilder builder, JetParsing jetParsing) {
|
public KotlinExpressionParsing(SemanticWhitespaceAwarePsiBuilder builder, KotlinParsing jetParsing) {
|
||||||
super(builder);
|
super(builder);
|
||||||
myJetParsing = jetParsing;
|
myJetParsing = jetParsing;
|
||||||
}
|
}
|
||||||
@@ -1023,7 +1023,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
*/
|
*/
|
||||||
private boolean parseLocalDeclaration() {
|
private boolean parseLocalDeclaration() {
|
||||||
PsiBuilder.Marker decl = mark();
|
PsiBuilder.Marker decl = mark();
|
||||||
JetParsing.ModifierDetector detector = new JetParsing.ModifierDetector();
|
KotlinParsing.ModifierDetector detector = new KotlinParsing.ModifierDetector();
|
||||||
myJetParsing.parseModifierList(detector, DEFAULT, TokenSet.EMPTY);
|
myJetParsing.parseModifierList(detector, DEFAULT, TokenSet.EMPTY);
|
||||||
|
|
||||||
IElementType declType = parseLocalDeclarationRest(detector.isEnumDetected());
|
IElementType declType = parseLocalDeclarationRest(detector.isEnumDetected());
|
||||||
@@ -1767,7 +1767,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected JetParsing create(SemanticWhitespaceAwarePsiBuilder builder) {
|
protected KotlinParsing create(SemanticWhitespaceAwarePsiBuilder builder) {
|
||||||
return myJetParsing.create(builder);
|
return myJetParsing.create(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
+9
-9
@@ -24,12 +24,12 @@ import com.intellij.psi.PsiFile;
|
|||||||
import com.intellij.psi.tree.IElementType;
|
import com.intellij.psi.tree.IElementType;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class JetParser implements PsiParser {
|
public class KotlinParser implements PsiParser {
|
||||||
|
|
||||||
private final JetScriptDefinitionProvider scriptDefinitionProvider;
|
private final KotlinScriptDefinitionProvider scriptDefinitionProvider;
|
||||||
|
|
||||||
public JetParser(Project project) {
|
public KotlinParser(Project project) {
|
||||||
scriptDefinitionProvider = JetScriptDefinitionProvider.getInstance(project);
|
scriptDefinitionProvider = KotlinScriptDefinitionProvider.getInstance(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -41,9 +41,9 @@ public class JetParser implements PsiParser {
|
|||||||
// we need this method because we need psiFile
|
// we need this method because we need psiFile
|
||||||
@NotNull
|
@NotNull
|
||||||
public ASTNode parse(IElementType iElementType, PsiBuilder psiBuilder, PsiFile psiFile) {
|
public ASTNode parse(IElementType iElementType, PsiBuilder psiBuilder, PsiFile psiFile) {
|
||||||
JetParsing jetParsing = JetParsing.createForTopLevel(new SemanticWhitespaceAwarePsiBuilderImpl(psiBuilder));
|
KotlinParsing jetParsing = KotlinParsing.createForTopLevel(new SemanticWhitespaceAwarePsiBuilderImpl(psiBuilder));
|
||||||
if (scriptDefinitionProvider != null && scriptDefinitionProvider.isScript(psiFile)
|
if (scriptDefinitionProvider != null && scriptDefinitionProvider.isScript(psiFile)
|
||||||
|| psiFile.getName().endsWith(JetParserDefinition.STD_SCRIPT_EXT)) {
|
|| psiFile.getName().endsWith(KotlinParserDefinition.STD_SCRIPT_EXT)) {
|
||||||
jetParsing.parseScript();
|
jetParsing.parseScript();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -54,21 +54,21 @@ public class JetParser implements PsiParser {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static ASTNode parseTypeCodeFragment(PsiBuilder psiBuilder) {
|
public static ASTNode parseTypeCodeFragment(PsiBuilder psiBuilder) {
|
||||||
JetParsing jetParsing = JetParsing.createForTopLevel(new SemanticWhitespaceAwarePsiBuilderImpl(psiBuilder));
|
KotlinParsing jetParsing = KotlinParsing.createForTopLevel(new SemanticWhitespaceAwarePsiBuilderImpl(psiBuilder));
|
||||||
jetParsing.parseTypeCodeFragment();
|
jetParsing.parseTypeCodeFragment();
|
||||||
return psiBuilder.getTreeBuilt();
|
return psiBuilder.getTreeBuilt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static ASTNode parseExpressionCodeFragment(PsiBuilder psiBuilder) {
|
public static ASTNode parseExpressionCodeFragment(PsiBuilder psiBuilder) {
|
||||||
JetParsing jetParsing = JetParsing.createForTopLevel(new SemanticWhitespaceAwarePsiBuilderImpl(psiBuilder));
|
KotlinParsing jetParsing = KotlinParsing.createForTopLevel(new SemanticWhitespaceAwarePsiBuilderImpl(psiBuilder));
|
||||||
jetParsing.parseExpressionCodeFragment();
|
jetParsing.parseExpressionCodeFragment();
|
||||||
return psiBuilder.getTreeBuilt();
|
return psiBuilder.getTreeBuilt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static ASTNode parseBlockCodeFragment(PsiBuilder psiBuilder) {
|
public static ASTNode parseBlockCodeFragment(PsiBuilder psiBuilder) {
|
||||||
JetParsing jetParsing = JetParsing.createForTopLevel(new SemanticWhitespaceAwarePsiBuilderImpl(psiBuilder));
|
KotlinParsing jetParsing = KotlinParsing.createForTopLevel(new SemanticWhitespaceAwarePsiBuilderImpl(psiBuilder));
|
||||||
jetParsing.parseBlockCodeFragment();
|
jetParsing.parseBlockCodeFragment();
|
||||||
return psiBuilder.getTreeBuilt();
|
return psiBuilder.getTreeBuilt();
|
||||||
}
|
}
|
||||||
+5
-5
@@ -42,11 +42,11 @@ import org.jetbrains.kotlin.psi.KtFile;
|
|||||||
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementType;
|
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementType;
|
||||||
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
|
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
|
||||||
|
|
||||||
public class JetParserDefinition implements ParserDefinition {
|
public class KotlinParserDefinition implements ParserDefinition {
|
||||||
public static final String STD_SCRIPT_SUFFIX = "kts";
|
public static final String STD_SCRIPT_SUFFIX = "kts";
|
||||||
public static final String STD_SCRIPT_EXT = "." + STD_SCRIPT_SUFFIX;
|
public static final String STD_SCRIPT_EXT = "." + STD_SCRIPT_SUFFIX;
|
||||||
|
|
||||||
public JetParserDefinition() {
|
public KotlinParserDefinition() {
|
||||||
//todo: ApplicationManager.getApplication() is null during JetParsingTest setting up
|
//todo: ApplicationManager.getApplication() is null during JetParsingTest setting up
|
||||||
|
|
||||||
/*if (!ApplicationManager.getApplication().isCommandLine()) {
|
/*if (!ApplicationManager.getApplication().isCommandLine()) {
|
||||||
@@ -54,8 +54,8 @@ public class JetParserDefinition implements ParserDefinition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static JetParserDefinition getInstance() {
|
public static KotlinParserDefinition getInstance() {
|
||||||
return (JetParserDefinition)LanguageParserDefinitions.INSTANCE.forLanguage(KotlinLanguage.INSTANCE);
|
return (KotlinParserDefinition)LanguageParserDefinitions.INSTANCE.forLanguage(KotlinLanguage.INSTANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -66,7 +66,7 @@ public class JetParserDefinition implements ParserDefinition {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PsiParser createParser(Project project) {
|
public PsiParser createParser(Project project) {
|
||||||
return new JetParser(project);
|
return new KotlinParser(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
+16
-16
@@ -31,10 +31,10 @@ import java.util.Map;
|
|||||||
|
|
||||||
import static org.jetbrains.kotlin.KtNodeTypes.*;
|
import static org.jetbrains.kotlin.KtNodeTypes.*;
|
||||||
import static org.jetbrains.kotlin.lexer.KtTokens.*;
|
import static org.jetbrains.kotlin.lexer.KtTokens.*;
|
||||||
import static org.jetbrains.kotlin.parsing.JetParsing.AnnotationParsingMode.*;
|
import static org.jetbrains.kotlin.parsing.KotlinParsing.AnnotationParsingMode.*;
|
||||||
|
|
||||||
public class JetParsing extends AbstractJetParsing {
|
public class KotlinParsing extends AbstractKotlinParsing {
|
||||||
private static final Logger LOG = Logger.getInstance(JetParsing.class);
|
private static final Logger LOG = Logger.getInstance(KotlinParsing.class);
|
||||||
|
|
||||||
// TODO: token sets to constants, including derived methods
|
// TODO: token sets to constants, including derived methods
|
||||||
public static final Map<String, IElementType> MODIFIER_KEYWORD_MAP = new HashMap<String, IElementType>();
|
public static final Map<String, IElementType> MODIFIER_KEYWORD_MAP = new HashMap<String, IElementType>();
|
||||||
@@ -66,16 +66,16 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
private static final TokenSet ANNOTATION_TARGETS = TokenSet.create(
|
private static final TokenSet ANNOTATION_TARGETS = TokenSet.create(
|
||||||
FILE_KEYWORD, FIELD_KEYWORD, GET_KEYWORD, SET_KEYWORD, PROPERTY_KEYWORD, RECEIVER_KEYWORD, PARAM_KEYWORD, SETPARAM_KEYWORD);
|
FILE_KEYWORD, FIELD_KEYWORD, GET_KEYWORD, SET_KEYWORD, PROPERTY_KEYWORD, RECEIVER_KEYWORD, PARAM_KEYWORD, SETPARAM_KEYWORD);
|
||||||
|
|
||||||
static JetParsing createForTopLevel(SemanticWhitespaceAwarePsiBuilder builder) {
|
static KotlinParsing createForTopLevel(SemanticWhitespaceAwarePsiBuilder builder) {
|
||||||
JetParsing jetParsing = new JetParsing(builder);
|
KotlinParsing jetParsing = new KotlinParsing(builder);
|
||||||
jetParsing.myExpressionParsing = new JetExpressionParsing(builder, jetParsing);
|
jetParsing.myExpressionParsing = new KotlinExpressionParsing(builder, jetParsing);
|
||||||
return jetParsing;
|
return jetParsing;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static JetParsing createForByClause(SemanticWhitespaceAwarePsiBuilder builder) {
|
private static KotlinParsing createForByClause(SemanticWhitespaceAwarePsiBuilder builder) {
|
||||||
final SemanticWhitespaceAwarePsiBuilderForByClause builderForByClause = new SemanticWhitespaceAwarePsiBuilderForByClause(builder);
|
final SemanticWhitespaceAwarePsiBuilderForByClause builderForByClause = new SemanticWhitespaceAwarePsiBuilderForByClause(builder);
|
||||||
JetParsing jetParsing = new JetParsing(builderForByClause);
|
KotlinParsing jetParsing = new KotlinParsing(builderForByClause);
|
||||||
jetParsing.myExpressionParsing = new JetExpressionParsing(builderForByClause, jetParsing) {
|
jetParsing.myExpressionParsing = new KotlinExpressionParsing(builderForByClause, jetParsing) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean parseCallWithClosure() {
|
protected boolean parseCallWithClosure() {
|
||||||
if (builderForByClause.getStackSize() > 0) {
|
if (builderForByClause.getStackSize() > 0) {
|
||||||
@@ -85,16 +85,16 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected JetParsing create(SemanticWhitespaceAwarePsiBuilder builder) {
|
protected KotlinParsing create(SemanticWhitespaceAwarePsiBuilder builder) {
|
||||||
return createForByClause(builder);
|
return createForByClause(builder);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return jetParsing;
|
return jetParsing;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JetExpressionParsing myExpressionParsing;
|
private KotlinExpressionParsing myExpressionParsing;
|
||||||
|
|
||||||
private JetParsing(SemanticWhitespaceAwarePsiBuilder builder) {
|
private KotlinParsing(SemanticWhitespaceAwarePsiBuilder builder) {
|
||||||
super(builder);
|
super(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
parseTopLevelDeclaration();
|
parseTopLevelDeclaration();
|
||||||
}
|
}
|
||||||
|
|
||||||
fileMarker.done(JET_FILE);
|
fileMarker.done(KT_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void parseTypeCodeFragment() {
|
void parseTypeCodeFragment() {
|
||||||
@@ -166,7 +166,7 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
|
|
||||||
blockMarker.done(BLOCK);
|
blockMarker.done(BLOCK);
|
||||||
scriptMarker.done(SCRIPT);
|
scriptMarker.done(SCRIPT);
|
||||||
fileMarker.done(JET_FILE);
|
fileMarker.done(KT_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkForUnexpectedSymbols() {
|
private void checkForUnexpectedSymbols() {
|
||||||
@@ -1946,7 +1946,7 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
recoverOnParenthesizedWordForPlatformTypes(0, "Mutable", true);
|
recoverOnParenthesizedWordForPlatformTypes(0, "Mutable", true);
|
||||||
|
|
||||||
if (expect(IDENTIFIER, "Expecting type name",
|
if (expect(IDENTIFIER, "Expecting type name",
|
||||||
TokenSet.orSet(JetExpressionParsing.EXPRESSION_FIRST, JetExpressionParsing.EXPRESSION_FOLLOW, DECLARATION_FIRST))) {
|
TokenSet.orSet(KotlinExpressionParsing.EXPRESSION_FIRST, KotlinExpressionParsing.EXPRESSION_FOLLOW, DECLARATION_FIRST))) {
|
||||||
reference.done(REFERENCE_EXPRESSION);
|
reference.done(REFERENCE_EXPRESSION);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -2240,7 +2240,7 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected JetParsing create(SemanticWhitespaceAwarePsiBuilder builder) {
|
protected KotlinParsing create(SemanticWhitespaceAwarePsiBuilder builder) {
|
||||||
return createForTopLevel(builder);
|
return createForTopLevel(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
+3
-3
@@ -24,11 +24,11 @@ import java.util.Arrays;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class JetScriptDefinition {
|
public class KotlinScriptDefinition {
|
||||||
private final String extension;
|
private final String extension;
|
||||||
private final List<AnalyzerScriptParameter> parameters;
|
private final List<AnalyzerScriptParameter> parameters;
|
||||||
|
|
||||||
public JetScriptDefinition(String extension, List<AnalyzerScriptParameter> scriptParameters) {
|
public KotlinScriptDefinition(String extension, List<AnalyzerScriptParameter> scriptParameters) {
|
||||||
this.extension = extension;
|
this.extension = extension;
|
||||||
parameters = scriptParameters == null ? Collections.<AnalyzerScriptParameter>emptyList() : scriptParameters;
|
parameters = scriptParameters == null ? Collections.<AnalyzerScriptParameter>emptyList() : scriptParameters;
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ public class JetScriptDefinition {
|
|||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetScriptDefinition(String extension, AnalyzerScriptParameter... scriptParameters) {
|
public KotlinScriptDefinition(String extension, AnalyzerScriptParameter... scriptParameters) {
|
||||||
this(extension, Arrays.asList(scriptParameters));
|
this(extension, Arrays.asList(scriptParameters));
|
||||||
}
|
}
|
||||||
|
|
||||||
+12
-11
@@ -25,17 +25,18 @@ import org.jetbrains.kotlin.resolve.AnalyzerScriptParameter;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class JetScriptDefinitionProvider {
|
public class KotlinScriptDefinitionProvider {
|
||||||
private final Map<String, JetScriptDefinition> scripts = new HashMap<String, JetScriptDefinition>();
|
private final Map<String, KotlinScriptDefinition> scripts = new HashMap<String, KotlinScriptDefinition>();
|
||||||
private final Set<PsiFile> scriptsFiles = new HashSet<PsiFile>();
|
private final Set<PsiFile> scriptsFiles = new HashSet<PsiFile>();
|
||||||
|
|
||||||
private static final JetScriptDefinition standardScript = new JetScriptDefinition(JetParserDefinition.STD_SCRIPT_EXT, Collections.<AnalyzerScriptParameter>emptyList());
|
private static final KotlinScriptDefinition
|
||||||
|
standardScript = new KotlinScriptDefinition(KotlinParserDefinition.STD_SCRIPT_EXT, Collections.<AnalyzerScriptParameter>emptyList());
|
||||||
|
|
||||||
public static JetScriptDefinitionProvider getInstance(Project project) {
|
public static KotlinScriptDefinitionProvider getInstance(Project project) {
|
||||||
return ServiceManager.getService(project, JetScriptDefinitionProvider.class);
|
return ServiceManager.getService(project, KotlinScriptDefinitionProvider.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetScriptDefinitionProvider() {
|
public KotlinScriptDefinitionProvider() {
|
||||||
// .kts will take analyzer parameters explicitly specified on compilation
|
// .kts will take analyzer parameters explicitly specified on compilation
|
||||||
addScriptDefinition(standardScript);
|
addScriptDefinition(standardScript);
|
||||||
}
|
}
|
||||||
@@ -44,11 +45,11 @@ public class JetScriptDefinitionProvider {
|
|||||||
scriptsFiles.add(file);
|
scriptsFiles.add(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetScriptDefinition findScriptDefinition(PsiFile psiFile) {
|
public KotlinScriptDefinition findScriptDefinition(PsiFile psiFile) {
|
||||||
boolean force = scriptsFiles.contains(psiFile);
|
boolean force = scriptsFiles.contains(psiFile);
|
||||||
|
|
||||||
String name = psiFile.getName();
|
String name = psiFile.getName();
|
||||||
for (Map.Entry<String, JetScriptDefinition> e : scripts.entrySet()) {
|
for (Map.Entry<String, KotlinScriptDefinition> e : scripts.entrySet()) {
|
||||||
if (name.endsWith(e.getKey())) {
|
if (name.endsWith(e.getKey())) {
|
||||||
return e.getValue();
|
return e.getValue();
|
||||||
}
|
}
|
||||||
@@ -63,12 +64,12 @@ public class JetScriptDefinitionProvider {
|
|||||||
return findScriptDefinition(psiFile) != null;
|
return findScriptDefinition(psiFile) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addScriptDefinition(@NotNull JetScriptDefinition scriptDefinition) {
|
public void addScriptDefinition(@NotNull KotlinScriptDefinition scriptDefinition) {
|
||||||
scripts.put(scriptDefinition.getExtension(), scriptDefinition);
|
scripts.put(scriptDefinition.getExtension(), scriptDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addScriptDefinitions(List<JetScriptDefinition> definitions) {
|
public void addScriptDefinitions(List<KotlinScriptDefinition> definitions) {
|
||||||
for (JetScriptDefinition definition : definitions) {
|
for (KotlinScriptDefinition definition : definitions) {
|
||||||
addScriptDefinition(definition);
|
addScriptDefinition(definition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,11 +42,11 @@ private object DebugTextBuildingVisitor : KtVisitor<String, Unit>() {
|
|||||||
|
|
||||||
private val LOG = Logger.getInstance(this.javaClass)
|
private val LOG = Logger.getInstance(this.javaClass)
|
||||||
|
|
||||||
override fun visitJetFile(file: KtFile, data: Unit?): String? {
|
override fun visitKtFile(file: KtFile, data: Unit?): String? {
|
||||||
return "STUB file: ${file.getName()}"
|
return "STUB file: ${file.getName()}"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitJetElement(element: KtElement, data: Unit?): String? {
|
override fun visitKtElement(element: KtElement, data: Unit?): String? {
|
||||||
if (element is KtElementImplStub<*>) {
|
if (element is KtElementImplStub<*>) {
|
||||||
LOG.error("getDebugText() is not defined for ${element.javaClass}")
|
LOG.error("getDebugText() is not defined for ${element.javaClass}")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import com.intellij.lang.ASTNode;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.KtNodeTypes;
|
import org.jetbrains.kotlin.KtNodeTypes;
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -48,6 +48,6 @@ public class KtAnnotatedExpression extends KtExpressionImpl implements KtAnnotat
|
|||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<KtAnnotationEntry> getAnnotationEntries() {
|
public List<KtAnnotationEntry> getAnnotationEntries() {
|
||||||
return JetPsiUtilKt.collectAnnotationEntriesFromStubOrPsi(this);
|
return KtPsiUtilKt.collectAnnotationEntriesFromStubOrPsi(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import com.intellij.lang.PsiBuilderFactory;
|
|||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.parsing.JetParser;
|
import org.jetbrains.kotlin.parsing.KotlinParser;
|
||||||
import org.jetbrains.kotlin.psi.stubs.elements.KtFileElementType;
|
import org.jetbrains.kotlin.psi.stubs.elements.KtFileElementType;
|
||||||
|
|
||||||
public class KtBlockCodeFragmentType extends KtFileElementType {
|
public class KtBlockCodeFragmentType extends KtFileElementType {
|
||||||
@@ -44,7 +44,7 @@ public class KtBlockCodeFragmentType extends KtFileElementType {
|
|||||||
Project project = psi.getProject();
|
Project project = psi.getProject();
|
||||||
Language languageForParser = getLanguageForParser(psi);
|
Language languageForParser = getLanguageForParser(psi);
|
||||||
PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, languageForParser, chameleon.getChars());
|
PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, languageForParser, chameleon.getChars());
|
||||||
return JetParser.parseBlockCodeFragment(builder).getFirstChildNode();
|
return KotlinParser.parseBlockCodeFragment(builder).getFirstChildNode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ abstract public class KtClassOrObject :
|
|||||||
public override fun delete() {
|
public override fun delete() {
|
||||||
CheckUtil.checkWritable(this);
|
CheckUtil.checkWritable(this);
|
||||||
|
|
||||||
val file = getContainingJetFile();
|
val file = getContainingKtFile();
|
||||||
if (!isTopLevel() || file.getDeclarations().size() > 1) {
|
if (!isTopLevel() || file.getDeclarations().size() > 1) {
|
||||||
CodeEditUtil.removeChild(getParent().getNode(), getNode());
|
CodeEditUtil.removeChild(getParent().getNode(), getNode());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import com.intellij.psi.NavigatablePsiElement
|
|||||||
import com.intellij.psi.PsiReference
|
import com.intellij.psi.PsiReference
|
||||||
|
|
||||||
public interface KtElement : NavigatablePsiElement {
|
public interface KtElement : NavigatablePsiElement {
|
||||||
public fun getContainingJetFile(): KtFile
|
public fun getContainingKtFile(): KtFile
|
||||||
|
|
||||||
public fun <D> acceptChildren(visitor: KtVisitor<Void, D>, data: D)
|
public fun <D> acceptChildren(visitor: KtVisitor<Void, D>, data: D)
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class KtElementImpl extends ASTWrapperPsiElement implements KtElement {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public KtFile getContainingJetFile() {
|
public KtFile getContainingKtFile() {
|
||||||
PsiFile file = getContainingFile();
|
PsiFile file = getContainingFile();
|
||||||
assert file instanceof KtFile : "JetElement not inside JetFile: " + file + " " + file.getText();
|
assert file instanceof KtFile : "JetElement not inside JetFile: " + file + " " + file.getText();
|
||||||
return (KtFile) file;
|
return (KtFile) file;
|
||||||
@@ -68,7 +68,7 @@ public class KtElementImpl extends ASTWrapperPsiElement implements KtElement {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <R, D> R accept(@NotNull KtVisitor<R, D> visitor, D data) {
|
public <R, D> R accept(@NotNull KtVisitor<R, D> visitor, D data) {
|
||||||
return visitor.visitJetElement(this, data);
|
return visitor.visitKtElement(this, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class KtElementImplStub<T extends StubElement<?>> extends StubBasedPsiEle
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public KtFile getContainingJetFile() {
|
public KtFile getContainingKtFile() {
|
||||||
PsiFile file = getContainingFile();
|
PsiFile file = getContainingFile();
|
||||||
assert file instanceof KtFile : "JetElement not inside JetFile: " + file + " " + file.getText();
|
assert file instanceof KtFile : "JetElement not inside JetFile: " + file + " " + file.getText();
|
||||||
return (KtFile) file;
|
return (KtFile) file;
|
||||||
@@ -82,7 +82,7 @@ public class KtElementImplStub<T extends StubElement<?>> extends StubBasedPsiEle
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <R, D> R accept(@NotNull KtVisitor<R, D> visitor, D data) {
|
public <R, D> R accept(@NotNull KtVisitor<R, D> visitor, D data) {
|
||||||
return visitor.visitJetElement(this, data);
|
return visitor.visitKtElement(this, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import com.intellij.lang.PsiBuilderFactory;
|
|||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.parsing.JetParser;
|
import org.jetbrains.kotlin.parsing.KotlinParser;
|
||||||
import org.jetbrains.kotlin.psi.stubs.elements.KtFileElementType;
|
import org.jetbrains.kotlin.psi.stubs.elements.KtFileElementType;
|
||||||
|
|
||||||
public class KtExpressionCodeFragmentType extends KtFileElementType {
|
public class KtExpressionCodeFragmentType extends KtFileElementType {
|
||||||
@@ -44,6 +44,6 @@ public class KtExpressionCodeFragmentType extends KtFileElementType {
|
|||||||
Project project = psi.getProject();
|
Project project = psi.getProject();
|
||||||
Language languageForParser = getLanguageForParser(psi);
|
Language languageForParser = getLanguageForParser(psi);
|
||||||
PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, languageForParser, chameleon.getChars());
|
PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, languageForParser, chameleon.getChars());
|
||||||
return JetParser.parseExpressionCodeFragment(builder).getFirstChildNode();
|
return KotlinParser.parseExpressionCodeFragment(builder).getFirstChildNode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ public class KtFile extends PsiFileBase implements KtDeclarationContainer, KtAnn
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public KtFile getContainingJetFile() {
|
public KtFile getContainingKtFile() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ public class KtFile extends PsiFileBase implements KtDeclarationContainer, KtAnn
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <R, D> R accept(@NotNull KtVisitor<R, D> visitor, D data) {
|
public <R, D> R accept(@NotNull KtVisitor<R, D> visitor, D data) {
|
||||||
return visitor.visitJetFile(this, data);
|
return visitor.visitKtFile(this, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.psi;
|
|||||||
|
|
||||||
import com.intellij.lang.ASTNode;
|
import com.intellij.lang.ASTNode;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||||
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub;
|
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub;
|
||||||
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
|
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
|
||||||
|
|
||||||
@@ -47,6 +47,6 @@ public class KtFileAnnotationList extends KtElementImplStub<KotlinPlaceHolderStu
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<KtAnnotationEntry> getAnnotationEntries() {
|
public List<KtAnnotationEntry> getAnnotationEntries() {
|
||||||
return JetPsiUtilKt.collectAnnotationEntriesFromStubOrPsi(this);
|
return KtPsiUtilKt.collectAnnotationEntriesFromStubOrPsi(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import com.intellij.psi.stubs.IStubElementType;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken;
|
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken;
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||||
import org.jetbrains.kotlin.psi.stubs.KotlinModifierListStub;
|
import org.jetbrains.kotlin.psi.stubs.KotlinModifierListStub;
|
||||||
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
|
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ public abstract class KtModifierList extends KtElementImplStub<KotlinModifierLis
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<KtAnnotationEntry> getAnnotationEntries() {
|
public List<KtAnnotationEntry> getAnnotationEntries() {
|
||||||
return JetPsiUtilKt.collectAnnotationEntriesFromStubOrPsi(this);
|
return KtPsiUtilKt.collectAnnotationEntriesFromStubOrPsi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasModifier(@NotNull KtModifierKeywordToken tokenType) {
|
public boolean hasModifier(@NotNull KtModifierKeywordToken tokenType) {
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ import com.intellij.psi.impl.source.tree.TreeElement
|
|||||||
import org.jetbrains.kotlin.lexer.KtSingleValueToken
|
import org.jetbrains.kotlin.lexer.KtSingleValueToken
|
||||||
import org.jetbrains.kotlin.lexer.KtToken
|
import org.jetbrains.kotlin.lexer.KtToken
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.parsing.JetExpressionParsing
|
import org.jetbrains.kotlin.parsing.KotlinExpressionParsing
|
||||||
import org.jetbrains.kotlin.types.expressions.OperatorConventions
|
import org.jetbrains.kotlin.types.expressions.OperatorConventions
|
||||||
|
|
||||||
public class KtOperationReferenceExpression(node: ASTNode) : KtSimpleNameExpressionImpl(node) {
|
public class KtOperationReferenceExpression(node: ASTNode) : KtSimpleNameExpressionImpl(node) {
|
||||||
override fun getReferencedNameElement() = findChildByType<PsiElement?>(JetExpressionParsing.ALL_OPERATIONS) ?: this
|
override fun getReferencedNameElement() = findChildByType<PsiElement?>(KotlinExpressionParsing.ALL_OPERATIONS) ?: this
|
||||||
|
|
||||||
fun getNameForConventionalOperation(unaryOperations: Boolean = true, binaryOperations: Boolean = true): Name? {
|
fun getNameForConventionalOperation(unaryOperations: Boolean = true, binaryOperations: Boolean = true): Name? {
|
||||||
val operator = (firstChild as? TreeElement)?.elementType as? KtToken ?: return null
|
val operator = (firstChild as? TreeElement)?.elementType as? KtToken ?: return null
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.lexer.KtTokens;
|
|||||||
import org.jetbrains.kotlin.name.FqName;
|
import org.jetbrains.kotlin.name.FqName;
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
import org.jetbrains.kotlin.name.SpecialNames;
|
import org.jetbrains.kotlin.name.SpecialNames;
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||||
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub;
|
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub;
|
||||||
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
|
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ public class KtPackageDirective extends KtModifierListOwnerStub<KotlinPlaceHolde
|
|||||||
KtExpression nameExpression = getPackageNameExpression();
|
KtExpression nameExpression = getPackageNameExpression();
|
||||||
if (nameExpression == null) return null;
|
if (nameExpression == null) return null;
|
||||||
|
|
||||||
return (KtSimpleNameExpression) JetPsiUtilKt.getQualifiedElementSelector(nameExpression);
|
return (KtSimpleNameExpression) KtPsiUtilKt.getQualifiedElementSelector(nameExpression);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ import org.jetbrains.kotlin.lexer.KtTokens;
|
|||||||
import org.jetbrains.kotlin.name.FqName;
|
import org.jetbrains.kotlin.name.FqName;
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
import org.jetbrains.kotlin.name.SpecialNames;
|
import org.jetbrains.kotlin.name.SpecialNames;
|
||||||
import org.jetbrains.kotlin.parsing.JetExpressionParsing;
|
import org.jetbrains.kotlin.parsing.KotlinExpressionParsing;
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||||
import org.jetbrains.kotlin.resolve.StatementFilter;
|
import org.jetbrains.kotlin.resolve.StatementFilter;
|
||||||
import org.jetbrains.kotlin.resolve.StatementFilterKt;
|
import org.jetbrains.kotlin.resolve.StatementFilterKt;
|
||||||
import org.jetbrains.kotlin.types.expressions.OperatorConventions;
|
import org.jetbrains.kotlin.types.expressions.OperatorConventions;
|
||||||
@@ -115,7 +115,7 @@ public class KtPsiUtil {
|
|||||||
final Set<KtElement> shadowedElements = new HashSet<KtElement>();
|
final Set<KtElement> shadowedElements = new HashSet<KtElement>();
|
||||||
KtVisitorVoid shadowAllChildren = new KtVisitorVoid() {
|
KtVisitorVoid shadowAllChildren = new KtVisitorVoid() {
|
||||||
@Override
|
@Override
|
||||||
public void visitJetElement(@NotNull KtElement element) {
|
public void visitKtElement(@NotNull KtElement element) {
|
||||||
if (shadowedElements.add(element)) {
|
if (shadowedElements.add(element)) {
|
||||||
element.acceptChildren(this);
|
element.acceptChildren(this);
|
||||||
}
|
}
|
||||||
@@ -263,12 +263,12 @@ public class KtPsiUtil {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static KtSimpleNameExpression getLastReference(@NotNull KtExpression importedReference) {
|
public static KtSimpleNameExpression getLastReference(@NotNull KtExpression importedReference) {
|
||||||
KtElement selector = JetPsiUtilKt.getQualifiedElementSelector(importedReference);
|
KtElement selector = KtPsiUtilKt.getQualifiedElementSelector(importedReference);
|
||||||
return selector instanceof KtSimpleNameExpression ? (KtSimpleNameExpression) selector : null;
|
return selector instanceof KtSimpleNameExpression ? (KtSimpleNameExpression) selector : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSelectorInQualified(@NotNull KtSimpleNameExpression nameExpression) {
|
public static boolean isSelectorInQualified(@NotNull KtSimpleNameExpression nameExpression) {
|
||||||
KtElement qualifiedElement = JetPsiUtilKt.getQualifiedElement(nameExpression);
|
KtElement qualifiedElement = KtPsiUtilKt.getQualifiedElement(nameExpression);
|
||||||
return qualifiedElement instanceof KtQualifiedExpression
|
return qualifiedElement instanceof KtQualifiedExpression
|
||||||
|| ((qualifiedElement instanceof KtUserType) && ((KtUserType) qualifiedElement).getQualifier() != null);
|
|| ((qualifiedElement instanceof KtUserType) && ((KtUserType) qualifiedElement).getQualifier() != null);
|
||||||
}
|
}
|
||||||
@@ -426,7 +426,7 @@ public class KtPsiUtil {
|
|||||||
|
|
||||||
|
|
||||||
private static int getPriority(@NotNull KtExpression expression) {
|
private static int getPriority(@NotNull KtExpression expression) {
|
||||||
int maxPriority = JetExpressionParsing.Precedence.values().length + 1;
|
int maxPriority = KotlinExpressionParsing.Precedence.values().length + 1;
|
||||||
|
|
||||||
// same as postfix operations
|
// same as postfix operations
|
||||||
if (expression instanceof KtPostfixExpression ||
|
if (expression instanceof KtPostfixExpression ||
|
||||||
@@ -439,7 +439,7 @@ public class KtPsiUtil {
|
|||||||
if (expression instanceof KtPrefixExpression || expression instanceof KtLabeledExpression) return maxPriority - 2;
|
if (expression instanceof KtPrefixExpression || expression instanceof KtLabeledExpression) return maxPriority - 2;
|
||||||
|
|
||||||
if (expression instanceof KtIfExpression) {
|
if (expression instanceof KtIfExpression) {
|
||||||
return JetExpressionParsing.Precedence.ASSIGNMENT.ordinal();
|
return KotlinExpressionParsing.Precedence.ASSIGNMENT.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expression instanceof KtSuperExpression) {
|
if (expression instanceof KtSuperExpression) {
|
||||||
@@ -451,8 +451,8 @@ public class KtPsiUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IElementType operation = getOperation(expression);
|
IElementType operation = getOperation(expression);
|
||||||
for (JetExpressionParsing.Precedence precedence : JetExpressionParsing.Precedence.values()) {
|
for (KotlinExpressionParsing.Precedence precedence : KotlinExpressionParsing.Precedence.values()) {
|
||||||
if (precedence != JetExpressionParsing.Precedence.PREFIX && precedence != JetExpressionParsing.Precedence.POSTFIX &&
|
if (precedence != KotlinExpressionParsing.Precedence.PREFIX && precedence != KotlinExpressionParsing.Precedence.POSTFIX &&
|
||||||
precedence.getOperations().contains(operation)) {
|
precedence.getOperations().contains(operation)) {
|
||||||
return maxPriority - precedence.ordinal() - 1;
|
return maxPriority - precedence.ordinal() - 1;
|
||||||
}
|
}
|
||||||
@@ -498,7 +498,7 @@ public class KtPsiUtil {
|
|||||||
|
|
||||||
if (parentExpression instanceof KtCallExpression && currentInner == ((KtCallExpression) parentExpression).getCalleeExpression()) {
|
if (parentExpression instanceof KtCallExpression && currentInner == ((KtCallExpression) parentExpression).getCalleeExpression()) {
|
||||||
if (innerExpression instanceof KtSimpleNameExpression) return false;
|
if (innerExpression instanceof KtSimpleNameExpression) return false;
|
||||||
if (JetPsiUtilKt.getQualifiedExpressionForSelector(parentExpression) != null) return true;
|
if (KtPsiUtilKt.getQualifiedExpressionForSelector(parentExpression) != null) return true;
|
||||||
return !(innerExpression instanceof KtThisExpression
|
return !(innerExpression instanceof KtThisExpression
|
||||||
|| innerExpression instanceof KtArrayAccessExpression
|
|| innerExpression instanceof KtArrayAccessExpression
|
||||||
|| innerExpression instanceof KtConstantExpression
|
|| innerExpression instanceof KtConstantExpression
|
||||||
@@ -649,7 +649,7 @@ public class KtPsiUtil {
|
|||||||
root.accept(
|
root.accept(
|
||||||
new KtVisitorVoid() {
|
new KtVisitorVoid() {
|
||||||
@Override
|
@Override
|
||||||
public void visitJetElement(@NotNull KtElement element) {
|
public void visitKtElement(@NotNull KtElement element) {
|
||||||
if (predicate.apply(element)) {
|
if (predicate.apply(element)) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
results.add(element);
|
results.add(element);
|
||||||
@@ -709,7 +709,7 @@ public class KtPsiUtil {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static String getPackageName(@NotNull KtElement element) {
|
public static String getPackageName(@NotNull KtElement element) {
|
||||||
KtFile file = element.getContainingJetFile();
|
KtFile file = element.getContainingKtFile();
|
||||||
KtPackageDirective header = PsiTreeUtil.findChildOfType(file, KtPackageDirective.class);
|
KtPackageDirective header = PsiTreeUtil.findChildOfType(file, KtPackageDirective.class);
|
||||||
|
|
||||||
return header != null ? header.getQualifiedName() : null;
|
return header != null ? header.getQualifiedName() : null;
|
||||||
|
|||||||
@@ -20,14 +20,14 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
public class KtTreeVisitor<D> extends KtVisitor<Void, D> {
|
public class KtTreeVisitor<D> extends KtVisitor<Void, D> {
|
||||||
@Override
|
@Override
|
||||||
public Void visitJetElement(@NotNull KtElement element, D data) {
|
public Void visitKtElement(@NotNull KtElement element, D data) {
|
||||||
element.acceptChildren(this, data);
|
element.acceptChildren(this, data);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void visitJetFile(@NotNull KtFile file, D data) {
|
public Void visitKtFile(@NotNull KtFile file, D data) {
|
||||||
super.visitJetFile(file, data);
|
super.visitKtFile(file, data);
|
||||||
file.acceptChildren(this, data);
|
file.acceptChildren(this, data);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import com.intellij.lang.PsiBuilderFactory;
|
|||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.parsing.JetParser;
|
import org.jetbrains.kotlin.parsing.KotlinParser;
|
||||||
import org.jetbrains.kotlin.psi.stubs.elements.KtFileElementType;
|
import org.jetbrains.kotlin.psi.stubs.elements.KtFileElementType;
|
||||||
|
|
||||||
public class KtTypeCodeFragmentType extends KtFileElementType {
|
public class KtTypeCodeFragmentType extends KtFileElementType {
|
||||||
@@ -44,6 +44,6 @@ public class KtTypeCodeFragmentType extends KtFileElementType {
|
|||||||
Project project = psi.getProject();
|
Project project = psi.getProject();
|
||||||
Language languageForParser = getLanguageForParser(psi);
|
Language languageForParser = getLanguageForParser(psi);
|
||||||
PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, languageForParser, chameleon.getChars());
|
PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, languageForParser, chameleon.getChars());
|
||||||
return JetParser.parseTypeCodeFragment(builder).getFirstChildNode();
|
return KotlinParser.parseTypeCodeFragment(builder).getFirstChildNode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import com.intellij.psi.PsiElementVisitor;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class KtVisitor<R, D> extends PsiElementVisitor {
|
public class KtVisitor<R, D> extends PsiElementVisitor {
|
||||||
public R visitJetElement(@NotNull KtElement element, D data) {
|
public R visitKtElement(@NotNull KtElement element, D data) {
|
||||||
visitElement(element);
|
visitElement(element);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ public class KtVisitor<R, D> extends PsiElementVisitor {
|
|||||||
return visitNamedDeclaration(typedef, data);
|
return visitNamedDeclaration(typedef, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitJetFile(@NotNull KtFile file, D data) {
|
public R visitKtFile(@NotNull KtFile file, D data) {
|
||||||
visitFile(file);
|
visitFile(file);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -79,43 +79,43 @@ public class KtVisitor<R, D> extends PsiElementVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public R visitImportDirective(@NotNull KtImportDirective importDirective, D data) {
|
public R visitImportDirective(@NotNull KtImportDirective importDirective, D data) {
|
||||||
return visitJetElement(importDirective, data);
|
return visitKtElement(importDirective, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitImportList(@NotNull KtImportList importList, D data) {
|
public R visitImportList(@NotNull KtImportList importList, D data) {
|
||||||
return visitJetElement(importList, data);
|
return visitKtElement(importList, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitFileAnnotationList(@NotNull KtFileAnnotationList fileAnnotationList, D data) {
|
public R visitFileAnnotationList(@NotNull KtFileAnnotationList fileAnnotationList, D data) {
|
||||||
return visitJetElement(fileAnnotationList, data);
|
return visitKtElement(fileAnnotationList, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitClassBody(@NotNull KtClassBody classBody, D data) {
|
public R visitClassBody(@NotNull KtClassBody classBody, D data) {
|
||||||
return visitJetElement(classBody, data);
|
return visitKtElement(classBody, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitModifierList(@NotNull KtModifierList list, D data) {
|
public R visitModifierList(@NotNull KtModifierList list, D data) {
|
||||||
return visitJetElement(list, data);
|
return visitKtElement(list, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitAnnotation(@NotNull KtAnnotation annotation, D data) {
|
public R visitAnnotation(@NotNull KtAnnotation annotation, D data) {
|
||||||
return visitJetElement(annotation, data);
|
return visitKtElement(annotation, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitAnnotationEntry(@NotNull KtAnnotationEntry annotationEntry, D data) {
|
public R visitAnnotationEntry(@NotNull KtAnnotationEntry annotationEntry, D data) {
|
||||||
return visitJetElement(annotationEntry, data);
|
return visitKtElement(annotationEntry, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitAnnotationUseSiteTarget(@NotNull KtAnnotationUseSiteTarget annotationTarget, D data) {
|
public R visitAnnotationUseSiteTarget(@NotNull KtAnnotationUseSiteTarget annotationTarget, D data) {
|
||||||
return visitJetElement(annotationTarget, data);
|
return visitKtElement(annotationTarget, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitConstructorCalleeExpression(@NotNull KtConstructorCalleeExpression constructorCalleeExpression, D data) {
|
public R visitConstructorCalleeExpression(@NotNull KtConstructorCalleeExpression constructorCalleeExpression, D data) {
|
||||||
return visitJetElement(constructorCalleeExpression, data);
|
return visitKtElement(constructorCalleeExpression, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitTypeParameterList(@NotNull KtTypeParameterList list, D data) {
|
public R visitTypeParameterList(@NotNull KtTypeParameterList list, D data) {
|
||||||
return visitJetElement(list, data);
|
return visitKtElement(list, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitTypeParameter(@NotNull KtTypeParameter parameter, D data) {
|
public R visitTypeParameter(@NotNull KtTypeParameter parameter, D data) {
|
||||||
@@ -127,7 +127,7 @@ public class KtVisitor<R, D> extends PsiElementVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public R visitParameterList(@NotNull KtParameterList list, D data) {
|
public R visitParameterList(@NotNull KtParameterList list, D data) {
|
||||||
return visitJetElement(list, data);
|
return visitKtElement(list, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitParameter(@NotNull KtParameter parameter, D data) {
|
public R visitParameter(@NotNull KtParameter parameter, D data) {
|
||||||
@@ -135,11 +135,11 @@ public class KtVisitor<R, D> extends PsiElementVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public R visitDelegationSpecifierList(@NotNull KtDelegationSpecifierList list, D data) {
|
public R visitDelegationSpecifierList(@NotNull KtDelegationSpecifierList list, D data) {
|
||||||
return visitJetElement(list, data);
|
return visitKtElement(list, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitDelegationSpecifier(@NotNull KtDelegationSpecifier specifier, D data) {
|
public R visitDelegationSpecifier(@NotNull KtDelegationSpecifier specifier, D data) {
|
||||||
return visitJetElement(specifier, data);
|
return visitKtElement(specifier, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitDelegationByExpressionSpecifier(@NotNull KtDelegatorByExpressionSpecifier specifier, D data) {
|
public R visitDelegationByExpressionSpecifier(@NotNull KtDelegatorByExpressionSpecifier specifier, D data) {
|
||||||
@@ -155,27 +155,27 @@ public class KtVisitor<R, D> extends PsiElementVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public R visitConstructorDelegationCall(@NotNull KtConstructorDelegationCall call, D data) {
|
public R visitConstructorDelegationCall(@NotNull KtConstructorDelegationCall call, D data) {
|
||||||
return visitJetElement(call, data);
|
return visitKtElement(call, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitPropertyDelegate(@NotNull KtPropertyDelegate delegate, D data) {
|
public R visitPropertyDelegate(@NotNull KtPropertyDelegate delegate, D data) {
|
||||||
return visitJetElement(delegate, data);
|
return visitKtElement(delegate, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitTypeReference(@NotNull KtTypeReference typeReference, D data) {
|
public R visitTypeReference(@NotNull KtTypeReference typeReference, D data) {
|
||||||
return visitJetElement(typeReference, data);
|
return visitKtElement(typeReference, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitValueArgumentList(@NotNull KtValueArgumentList list, D data) {
|
public R visitValueArgumentList(@NotNull KtValueArgumentList list, D data) {
|
||||||
return visitJetElement(list, data);
|
return visitKtElement(list, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitArgument(@NotNull KtValueArgument argument, D data) {
|
public R visitArgument(@NotNull KtValueArgument argument, D data) {
|
||||||
return visitJetElement(argument, data);
|
return visitKtElement(argument, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitExpression(@NotNull KtExpression expression, D data) {
|
public R visitExpression(@NotNull KtExpression expression, D data) {
|
||||||
return visitJetElement(expression, data);
|
return visitKtElement(expression, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitLoopExpression(@NotNull KtLoopExpression loopExpression, D data) {
|
public R visitLoopExpression(@NotNull KtLoopExpression loopExpression, D data) {
|
||||||
@@ -311,15 +311,15 @@ public class KtVisitor<R, D> extends PsiElementVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public R visitCatchSection(@NotNull KtCatchClause catchClause, D data) {
|
public R visitCatchSection(@NotNull KtCatchClause catchClause, D data) {
|
||||||
return visitJetElement(catchClause, data);
|
return visitKtElement(catchClause, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitFinallySection(@NotNull KtFinallySection finallySection, D data) {
|
public R visitFinallySection(@NotNull KtFinallySection finallySection, D data) {
|
||||||
return visitJetElement(finallySection, data);
|
return visitKtElement(finallySection, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitTypeArgumentList(@NotNull KtTypeArgumentList typeArgumentList, D data) {
|
public R visitTypeArgumentList(@NotNull KtTypeArgumentList typeArgumentList, D data) {
|
||||||
return visitJetElement(typeArgumentList, data);
|
return visitKtElement(typeArgumentList, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitThisExpression(@NotNull KtThisExpression expression, D data) {
|
public R visitThisExpression(@NotNull KtThisExpression expression, D data) {
|
||||||
@@ -335,7 +335,7 @@ public class KtVisitor<R, D> extends PsiElementVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public R visitInitializerList(@NotNull KtInitializerList list, D data) {
|
public R visitInitializerList(@NotNull KtInitializerList list, D data) {
|
||||||
return visitJetElement(list, data);
|
return visitKtElement(list, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitAnonymousInitializer(@NotNull KtClassInitializer initializer, D data) {
|
public R visitAnonymousInitializer(@NotNull KtClassInitializer initializer, D data) {
|
||||||
@@ -347,15 +347,15 @@ public class KtVisitor<R, D> extends PsiElementVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public R visitTypeConstraintList(@NotNull KtTypeConstraintList list, D data) {
|
public R visitTypeConstraintList(@NotNull KtTypeConstraintList list, D data) {
|
||||||
return visitJetElement(list, data);
|
return visitKtElement(list, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitTypeConstraint(@NotNull KtTypeConstraint constraint, D data) {
|
public R visitTypeConstraint(@NotNull KtTypeConstraint constraint, D data) {
|
||||||
return visitJetElement(constraint, data);
|
return visitKtElement(constraint, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
private R visitTypeElement(@NotNull KtTypeElement type, D data) {
|
private R visitTypeElement(@NotNull KtTypeElement type, D data) {
|
||||||
return visitJetElement(type, data);
|
return visitKtElement(type, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitUserType(@NotNull KtUserType type, D data) {
|
public R visitUserType(@NotNull KtUserType type, D data) {
|
||||||
@@ -391,11 +391,11 @@ public class KtVisitor<R, D> extends PsiElementVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public R visitTypeProjection(@NotNull KtTypeProjection typeProjection, D data) {
|
public R visitTypeProjection(@NotNull KtTypeProjection typeProjection, D data) {
|
||||||
return visitJetElement(typeProjection, data);
|
return visitKtElement(typeProjection, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitWhenEntry(@NotNull KtWhenEntry jetWhenEntry, D data) {
|
public R visitWhenEntry(@NotNull KtWhenEntry jetWhenEntry, D data) {
|
||||||
return visitJetElement(jetWhenEntry, data);
|
return visitKtElement(jetWhenEntry, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitIsExpression(@NotNull KtIsExpression expression, D data) {
|
public R visitIsExpression(@NotNull KtIsExpression expression, D data) {
|
||||||
@@ -403,19 +403,19 @@ public class KtVisitor<R, D> extends PsiElementVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public R visitWhenConditionIsPattern(@NotNull KtWhenConditionIsPattern condition, D data) {
|
public R visitWhenConditionIsPattern(@NotNull KtWhenConditionIsPattern condition, D data) {
|
||||||
return visitJetElement(condition, data);
|
return visitKtElement(condition, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitWhenConditionInRange(@NotNull KtWhenConditionInRange condition, D data) {
|
public R visitWhenConditionInRange(@NotNull KtWhenConditionInRange condition, D data) {
|
||||||
return visitJetElement(condition, data);
|
return visitKtElement(condition, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitWhenConditionWithExpression(@NotNull KtWhenConditionWithExpression condition, D data) {
|
public R visitWhenConditionWithExpression(@NotNull KtWhenConditionWithExpression condition, D data) {
|
||||||
return visitJetElement(condition, data);
|
return visitKtElement(condition, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitStringTemplateEntry(@NotNull KtStringTemplateEntry entry, D data) {
|
public R visitStringTemplateEntry(@NotNull KtStringTemplateEntry entry, D data) {
|
||||||
return visitJetElement(entry, data);
|
return visitKtElement(entry, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R visitStringTemplateEntryWithExpression(@NotNull KtStringTemplateEntryWithExpression entry, D data) {
|
public R visitStringTemplateEntryWithExpression(@NotNull KtStringTemplateEntryWithExpression entry, D data) {
|
||||||
@@ -439,6 +439,6 @@ public class KtVisitor<R, D> extends PsiElementVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public R visitPackageDirective(@NotNull KtPackageDirective directive, D data) {
|
public R visitPackageDirective(@NotNull KtPackageDirective directive, D data) {
|
||||||
return visitJetElement(directive, data);
|
return visitKtElement(directive, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class KtVisitorVoid extends KtVisitor<Void, Void> {
|
public class KtVisitorVoid extends KtVisitor<Void, Void> {
|
||||||
// methods with void return
|
// methods with void return
|
||||||
|
|
||||||
public void visitJetElement(@NotNull KtElement element) {
|
public void visitKtElement(@NotNull KtElement element) {
|
||||||
super.visitJetElement(element, null);
|
super.visitKtElement(element, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitDeclaration(@NotNull KtDeclaration dcl) {
|
public void visitDeclaration(@NotNull KtDeclaration dcl) {
|
||||||
@@ -65,8 +65,8 @@ public class KtVisitorVoid extends KtVisitor<Void, Void> {
|
|||||||
super.visitTypedef(typedef, null);
|
super.visitTypedef(typedef, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitJetFile(@NotNull KtFile file) {
|
public void visitKtFile(@NotNull KtFile file) {
|
||||||
super.visitJetFile(file, null);
|
super.visitKtFile(file, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitScript(@NotNull KtScript script) {
|
public void visitScript(@NotNull KtScript script) {
|
||||||
@@ -431,8 +431,8 @@ public class KtVisitorVoid extends KtVisitor<Void, Void> {
|
|||||||
|
|
||||||
// hidden methods
|
// hidden methods
|
||||||
@Override
|
@Override
|
||||||
public final Void visitJetElement(@NotNull KtElement element, Void data) {
|
public final Void visitKtElement(@NotNull KtElement element, Void data) {
|
||||||
visitJetElement(element);
|
visitKtElement(element);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,8 +497,8 @@ public class KtVisitorVoid extends KtVisitor<Void, Void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Void visitJetFile(@NotNull KtFile file, Void data) {
|
public final Void visitKtFile(@NotNull KtFile file, Void data) {
|
||||||
visitJetFile(file);
|
visitKtFile(file);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class KtVisitorVoidWithParameter<P> extends KtVisitor<Void, P> {
|
|||||||
// methods with parameter
|
// methods with parameter
|
||||||
|
|
||||||
public void visitJetElementVoid(@NotNull KtElement element, P data) {
|
public void visitJetElementVoid(@NotNull KtElement element, P data) {
|
||||||
super.visitJetElement(element, data);
|
super.visitKtElement(element, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitDeclarationVoid(@NotNull KtDeclaration dcl, P data) {
|
public void visitDeclarationVoid(@NotNull KtDeclaration dcl, P data) {
|
||||||
@@ -63,7 +63,7 @@ public class KtVisitorVoidWithParameter<P> extends KtVisitor<Void, P> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void visitJetFileVoid(@NotNull KtFile file, P data) {
|
public void visitJetFileVoid(@NotNull KtFile file, P data) {
|
||||||
super.visitJetFile(file, data);
|
super.visitKtFile(file, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitScriptVoid(@NotNull KtScript script, P data) {
|
public void visitScriptVoid(@NotNull KtScript script, P data) {
|
||||||
@@ -424,7 +424,7 @@ public class KtVisitorVoidWithParameter<P> extends KtVisitor<Void, P> {
|
|||||||
|
|
||||||
// hidden methods
|
// hidden methods
|
||||||
@Override
|
@Override
|
||||||
public final Void visitJetElement(@NotNull KtElement element, P data) {
|
public final Void visitKtElement(@NotNull KtElement element, P data) {
|
||||||
visitJetElementVoid(element, data);
|
visitJetElementVoid(element, data);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -478,7 +478,7 @@ public class KtVisitorVoidWithParameter<P> extends KtVisitor<Void, P> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Void visitJetFile(@NotNull KtFile file, P data) {
|
public final Void visitKtFile(@NotNull KtFile file, P data) {
|
||||||
visitJetFileVoid(file, data);
|
visitJetFileVoid(file, data);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -294,8 +294,8 @@ private fun KtAnnotationsContainer.collectAnnotationEntriesFromPsi(): List<KtAnn
|
|||||||
// Note, that calls happen in order of DFS-exit, so deeper nodes are applied earlier
|
// Note, that calls happen in order of DFS-exit, so deeper nodes are applied earlier
|
||||||
public inline fun <reified T : KtElement> forEachDescendantOfTypeVisitor(noinline block: (T) -> Unit): KtVisitorVoid {
|
public inline fun <reified T : KtElement> forEachDescendantOfTypeVisitor(noinline block: (T) -> Unit): KtVisitorVoid {
|
||||||
return object : KtTreeVisitorVoid() {
|
return object : KtTreeVisitorVoid() {
|
||||||
override fun visitJetElement(element: KtElement) {
|
override fun visitKtElement(element: KtElement) {
|
||||||
super.visitJetElement(element)
|
super.visitKtElement(element)
|
||||||
if (element is T) {
|
if (element is T) {
|
||||||
block(element)
|
block(element)
|
||||||
}
|
}
|
||||||
+2
-2
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.kotlin.name.FqName;
|
import org.jetbrains.kotlin.name.FqName;
|
||||||
import org.jetbrains.kotlin.psi.KtClass;
|
import org.jetbrains.kotlin.psi.KtClass;
|
||||||
import org.jetbrains.kotlin.psi.KtEnumEntry;
|
import org.jetbrains.kotlin.psi.KtEnumEntry;
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||||
import org.jetbrains.kotlin.psi.stubs.KotlinClassStub;
|
import org.jetbrains.kotlin.psi.stubs.KotlinClassStub;
|
||||||
import org.jetbrains.kotlin.psi.stubs.impl.KotlinClassStubImpl;
|
import org.jetbrains.kotlin.psi.stubs.impl.KotlinClassStubImpl;
|
||||||
import org.jetbrains.kotlin.psi.stubs.impl.Utils;
|
import org.jetbrains.kotlin.psi.stubs.impl.Utils;
|
||||||
@@ -57,7 +57,7 @@ public class KtClassElementType extends KtStubElementType<KotlinClassStub, KtCla
|
|||||||
public KotlinClassStub createStub(@NotNull KtClass psi, StubElement parentStub) {
|
public KotlinClassStub createStub(@NotNull KtClass psi, StubElement parentStub) {
|
||||||
FqName fqName = ResolveSessionUtils.safeFqNameForLazyResolve(psi);
|
FqName fqName = ResolveSessionUtils.safeFqNameForLazyResolve(psi);
|
||||||
boolean isEnumEntry = psi instanceof KtEnumEntry;
|
boolean isEnumEntry = psi instanceof KtEnumEntry;
|
||||||
List<String> superNames = JetPsiUtilKt.getSuperNames(psi);
|
List<String> superNames = KtPsiUtilKt.getSuperNames(psi);
|
||||||
return new KotlinClassStubImpl(
|
return new KotlinClassStubImpl(
|
||||||
getStubType(isEnumEntry), parentStub, StringRef.fromString(fqName != null ? fqName.asString() : null),
|
getStubType(isEnumEntry), parentStub, StringRef.fromString(fqName != null ? fqName.asString() : null),
|
||||||
StringRef.fromString(psi.getName()), Utils.INSTANCE.wrapStrings(superNames), psi.isInterface(), isEnumEntry,
|
StringRef.fromString(psi.getName()), Utils.INSTANCE.wrapStrings(superNames), psi.isInterface(), isEnumEntry,
|
||||||
|
|||||||
+2
-2
@@ -28,7 +28,7 @@ import com.intellij.psi.tree.IStubFileElementType;
|
|||||||
import org.jetbrains.annotations.NonNls;
|
import org.jetbrains.annotations.NonNls;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.idea.KotlinLanguage;
|
import org.jetbrains.kotlin.idea.KotlinLanguage;
|
||||||
import org.jetbrains.kotlin.parsing.JetParser;
|
import org.jetbrains.kotlin.parsing.KotlinParser;
|
||||||
import org.jetbrains.kotlin.psi.stubs.KotlinFileStub;
|
import org.jetbrains.kotlin.psi.stubs.KotlinFileStub;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -79,7 +79,7 @@ public class KtFileElementType extends IStubFileElementType<KotlinFileStub> {
|
|||||||
Project project = psi.getProject();
|
Project project = psi.getProject();
|
||||||
Language languageForParser = getLanguageForParser(psi);
|
Language languageForParser = getLanguageForParser(psi);
|
||||||
PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, languageForParser, chameleon.getChars());
|
PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, languageForParser, chameleon.getChars());
|
||||||
JetParser parser = (JetParser) LanguageParserDefinitions.INSTANCE.forLanguage(languageForParser).createParser(project);
|
KotlinParser parser = (KotlinParser) LanguageParserDefinitions.INSTANCE.forLanguage(languageForParser).createParser(project);
|
||||||
return parser.parse(this, builder, psi.getContainingFile()).getFirstChildNode();
|
return parser.parse(this, builder, psi.getContainingFile()).getFirstChildNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.NonNls;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.name.FqName;
|
import org.jetbrains.kotlin.name.FqName;
|
||||||
import org.jetbrains.kotlin.psi.KtObjectDeclaration;
|
import org.jetbrains.kotlin.psi.KtObjectDeclaration;
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||||
import org.jetbrains.kotlin.psi.stubs.KotlinObjectStub;
|
import org.jetbrains.kotlin.psi.stubs.KotlinObjectStub;
|
||||||
import org.jetbrains.kotlin.psi.stubs.impl.KotlinObjectStubImpl;
|
import org.jetbrains.kotlin.psi.stubs.impl.KotlinObjectStubImpl;
|
||||||
import org.jetbrains.kotlin.psi.stubs.impl.Utils;
|
import org.jetbrains.kotlin.psi.stubs.impl.Utils;
|
||||||
@@ -43,7 +43,7 @@ public class KtObjectElementType extends KtStubElementType<KotlinObjectStub, KtO
|
|||||||
public KotlinObjectStub createStub(@NotNull KtObjectDeclaration psi, StubElement parentStub) {
|
public KotlinObjectStub createStub(@NotNull KtObjectDeclaration psi, StubElement parentStub) {
|
||||||
String name = psi.getName();
|
String name = psi.getName();
|
||||||
FqName fqName = ResolveSessionUtils.safeFqNameForLazyResolve(psi);
|
FqName fqName = ResolveSessionUtils.safeFqNameForLazyResolve(psi);
|
||||||
List<String> superNames = JetPsiUtilKt.getSuperNames(psi);
|
List<String> superNames = KtPsiUtilKt.getSuperNames(psi);
|
||||||
return new KotlinObjectStubImpl(parentStub, StringRef.fromString(name), fqName, Utils.INSTANCE.wrapStrings(superNames),
|
return new KotlinObjectStubImpl(parentStub, StringRef.fromString(name), fqName, Utils.INSTANCE.wrapStrings(superNames),
|
||||||
psi.isTopLevel(), psi.isCompanion(), psi.isLocal(), psi.isObjectLiteral());
|
psi.isTopLevel(), psi.isCompanion(), psi.isLocal(), psi.isObjectLiteral());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ public class BodyResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitJetElement(@NotNull KtElement element) {
|
public void visitKtElement(@NotNull KtElement element) {
|
||||||
throw new UnsupportedOperationException(element.getText() + " : " + element);
|
throw new UnsupportedOperationException(element.getText() + " : " + element);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -383,7 +383,7 @@ public class DescriptorResolver {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private KotlinType getVarargParameterType(@NotNull KotlinType elementType) {
|
private KotlinType getVarargParameterType(@NotNull KotlinType elementType) {
|
||||||
KotlinType primitiveArrayType = builtIns.getPrimitiveArrayJetTypeByPrimitiveJetType(elementType);
|
KotlinType primitiveArrayType = builtIns.getPrimitiveArrayKotlinTypeByPrimitiveKotlinType(elementType);
|
||||||
if (primitiveArrayType != null) {
|
if (primitiveArrayType != null) {
|
||||||
return primitiveArrayType;
|
return primitiveArrayType;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class LazyTopDownAnalyzer(
|
|||||||
throw IllegalArgumentException("Unsupported declaration: " + dcl + " " + dcl.getText())
|
throw IllegalArgumentException("Unsupported declaration: " + dcl + " " + dcl.getText())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitJetFile(file: KtFile) {
|
override fun visitKtFile(file: KtFile) {
|
||||||
if (file.isScript()) {
|
if (file.isScript()) {
|
||||||
val script = file.getScript() ?: throw AssertionError("getScript() is null for file: $file")
|
val script = file.getScript() ?: throw AssertionError("getScript() is null for file: $file")
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ public class LazyTopDownAnalyzer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun visitImportDirective(importDirective: KtImportDirective) {
|
override fun visitImportDirective(importDirective: KtImportDirective) {
|
||||||
val importResolver = fileScopeProvider.getImportResolver(importDirective.getContainingJetFile())
|
val importResolver = fileScopeProvider.getImportResolver(importDirective.getContainingKtFile())
|
||||||
importResolver.forceResolveImport(importDirective)
|
importResolver.forceResolveImport(importDirective)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -84,7 +84,7 @@ public class LazyTopDownAnalyzerForTopLevel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (KtScript script : c.getScripts().keySet()) {
|
for (KtScript script : c.getScripts().keySet()) {
|
||||||
resolveAndCheckImports(script.getContainingJetFile(), resolveSession);
|
resolveAndCheckImports(script.getContainingKtFile(), resolveSession);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ public class QualifiedExpressionResolver(val symbolUsageValidator: SymbolUsageVa
|
|||||||
val lastPart = path.lastOrNull() ?: return null
|
val lastPart = path.lastOrNull() ?: return null
|
||||||
val packageFragmentForCheck =
|
val packageFragmentForCheck =
|
||||||
if (packageFragmentForVisibilityCheck is DeclarationDescriptorWithSource && packageFragmentForVisibilityCheck.source == SourceElement.NO_SOURCE) {
|
if (packageFragmentForVisibilityCheck is DeclarationDescriptorWithSource && packageFragmentForVisibilityCheck.source == SourceElement.NO_SOURCE) {
|
||||||
PackageFragmentWithCustomSource(packageFragmentForVisibilityCheck, KotlinSourceElement(importDirective.getContainingJetFile()))
|
PackageFragmentWithCustomSource(packageFragmentForVisibilityCheck, KotlinSourceElement(importDirective.getContainingKtFile()))
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
@@ -411,7 +411,7 @@ public class QualifiedExpressionResolver(val symbolUsageValidator: SymbolUsageVa
|
|||||||
if (descriptor is DeclarationDescriptorWithVisibility) {
|
if (descriptor is DeclarationDescriptorWithVisibility) {
|
||||||
val fromToCheck =
|
val fromToCheck =
|
||||||
if (shouldBeVisibleFrom is PackageFragmentDescriptor && shouldBeVisibleFrom.source == SourceElement.NO_SOURCE) {
|
if (shouldBeVisibleFrom is PackageFragmentDescriptor && shouldBeVisibleFrom.source == SourceElement.NO_SOURCE) {
|
||||||
PackageFragmentWithCustomSource(shouldBeVisibleFrom, KotlinSourceElement(referenceExpression.getContainingJetFile()))
|
PackageFragmentWithCustomSource(shouldBeVisibleFrom, KotlinSourceElement(referenceExpression.getContainingKtFile()))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
shouldBeVisibleFrom
|
shouldBeVisibleFrom
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ package org.jetbrains.kotlin.resolve;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.name.FqName;
|
import org.jetbrains.kotlin.name.FqName;
|
||||||
import org.jetbrains.kotlin.parsing.JetScriptDefinition;
|
import org.jetbrains.kotlin.parsing.KotlinScriptDefinition;
|
||||||
import org.jetbrains.kotlin.parsing.JetScriptDefinitionProvider;
|
import org.jetbrains.kotlin.parsing.KotlinScriptDefinitionProvider;
|
||||||
import org.jetbrains.kotlin.psi.KtFile;
|
import org.jetbrains.kotlin.psi.KtFile;
|
||||||
import org.jetbrains.kotlin.psi.KtPackageDirective;
|
import org.jetbrains.kotlin.psi.KtPackageDirective;
|
||||||
import org.jetbrains.kotlin.psi.KtScript;
|
import org.jetbrains.kotlin.psi.KtScript;
|
||||||
@@ -30,8 +30,8 @@ public class ScriptNameUtil {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static FqName classNameForScript(KtScript script) {
|
public static FqName classNameForScript(KtScript script) {
|
||||||
KtFile file = script.getContainingJetFile();
|
KtFile file = script.getContainingKtFile();
|
||||||
JetScriptDefinition scriptDefinition = JetScriptDefinitionProvider.getInstance(file.getProject()).findScriptDefinition(file);
|
KotlinScriptDefinition scriptDefinition = KotlinScriptDefinitionProvider.getInstance(file.getProject()).findScriptDefinition(file);
|
||||||
|
|
||||||
String name = file.getName();
|
String name = file.getName();
|
||||||
int index = name.lastIndexOf('/');
|
int index = name.lastIndexOf('/');
|
||||||
|
|||||||
@@ -16,21 +16,21 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.resolve.typeBinding
|
package org.jetbrains.kotlin.resolve.typeBinding
|
||||||
|
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
|
||||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import org.jetbrains.kotlin.psi.KtTypeElement
|
|
||||||
import org.jetbrains.kotlin.psi.KtCallableDeclaration
|
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
|
||||||
import org.jetbrains.kotlin.psi.KtTypeReference
|
|
||||||
import org.jetbrains.kotlin.types.TypeProjection
|
|
||||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||||
|
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||||
|
import org.jetbrains.kotlin.psi.KtCallableDeclaration
|
||||||
|
import org.jetbrains.kotlin.psi.KtTypeElement
|
||||||
|
import org.jetbrains.kotlin.psi.KtTypeReference
|
||||||
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
|
import org.jetbrains.kotlin.types.TypeProjection
|
||||||
import org.jetbrains.kotlin.types.TypeProjectionImpl
|
import org.jetbrains.kotlin.types.TypeProjectionImpl
|
||||||
|
|
||||||
|
|
||||||
interface TypeBinding<out P : PsiElement> {
|
interface TypeBinding<out P : PsiElement> {
|
||||||
val psiElement: P
|
val psiElement: P
|
||||||
val jetType: KotlinType
|
val kotlinType: KotlinType
|
||||||
fun getArgumentBindings(): List<TypeArgumentBinding<P>?>
|
fun getArgumentBindings(): List<TypeArgumentBinding<P>?>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,15 +70,15 @@ private class TypeArgumentBindingImpl<out P: PsiElement>(
|
|||||||
private class ExplicitTypeBinding(
|
private class ExplicitTypeBinding(
|
||||||
private val trace: BindingContext,
|
private val trace: BindingContext,
|
||||||
override val psiElement: KtTypeElement,
|
override val psiElement: KtTypeElement,
|
||||||
override val jetType: KotlinType
|
override val kotlinType: KotlinType
|
||||||
) : TypeBinding<KtTypeElement> {
|
) : TypeBinding<KtTypeElement> {
|
||||||
|
|
||||||
override fun getArgumentBindings(): List<TypeArgumentBinding<KtTypeElement>?> {
|
override fun getArgumentBindings(): List<TypeArgumentBinding<KtTypeElement>?> {
|
||||||
val psiTypeArguments = psiElement.getTypeArgumentsAsTypes()
|
val psiTypeArguments = psiElement.getTypeArgumentsAsTypes()
|
||||||
val isErrorBinding = run {
|
val isErrorBinding = run {
|
||||||
val sizeIsEqual = psiTypeArguments.size() == jetType.getArguments().size()
|
val sizeIsEqual = psiTypeArguments.size() == kotlinType.getArguments().size()
|
||||||
&& psiTypeArguments.size() == jetType.getConstructor().getParameters().size()
|
&& psiTypeArguments.size() == kotlinType.getConstructor().getParameters().size()
|
||||||
jetType.isError() || !sizeIsEqual
|
kotlinType.isError() || !sizeIsEqual
|
||||||
}
|
}
|
||||||
|
|
||||||
return psiTypeArguments.indices.map { index: Int ->
|
return psiTypeArguments.indices.map { index: Int ->
|
||||||
@@ -98,10 +98,10 @@ private class ExplicitTypeBinding(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val typeProjection = jetType.getArguments()[index]
|
val typeProjection = kotlinType.getArguments()[index]
|
||||||
return@map TypeArgumentBindingImpl(
|
return@map TypeArgumentBindingImpl(
|
||||||
typeProjection,
|
typeProjection,
|
||||||
jetType.getConstructor().getParameters()[index],
|
kotlinType.getConstructor().getParameters()[index],
|
||||||
ExplicitTypeBinding(trace, jetTypeElement, typeProjection.getType())
|
ExplicitTypeBinding(trace, jetTypeElement, typeProjection.getType())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -111,16 +111,16 @@ private class ExplicitTypeBinding(
|
|||||||
private class NoTypeElementBinding<out P : PsiElement>(
|
private class NoTypeElementBinding<out P : PsiElement>(
|
||||||
private val trace: BindingContext,
|
private val trace: BindingContext,
|
||||||
override val psiElement: P,
|
override val psiElement: P,
|
||||||
override val jetType: KotlinType
|
override val kotlinType: KotlinType
|
||||||
): TypeBinding<P> {
|
): TypeBinding<P> {
|
||||||
|
|
||||||
override fun getArgumentBindings(): List<TypeArgumentBinding<P>?> {
|
override fun getArgumentBindings(): List<TypeArgumentBinding<P>?> {
|
||||||
val isErrorBinding = jetType.isError() || jetType.getConstructor().getParameters().size() != jetType.getArguments().size()
|
val isErrorBinding = kotlinType.isError() || kotlinType.getConstructor().getParameters().size() != kotlinType.getArguments().size()
|
||||||
return jetType.getArguments().indices.map {
|
return kotlinType.getArguments().indices.map {
|
||||||
val typeProjection = jetType.getArguments()[it]
|
val typeProjection = kotlinType.getArguments()[it]
|
||||||
TypeArgumentBindingImpl(
|
TypeArgumentBindingImpl(
|
||||||
typeProjection,
|
typeProjection,
|
||||||
if (isErrorBinding) null else jetType.getConstructor().getParameters()[it],
|
if (isErrorBinding) null else kotlinType.getConstructor().getParameters()[it],
|
||||||
NoTypeElementBinding(trace, psiElement, typeProjection.getType())
|
NoTypeElementBinding(trace, psiElement, typeProjection.getType())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ public class TypeResolver(
|
|||||||
c.trace.report(UNSUPPORTED.on(type, "Self-types are not supported"))
|
c.trace.report(UNSUPPORTED.on(type, "Self-types are not supported"))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitJetElement(element: KtElement) {
|
override fun visitKtElement(element: KtElement) {
|
||||||
c.trace.report(UNSUPPORTED.on(element, "Self-types are not supported yet"))
|
c.trace.report(UNSUPPORTED.on(element, "Self-types are not supported yet"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -156,14 +156,14 @@ class VarianceChecker(private val trace: BindingTrace) {
|
|||||||
= createTypeBinding(trace)?.checkTypePosition(position, diagnosticSink)
|
= createTypeBinding(trace)?.checkTypePosition(position, diagnosticSink)
|
||||||
|
|
||||||
private fun TypeBinding<PsiElement>.checkTypePosition(position: Variance, diagnosticSink: DiagnosticSink)
|
private fun TypeBinding<PsiElement>.checkTypePosition(position: Variance, diagnosticSink: DiagnosticSink)
|
||||||
= checkTypePosition(jetType, position, diagnosticSink)
|
= checkTypePosition(kotlinType, position, diagnosticSink)
|
||||||
|
|
||||||
private fun TypeBinding<PsiElement>.checkTypePosition(containingType: KotlinType, position: Variance, diagnosticSink: DiagnosticSink): Boolean {
|
private fun TypeBinding<PsiElement>.checkTypePosition(containingType: KotlinType, position: Variance, diagnosticSink: DiagnosticSink): Boolean {
|
||||||
val classifierDescriptor = jetType.getConstructor().getDeclarationDescriptor()
|
val classifierDescriptor = kotlinType.getConstructor().getDeclarationDescriptor()
|
||||||
if (classifierDescriptor is TypeParameterDescriptor) {
|
if (classifierDescriptor is TypeParameterDescriptor) {
|
||||||
val declarationVariance = classifierDescriptor.getVariance()
|
val declarationVariance = classifierDescriptor.getVariance()
|
||||||
if (!declarationVariance.allowsPosition(position)
|
if (!declarationVariance.allowsPosition(position)
|
||||||
&& !jetType.annotations.hasAnnotation(KotlinBuiltIns.FQ_NAMES.unsafeVariance)) {
|
&& !kotlinType.annotations.hasAnnotation(KotlinBuiltIns.FQ_NAMES.unsafeVariance)) {
|
||||||
diagnosticSink.report(
|
diagnosticSink.report(
|
||||||
Errors.TYPE_VARIANCE_CONFLICT.on(
|
Errors.TYPE_VARIANCE_CONFLICT.on(
|
||||||
psiElement,
|
psiElement,
|
||||||
|
|||||||
+1
-1
@@ -635,7 +635,7 @@ private class ConstantExpressionEvaluatorVisitor(
|
|||||||
return constants
|
return constants
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitJetElement(element: KtElement, expectedType: KotlinType?): CompileTimeConstant<*>? {
|
override fun visitKtElement(element: KtElement, expectedType: KotlinType?): CompileTimeConstant<*>? {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -48,8 +48,8 @@ public class InlineAnalyzerExtension implements FunctionAnalyzerExtension.Analyz
|
|||||||
|
|
||||||
KtVisitorVoid visitor = new KtVisitorVoid() {
|
KtVisitorVoid visitor = new KtVisitorVoid() {
|
||||||
@Override
|
@Override
|
||||||
public void visitJetElement(@NotNull KtElement element) {
|
public void visitKtElement(@NotNull KtElement element) {
|
||||||
super.visitJetElement(element);
|
super.visitKtElement(element);
|
||||||
element.acceptChildren(this);
|
element.acceptChildren(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -214,7 +214,7 @@ public class LazyDeclarationResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DeclarationDescriptor visitJetElement(@NotNull KtElement element, Void data) {
|
public DeclarationDescriptor visitKtElement(@NotNull KtElement element, Void data) {
|
||||||
throw new IllegalArgumentException("Unsupported declaration type: " + element + " " +
|
throw new IllegalArgumentException("Unsupported declaration type: " + element + " " +
|
||||||
PsiUtilsKt.getElementTextWithContext(element));
|
PsiUtilsKt.getElementTextWithContext(element));
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@ public class LazyPackageMemberScope(
|
|||||||
override fun getPackage(name: Name): PackageViewDescriptor? = null
|
override fun getPackage(name: Name): PackageViewDescriptor? = null
|
||||||
|
|
||||||
override fun getScopeForMemberDeclarationResolution(declaration: KtDeclaration)
|
override fun getScopeForMemberDeclarationResolution(declaration: KtDeclaration)
|
||||||
= resolveSession.getFileScopeProvider().getFileResolutionScope(declaration.getContainingJetFile())
|
= resolveSession.getFileScopeProvider().getFileResolutionScope(declaration.getContainingKtFile())
|
||||||
|
|
||||||
override fun getNonDeclaredFunctions(name: Name, result: MutableSet<FunctionDescriptor>) {
|
override fun getNonDeclaredFunctions(name: Name, result: MutableSet<FunctionDescriptor>) {
|
||||||
// No extra functions
|
// No extra functions
|
||||||
|
|||||||
+5
-5
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorNonRootImpl
|
|||||||
import org.jetbrains.kotlin.descriptors.impl.ReceiverParameterDescriptorImpl
|
import org.jetbrains.kotlin.descriptors.impl.ReceiverParameterDescriptorImpl
|
||||||
import org.jetbrains.kotlin.descriptors.impl.ScriptCodeDescriptor
|
import org.jetbrains.kotlin.descriptors.impl.ScriptCodeDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
|
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
|
||||||
import org.jetbrains.kotlin.parsing.JetScriptDefinitionProvider
|
import org.jetbrains.kotlin.parsing.KotlinScriptDefinitionProvider
|
||||||
import org.jetbrains.kotlin.psi.KtScript
|
import org.jetbrains.kotlin.psi.KtScript
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
import org.jetbrains.kotlin.resolve.ScriptBodyResolver
|
import org.jetbrains.kotlin.resolve.ScriptBodyResolver
|
||||||
@@ -45,7 +45,7 @@ public class LazyScriptDescriptor(
|
|||||||
private val jetScript: KtScript,
|
private val jetScript: KtScript,
|
||||||
private val priority: Int
|
private val priority: Int
|
||||||
) : ScriptDescriptor, LazyEntity, DeclarationDescriptorNonRootImpl(
|
) : ScriptDescriptor, LazyEntity, DeclarationDescriptorNonRootImpl(
|
||||||
jetScript.getContainingJetFile().getPackageFqName().let {
|
jetScript.getContainingKtFile().getPackageFqName().let {
|
||||||
fqName ->
|
fqName ->
|
||||||
resolveSession.getPackageFragment(fqName).sure { "Package not found $fqName" }
|
resolveSession.getPackageFragment(fqName).sure { "Package not found $fqName" }
|
||||||
},
|
},
|
||||||
@@ -70,8 +70,8 @@ public class LazyScriptDescriptor(
|
|||||||
private val scriptCodeDescriptor = resolveSession.storageManager.createLazyValue {
|
private val scriptCodeDescriptor = resolveSession.storageManager.createLazyValue {
|
||||||
val result = ScriptCodeDescriptor(this)
|
val result = ScriptCodeDescriptor(this)
|
||||||
|
|
||||||
val file = jetScript.getContainingJetFile()
|
val file = jetScript.getContainingKtFile()
|
||||||
val scriptDefinition = JetScriptDefinitionProvider.getInstance(file.getProject()).findScriptDefinition(file)
|
val scriptDefinition = KotlinScriptDefinitionProvider.getInstance(file.getProject()).findScriptDefinition(file)
|
||||||
|
|
||||||
result.initialize(
|
result.initialize(
|
||||||
implicitReceiver,
|
implicitReceiver,
|
||||||
@@ -86,7 +86,7 @@ public class LazyScriptDescriptor(
|
|||||||
},
|
},
|
||||||
DeferredType.create(resolveSession.storageManager, resolveSession.trace) {
|
DeferredType.create(resolveSession.storageManager, resolveSession.trace) {
|
||||||
val scope = LexicalScopeImpl(
|
val scope = LexicalScopeImpl(
|
||||||
resolveSession.fileScopeProvider.getFileResolutionScope(jetScript.getContainingJetFile()),
|
resolveSession.fileScopeProvider.getFileResolutionScope(jetScript.getContainingKtFile()),
|
||||||
this, false, implicitReceiver, "Scope for body resolution for $this"
|
this, false, implicitReceiver, "Scope for body resolution for $this"
|
||||||
) {
|
) {
|
||||||
for (valueParameterDescriptor in result.valueParameters) {
|
for (valueParameterDescriptor in result.valueParameters) {
|
||||||
|
|||||||
+1
-1
@@ -1465,7 +1465,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KotlinTypeInfo visitJetElement(@NotNull KtElement element, ExpressionTypingContext context) {
|
public KotlinTypeInfo visitKtElement(@NotNull KtElement element, ExpressionTypingContext context) {
|
||||||
context.trace.report(UNSUPPORTED.on(element, getClass().getCanonicalName()));
|
context.trace.report(UNSUPPORTED.on(element, getClass().getCanonicalName()));
|
||||||
return TypeInfoFactoryKt.noTypeInfo(context);
|
return TypeInfoFactoryKt.noTypeInfo(context);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -399,7 +399,7 @@ public abstract class ExpressionTypingVisitorDispatcher extends KtVisitor<Kotlin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KotlinTypeInfo visitJetElement(@NotNull KtElement element, ExpressionTypingContext data) {
|
public KotlinTypeInfo visitKtElement(@NotNull KtElement element, ExpressionTypingContext data) {
|
||||||
return element.accept(basic, data);
|
return element.accept(basic, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -373,7 +373,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KotlinTypeInfo visitJetElement(@NotNull KtElement element, ExpressionTypingContext context) {
|
public KotlinTypeInfo visitKtElement(@NotNull KtElement element, ExpressionTypingContext context) {
|
||||||
context.trace.report(UNSUPPORTED.on(element, "in a block"));
|
context.trace.report(UNSUPPORTED.on(element, "in a block"));
|
||||||
return TypeInfoFactoryKt.noTypeInfo(context);
|
return TypeInfoFactoryKt.noTypeInfo(context);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -236,7 +236,7 @@ public class PatternMatchingTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitJetElement(@NotNull KtElement element) {
|
public void visitKtElement(@NotNull KtElement element) {
|
||||||
context.trace.report(UNSUPPORTED.on(element, getClass().getCanonicalName()));
|
context.trace.report(UNSUPPORTED.on(element, getClass().getCanonicalName()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@ import org.jetbrains.kotlin.psi.KtFile;
|
|||||||
* <p/>
|
* <p/>
|
||||||
* See {@link LineBreakpoint#findClassCandidatesInSourceContent} for the primary usage this was introduced
|
* See {@link LineBreakpoint#findClassCandidatesInSourceContent} for the primary usage this was introduced
|
||||||
*/
|
*/
|
||||||
public class FakeLightClassForFileOfPackage extends AbstractLightClass implements KtLightClass, JetJavaMirrorMarker {
|
public class FakeLightClassForFileOfPackage extends AbstractLightClass implements KtLightClass, KtJavaMirrorMarker {
|
||||||
private final KtLightClassForFacade delegate;
|
private final KtLightClassForFacade delegate;
|
||||||
private final KtFile file;
|
private final KtFile file;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -165,7 +165,7 @@ public class KotlinJavaFileStubProvider<T extends WithFileStubAndExtraDiagnostic
|
|||||||
classOrObject.isLocal(),
|
classOrObject.isLocal(),
|
||||||
new StubGenerationStrategy<OutermostKotlinClassLightClassData>() {
|
new StubGenerationStrategy<OutermostKotlinClassLightClassData>() {
|
||||||
private KtFile getFile() {
|
private KtFile getFile() {
|
||||||
return classOrObject.getContainingJetFile();
|
return classOrObject.getContainingKtFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -292,7 +292,7 @@ public class KotlinJavaFileStubProvider<T extends WithFileStubAndExtraDiagnostic
|
|||||||
@Override
|
@Override
|
||||||
public void generate(@NotNull GenerationState state, @NotNull Collection<KtFile> files) {
|
public void generate(@NotNull GenerationState state, @NotNull Collection<KtFile> files) {
|
||||||
PackageCodegen packageCodegen = state.getFactory().forPackage(getPackageFqName(), files);
|
PackageCodegen packageCodegen = state.getFactory().forPackage(getPackageFqName(), files);
|
||||||
KtFile file = classOrObject.getContainingJetFile();
|
KtFile file = classOrObject.getContainingKtFile();
|
||||||
Type packagePartType = FileClasses.getFileClassType(state.getFileClassesProvider(), file);
|
Type packagePartType = FileClasses.getFileClassType(state.getFileClassesProvider(), file);
|
||||||
PackageContext context = state.getRootContext().intoPackagePart(packageCodegen.getPackageFragment(), packagePartType, file);
|
PackageContext context = state.getRootContext().intoPackagePart(packageCodegen.getPackageFragment(), packagePartType, file);
|
||||||
packageCodegen.generateClassOrObject(classOrObject, context);
|
packageCodegen.generateClassOrObject(classOrObject, context);
|
||||||
|
|||||||
+3
-3
@@ -51,7 +51,7 @@ public open class KtLightClassForExplicitDeclaration(
|
|||||||
manager: PsiManager,
|
manager: PsiManager,
|
||||||
protected val classFqName: FqName, // FqName of (possibly inner) class
|
protected val classFqName: FqName, // FqName of (possibly inner) class
|
||||||
protected val classOrObject: KtClassOrObject)
|
protected val classOrObject: KtClassOrObject)
|
||||||
: KtWrappingLightClass(manager), JetJavaMirrorMarker, StubBasedPsiElement<KotlinClassOrObjectStub<out KtClassOrObject>> {
|
: KtWrappingLightClass(manager), KtJavaMirrorMarker, StubBasedPsiElement<KotlinClassOrObjectStub<out KtClassOrObject>> {
|
||||||
private var delegate: PsiClass? = null
|
private var delegate: PsiClass? = null
|
||||||
|
|
||||||
private fun getLocalClassParent(): PsiElement? {
|
private fun getLocalClassParent(): PsiElement? {
|
||||||
@@ -179,7 +179,7 @@ public open class KtLightClassForExplicitDeclaration(
|
|||||||
val virtualFile = classOrObject.containingFile.virtualFile
|
val virtualFile = classOrObject.containingFile.virtualFile
|
||||||
assert(virtualFile != null) { "No virtual file for " + classOrObject.text }
|
assert(virtualFile != null) { "No virtual file for " + classOrObject.text }
|
||||||
|
|
||||||
object : FakeFileForLightClass(classOrObject.getContainingJetFile().packageFqName, virtualFile, myManager, this, { getJavaFileStub() }) {
|
object : FakeFileForLightClass(classOrObject.getContainingKtFile().packageFqName, virtualFile, myManager, this, { getJavaFileStub() }) {
|
||||||
override fun processDeclarations(
|
override fun processDeclarations(
|
||||||
processor: PsiScopeProcessor,
|
processor: PsiScopeProcessor,
|
||||||
state: ResolveState,
|
state: ResolveState,
|
||||||
@@ -391,7 +391,7 @@ public open class KtLightClassForExplicitDeclaration(
|
|||||||
classOrObject: KtClassOrObject,
|
classOrObject: KtClassOrObject,
|
||||||
psiClass: PsiClass? = null
|
psiClass: PsiClass? = null
|
||||||
): KtLightClassForExplicitDeclaration? {
|
): KtLightClassForExplicitDeclaration? {
|
||||||
if (LightClassUtil.belongsToKotlinBuiltIns(classOrObject.getContainingJetFile())) {
|
if (LightClassUtil.belongsToKotlinBuiltIns(classOrObject.getContainingKtFile())) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class KtLightClassForFacade private constructor(
|
|||||||
private val lightClassDataCache: CachedValue<KotlinFacadeLightClassData>,
|
private val lightClassDataCache: CachedValue<KotlinFacadeLightClassData>,
|
||||||
files: Collection<KtFile>,
|
files: Collection<KtFile>,
|
||||||
private val deprecated: Boolean
|
private val deprecated: Boolean
|
||||||
) : KtWrappingLightClass(manager), JetJavaMirrorMarker {
|
) : KtWrappingLightClass(manager), KtJavaMirrorMarker {
|
||||||
|
|
||||||
private data class StubCacheKey(val fqName: FqName, val searchScope: GlobalSearchScope)
|
private data class StubCacheKey(val fqName: FqName, val searchScope: GlobalSearchScope)
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.idea.KotlinLanguage;
|
import org.jetbrains.kotlin.idea.KotlinLanguage;
|
||||||
import org.jetbrains.kotlin.psi.*;
|
import org.jetbrains.kotlin.psi.*;
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ public class KtLightParameter extends LightParameter implements KtLightElement<K
|
|||||||
KtDeclaration declaration = method.getOrigin();
|
KtDeclaration declaration = method.getOrigin();
|
||||||
if (declaration == null) return null;
|
if (declaration == null) return null;
|
||||||
|
|
||||||
int jetIndex = JetPsiUtilKt.isExtensionDeclaration(declaration) ? index - 1 : index;
|
int jetIndex = KtPsiUtilKt.isExtensionDeclaration(declaration) ? index - 1 : index;
|
||||||
if (jetIndex < 0) return null;
|
if (jetIndex < 0) return null;
|
||||||
|
|
||||||
if (declaration instanceof KtFunction) {
|
if (declaration instanceof KtFunction) {
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ public abstract class AbstractPseudoValueTest : AbstractPseudocodeTest() {
|
|||||||
fun getElementToValueMap(pseudocode: PseudocodeImpl): Map<KtElement, PseudoValue> {
|
fun getElementToValueMap(pseudocode: PseudocodeImpl): Map<KtElement, PseudoValue> {
|
||||||
val elementToValues = LinkedHashMap<KtElement, PseudoValue>()
|
val elementToValues = LinkedHashMap<KtElement, PseudoValue>()
|
||||||
pseudocode.getCorrespondingElement().accept(object : KtTreeVisitorVoid() {
|
pseudocode.getCorrespondingElement().accept(object : KtTreeVisitorVoid() {
|
||||||
override fun visitJetElement(element: KtElement) {
|
override fun visitKtElement(element: KtElement) {
|
||||||
super.visitJetElement(element)
|
super.visitKtElement(element)
|
||||||
|
|
||||||
val value = pseudocode.getElementValue(element)
|
val value = pseudocode.getElementValue(element)
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||||
import org.jetbrains.kotlin.checkers.CheckerTestUtil;
|
import org.jetbrains.kotlin.checkers.CheckerTestUtil;
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
import org.jetbrains.kotlin.parsing.JetScriptDefinition;
|
import org.jetbrains.kotlin.parsing.KotlinScriptDefinition;
|
||||||
import org.jetbrains.kotlin.parsing.JetScriptDefinitionProvider;
|
import org.jetbrains.kotlin.parsing.KotlinScriptDefinitionProvider;
|
||||||
import org.jetbrains.kotlin.psi.KtFile;
|
import org.jetbrains.kotlin.psi.KtFile;
|
||||||
import org.jetbrains.kotlin.resolve.AnalyzerScriptParameter;
|
import org.jetbrains.kotlin.resolve.AnalyzerScriptParameter;
|
||||||
import org.jetbrains.kotlin.resolve.AnalyzingUtils;
|
import org.jetbrains.kotlin.resolve.AnalyzingUtils;
|
||||||
@@ -156,8 +156,8 @@ public class CodegenTestFiles {
|
|||||||
scriptParameterValues.add(value);
|
scriptParameterValues.add(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
JetScriptDefinitionProvider.getInstance(project).addScriptDefinition(
|
KotlinScriptDefinitionProvider.getInstance(project).addScriptDefinition(
|
||||||
new JetScriptDefinition(
|
new KotlinScriptDefinition(
|
||||||
".kts",
|
".kts",
|
||||||
scriptParameterTypes
|
scriptParameterTypes
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -16,10 +16,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.codegen;
|
package org.jetbrains.kotlin.codegen;
|
||||||
|
|
||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
import org.jetbrains.kotlin.parsing.JetScriptDefinition;
|
import org.jetbrains.kotlin.parsing.KotlinScriptDefinition;
|
||||||
import org.jetbrains.kotlin.parsing.JetScriptDefinitionProvider;
|
import org.jetbrains.kotlin.parsing.KotlinScriptDefinitionProvider;
|
||||||
import org.jetbrains.kotlin.resolve.AnalyzerScriptParameter;
|
import org.jetbrains.kotlin.resolve.AnalyzerScriptParameter;
|
||||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform;
|
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform;
|
||||||
import org.jetbrains.kotlin.test.ConfigurationKind;
|
import org.jetbrains.kotlin.test.ConfigurationKind;
|
||||||
@@ -30,15 +29,15 @@ import java.lang.reflect.Field;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
public class ScriptGenTest extends CodegenTestCase {
|
public class ScriptGenTest extends CodegenTestCase {
|
||||||
private static final JetScriptDefinition FIB_SCRIPT_DEFINITION =
|
private static final KotlinScriptDefinition FIB_SCRIPT_DEFINITION =
|
||||||
new JetScriptDefinition(".lang.kt",
|
new KotlinScriptDefinition(".lang.kt",
|
||||||
new AnalyzerScriptParameter(Name.identifier("num"), JvmPlatform.INSTANCE$.getBuiltIns().getIntType()));
|
new AnalyzerScriptParameter(Name.identifier("num"), JvmPlatform.INSTANCE$.getBuiltIns().getIntType()));
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||||
JetScriptDefinitionProvider.getInstance(myEnvironment.getProject()).addScriptDefinition(FIB_SCRIPT_DEFINITION);
|
KotlinScriptDefinitionProvider.getInstance(myEnvironment.getProject()).addScriptDefinition(FIB_SCRIPT_DEFINITION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLanguage() throws Exception {
|
public void testLanguage() throws Exception {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public abstract class AbstractParsingTest extends ParsingTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public AbstractParsingTest() {
|
public AbstractParsingTest() {
|
||||||
super(".", "kt", new JetParserDefinition());
|
super(".", "kt", new KotlinParserDefinition());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkPsiGetters(KtElement elem) throws Throwable {
|
private static void checkPsiGetters(KtElement elem) throws Throwable {
|
||||||
@@ -83,7 +83,7 @@ public abstract class AbstractParsingTest extends ParsingTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void doParsingTest(@NotNull String filePath) throws Exception {
|
protected void doParsingTest(@NotNull String filePath) throws Exception {
|
||||||
doBaseTest(filePath, KtNodeTypes.JET_FILE);
|
doBaseTest(filePath, KtNodeTypes.KT_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doExpressionCodeFragmentParsingTest(@NotNull String filePath) throws Exception {
|
protected void doExpressionCodeFragmentParsingTest(@NotNull String filePath) throws Exception {
|
||||||
@@ -100,7 +100,7 @@ public abstract class AbstractParsingTest extends ParsingTestCase {
|
|||||||
|
|
||||||
myFile.acceptChildren(new KtVisitorVoid() {
|
myFile.acceptChildren(new KtVisitorVoid() {
|
||||||
@Override
|
@Override
|
||||||
public void visitJetElement(@NotNull KtElement element) {
|
public void visitKtElement(@NotNull KtElement element) {
|
||||||
element.acceptChildren(this);
|
element.acceptChildren(this);
|
||||||
try {
|
try {
|
||||||
checkPsiGetters(element);
|
checkPsiGetters(element);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public abstract class AbstractDescriptorRendererTest : KotlinTestWithEnvironment
|
|||||||
val descriptors = ArrayList<DeclarationDescriptor>()
|
val descriptors = ArrayList<DeclarationDescriptor>()
|
||||||
|
|
||||||
psiFile.accept(object : KtVisitorVoid() {
|
psiFile.accept(object : KtVisitorVoid() {
|
||||||
override fun visitJetFile(file: KtFile) {
|
override fun visitKtFile(file: KtFile) {
|
||||||
val fqName = file.getPackageFqName()
|
val fqName = file.getPackageFqName()
|
||||||
if (!fqName.isRoot()) {
|
if (!fqName.isRoot()) {
|
||||||
val packageDescriptor = context.module.getPackage(fqName)
|
val packageDescriptor = context.module.getPackage(fqName)
|
||||||
@@ -126,7 +126,7 @@ public abstract class AbstractDescriptorRendererTest : KotlinTestWithEnvironment
|
|||||||
element.acceptChildren(this)
|
element.acceptChildren(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitJetElement(element: KtElement) {
|
override fun visitKtElement(element: KtElement) {
|
||||||
element.acceptChildren(this)
|
element.acceptChildren(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ class MutableDiagnosticsTest : KotlinTestWithEnvironment() {
|
|||||||
val dummyElement = KtPsiFactory(getEnvironment().project).createType("Int")
|
val dummyElement = KtPsiFactory(getEnvironment().project).createType("Int")
|
||||||
|
|
||||||
init {
|
init {
|
||||||
dummyElement.getContainingJetFile().doNotAnalyze = null
|
dummyElement.getContainingKtFile().doNotAnalyze = null
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFactory() = unimplemented()
|
override fun getFactory() = unimplemented()
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ import org.jetbrains.kotlin.config.CommonConfigurationKeys;
|
|||||||
import org.jetbrains.kotlin.config.CompilerConfiguration;
|
import org.jetbrains.kotlin.config.CompilerConfiguration;
|
||||||
import org.jetbrains.kotlin.config.ContentRootsKt;
|
import org.jetbrains.kotlin.config.ContentRootsKt;
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
import org.jetbrains.kotlin.parsing.JetScriptDefinition;
|
import org.jetbrains.kotlin.parsing.KotlinScriptDefinition;
|
||||||
import org.jetbrains.kotlin.parsing.JetScriptDefinitionProvider;
|
import org.jetbrains.kotlin.parsing.KotlinScriptDefinitionProvider;
|
||||||
import org.jetbrains.kotlin.resolve.AnalyzerScriptParameter;
|
import org.jetbrains.kotlin.resolve.AnalyzerScriptParameter;
|
||||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform;
|
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform;
|
||||||
import org.jetbrains.kotlin.test.ConfigurationKind;
|
import org.jetbrains.kotlin.test.ConfigurationKind;
|
||||||
@@ -49,14 +49,14 @@ import java.util.List;
|
|||||||
public class ScriptTest {
|
public class ScriptTest {
|
||||||
@Test
|
@Test
|
||||||
public void testScript() throws Exception {
|
public void testScript() throws Exception {
|
||||||
Class<?> aClass = compileScript("fib.kts", numIntParam(), Collections.<JetScriptDefinition>emptyList());
|
Class<?> aClass = compileScript("fib.kts", numIntParam(), Collections.<KotlinScriptDefinition>emptyList());
|
||||||
Assert.assertNotNull(aClass);
|
Assert.assertNotNull(aClass);
|
||||||
aClass.getConstructor(int.class).newInstance(4);
|
aClass.getConstructor(int.class).newInstance(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testScriptWithPackage() throws Exception {
|
public void testScriptWithPackage() throws Exception {
|
||||||
Class<?> aClass = compileScript("fib.pkg.kts", numIntParam(), Collections.<JetScriptDefinition>emptyList());
|
Class<?> aClass = compileScript("fib.pkg.kts", numIntParam(), Collections.<KotlinScriptDefinition>emptyList());
|
||||||
Assert.assertNotNull(aClass);
|
Assert.assertNotNull(aClass);
|
||||||
aClass.getConstructor(int.class).newInstance(4);
|
aClass.getConstructor(int.class).newInstance(4);
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@ public class ScriptTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testScriptWithScriptDefinition() throws Exception {
|
public void testScriptWithScriptDefinition() throws Exception {
|
||||||
Class<?> aClass = compileScript("fib.fib.kt", null,
|
Class<?> aClass = compileScript("fib.fib.kt", null,
|
||||||
Collections.singletonList(new JetScriptDefinition(".fib.kt", numIntParam())));
|
Collections.singletonList(new KotlinScriptDefinition(".fib.kt", numIntParam())));
|
||||||
Assert.assertNotNull(aClass);
|
Assert.assertNotNull(aClass);
|
||||||
aClass.getConstructor(int.class).newInstance(4);
|
aClass.getConstructor(int.class).newInstance(4);
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ public class ScriptTest {
|
|||||||
private static Class<?> compileScript(
|
private static Class<?> compileScript(
|
||||||
@NotNull String scriptPath,
|
@NotNull String scriptPath,
|
||||||
@Nullable List<AnalyzerScriptParameter> scriptParameters,
|
@Nullable List<AnalyzerScriptParameter> scriptParameters,
|
||||||
@NotNull List<JetScriptDefinition> scriptDefinitions
|
@NotNull List<KotlinScriptDefinition> scriptDefinitions
|
||||||
) {
|
) {
|
||||||
KotlinPaths paths = PathUtil.getKotlinPathsForDistDirectory();
|
KotlinPaths paths = PathUtil.getKotlinPathsForDistDirectory();
|
||||||
MessageCollector messageCollector = PrintingMessageCollector.PLAIN_TEXT_TO_SYSTEM_ERR;
|
MessageCollector messageCollector = PrintingMessageCollector.PLAIN_TEXT_TO_SYSTEM_ERR;
|
||||||
@@ -91,7 +91,7 @@ public class ScriptTest {
|
|||||||
KotlinCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
KotlinCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
JetScriptDefinitionProvider.getInstance(environment.getProject()).markFileAsScript(environment.getSourceFiles().get(0));
|
KotlinScriptDefinitionProvider.getInstance(environment.getProject()).markFileAsScript(environment.getSourceFiles().get(0));
|
||||||
return KotlinToJVMBytecodeCompiler.compileScript(configuration, paths, environment);
|
return KotlinToJVMBytecodeCompiler.compileScript(configuration, paths, environment);
|
||||||
}
|
}
|
||||||
catch (CompilationException e) {
|
catch (CompilationException e) {
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ abstract class AbstractTypeBindingTest : KotlinLiteFixture() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
println("psi: ${binding.psiElement.getText()}")
|
println("psi: ${binding.psiElement.getText()}")
|
||||||
println("type: ${binding.jetType.render()}")
|
println("type: ${binding.kotlinType.render()}")
|
||||||
|
|
||||||
printCollection(binding.getArgumentBindings()) {
|
printCollection(binding.getArgumentBindings()) {
|
||||||
print(it)
|
print(it)
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public class DefaultModalityModifiersTest extends KotlinLiteFixture {
|
|||||||
ResolveSession resolveSession = createLazyResolveSession(
|
ResolveSession resolveSession = createLazyResolveSession(
|
||||||
moduleContext,
|
moduleContext,
|
||||||
new FileBasedDeclarationProviderFactory(moduleContext.getStorageManager(),
|
new FileBasedDeclarationProviderFactory(moduleContext.getStorageManager(),
|
||||||
Collections.singleton(aClass.getContainingJetFile())),
|
Collections.singleton(aClass.getContainingKtFile())),
|
||||||
new BindingTraceContext(),
|
new BindingTraceContext(),
|
||||||
TargetPlatform.Default.INSTANCE$
|
TargetPlatform.Default.INSTANCE$
|
||||||
);
|
);
|
||||||
|
|||||||
+2
-2
@@ -50,7 +50,7 @@ class LazyJavaTypeResolver(
|
|||||||
return when (javaType) {
|
return when (javaType) {
|
||||||
is JavaPrimitiveType -> {
|
is JavaPrimitiveType -> {
|
||||||
val primitiveType = javaType.getType()
|
val primitiveType = javaType.getType()
|
||||||
if (primitiveType != null) c.module.builtIns.getPrimitiveJetType(primitiveType)
|
if (primitiveType != null) c.module.builtIns.getPrimitiveKotlinType(primitiveType)
|
||||||
else c.module.builtIns.getUnitType()
|
else c.module.builtIns.getUnitType()
|
||||||
}
|
}
|
||||||
is JavaClassifierType ->
|
is JavaClassifierType ->
|
||||||
@@ -70,7 +70,7 @@ class LazyJavaTypeResolver(
|
|||||||
val javaComponentType = arrayType.getComponentType()
|
val javaComponentType = arrayType.getComponentType()
|
||||||
val primitiveType = (javaComponentType as? JavaPrimitiveType)?.getType()
|
val primitiveType = (javaComponentType as? JavaPrimitiveType)?.getType()
|
||||||
if (primitiveType != null) {
|
if (primitiveType != null) {
|
||||||
val jetType = c.module.builtIns.getPrimitiveArrayJetType(primitiveType)
|
val jetType = c.module.builtIns.getPrimitiveArrayKotlinType(primitiveType)
|
||||||
return@run if (PLATFORM_TYPES && attr.allowFlexible)
|
return@run if (PLATFORM_TYPES && attr.allowFlexible)
|
||||||
FlexibleJavaClassifierTypeCapabilities.create(jetType, TypeUtils.makeNullable(jetType))
|
FlexibleJavaClassifierTypeCapabilities.create(jetType, TypeUtils.makeNullable(jetType))
|
||||||
else TypeUtils.makeNullableAsSpecified(jetType, !attr.isMarkedNotNull)
|
else TypeUtils.makeNullableAsSpecified(jetType, !attr.isMarkedNotNull)
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ public abstract class KotlinBuiltIns {
|
|||||||
private final BuiltinsPackageFragment builtinsPackageFragment;
|
private final BuiltinsPackageFragment builtinsPackageFragment;
|
||||||
private final BuiltinsPackageFragment annotationPackageFragment;
|
private final BuiltinsPackageFragment annotationPackageFragment;
|
||||||
|
|
||||||
private final Map<PrimitiveType, KotlinType> primitiveTypeToArrayJetType;
|
private final Map<PrimitiveType, KotlinType> primitiveTypeToArrayKotlinType;
|
||||||
private final Map<KotlinType, KotlinType> primitiveJetTypeToJetArrayType;
|
private final Map<KotlinType, KotlinType> primitiveKotlinTypeToKotlinArrayType;
|
||||||
private final Map<KotlinType, KotlinType> jetArrayTypeToPrimitiveJetType;
|
private final Map<KotlinType, KotlinType> kotlinArrayTypeToPrimitiveKotlinType;
|
||||||
|
|
||||||
public static final FqNames FQ_NAMES = new FqNames();
|
public static final FqNames FQ_NAMES = new FqNames();
|
||||||
|
|
||||||
@@ -91,9 +91,9 @@ public abstract class KotlinBuiltIns {
|
|||||||
builtinsPackageFragment = (BuiltinsPackageFragment) single(packageFragmentProvider.getPackageFragments(BUILT_INS_PACKAGE_FQ_NAME));
|
builtinsPackageFragment = (BuiltinsPackageFragment) single(packageFragmentProvider.getPackageFragments(BUILT_INS_PACKAGE_FQ_NAME));
|
||||||
annotationPackageFragment = (BuiltinsPackageFragment) single(packageFragmentProvider.getPackageFragments(ANNOTATION_PACKAGE_FQ_NAME));
|
annotationPackageFragment = (BuiltinsPackageFragment) single(packageFragmentProvider.getPackageFragments(ANNOTATION_PACKAGE_FQ_NAME));
|
||||||
|
|
||||||
primitiveTypeToArrayJetType = new EnumMap<PrimitiveType, KotlinType>(PrimitiveType.class);
|
primitiveTypeToArrayKotlinType = new EnumMap<PrimitiveType, KotlinType>(PrimitiveType.class);
|
||||||
primitiveJetTypeToJetArrayType = new HashMap<KotlinType, KotlinType>();
|
primitiveKotlinTypeToKotlinArrayType = new HashMap<KotlinType, KotlinType>();
|
||||||
jetArrayTypeToPrimitiveJetType = new HashMap<KotlinType, KotlinType>();
|
kotlinArrayTypeToPrimitiveKotlinType = new HashMap<KotlinType, KotlinType>();
|
||||||
for (PrimitiveType primitive : PrimitiveType.values()) {
|
for (PrimitiveType primitive : PrimitiveType.values()) {
|
||||||
makePrimitive(primitive);
|
makePrimitive(primitive);
|
||||||
}
|
}
|
||||||
@@ -108,9 +108,9 @@ public abstract class KotlinBuiltIns {
|
|||||||
KotlinType type = getBuiltInTypeByClassName(primitiveType.getTypeName().asString());
|
KotlinType type = getBuiltInTypeByClassName(primitiveType.getTypeName().asString());
|
||||||
KotlinType arrayType = getBuiltInTypeByClassName(primitiveType.getArrayTypeName().asString());
|
KotlinType arrayType = getBuiltInTypeByClassName(primitiveType.getArrayTypeName().asString());
|
||||||
|
|
||||||
primitiveTypeToArrayJetType.put(primitiveType, arrayType);
|
primitiveTypeToArrayKotlinType.put(primitiveType, arrayType);
|
||||||
primitiveJetTypeToJetArrayType.put(type, arrayType);
|
primitiveKotlinTypeToKotlinArrayType.put(type, arrayType);
|
||||||
jetArrayTypeToPrimitiveJetType.put(arrayType, type);
|
kotlinArrayTypeToPrimitiveKotlinType.put(arrayType, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class FqNames {
|
public static class FqNames {
|
||||||
@@ -569,48 +569,48 @@ public abstract class KotlinBuiltIns {
|
|||||||
// Primitive
|
// Primitive
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public KotlinType getPrimitiveJetType(@NotNull PrimitiveType type) {
|
public KotlinType getPrimitiveKotlinType(@NotNull PrimitiveType type) {
|
||||||
return getPrimitiveClassDescriptor(type).getDefaultType();
|
return getPrimitiveClassDescriptor(type).getDefaultType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public KotlinType getByteType() {
|
public KotlinType getByteType() {
|
||||||
return getPrimitiveJetType(BYTE);
|
return getPrimitiveKotlinType(BYTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public KotlinType getShortType() {
|
public KotlinType getShortType() {
|
||||||
return getPrimitiveJetType(SHORT);
|
return getPrimitiveKotlinType(SHORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public KotlinType getIntType() {
|
public KotlinType getIntType() {
|
||||||
return getPrimitiveJetType(INT);
|
return getPrimitiveKotlinType(INT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public KotlinType getLongType() {
|
public KotlinType getLongType() {
|
||||||
return getPrimitiveJetType(LONG);
|
return getPrimitiveKotlinType(LONG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public KotlinType getFloatType() {
|
public KotlinType getFloatType() {
|
||||||
return getPrimitiveJetType(FLOAT);
|
return getPrimitiveKotlinType(FLOAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public KotlinType getDoubleType() {
|
public KotlinType getDoubleType() {
|
||||||
return getPrimitiveJetType(DOUBLE);
|
return getPrimitiveKotlinType(DOUBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public KotlinType getCharType() {
|
public KotlinType getCharType() {
|
||||||
return getPrimitiveJetType(CHAR);
|
return getPrimitiveKotlinType(CHAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public KotlinType getBooleanType() {
|
public KotlinType getBooleanType() {
|
||||||
return getPrimitiveJetType(BOOLEAN);
|
return getPrimitiveKotlinType(BOOLEAN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recognized
|
// Recognized
|
||||||
@@ -633,7 +633,7 @@ public abstract class KotlinBuiltIns {
|
|||||||
}
|
}
|
||||||
return arrayType.getArguments().get(0).getType();
|
return arrayType.getArguments().get(0).getType();
|
||||||
}
|
}
|
||||||
KotlinType primitiveType = jetArrayTypeToPrimitiveJetType.get(TypeUtils.makeNotNullable(arrayType));
|
KotlinType primitiveType = kotlinArrayTypeToPrimitiveKotlinType.get(TypeUtils.makeNotNullable(arrayType));
|
||||||
if (primitiveType == null) {
|
if (primitiveType == null) {
|
||||||
throw new IllegalStateException("not array: " + arrayType);
|
throw new IllegalStateException("not array: " + arrayType);
|
||||||
}
|
}
|
||||||
@@ -641,16 +641,16 @@ public abstract class KotlinBuiltIns {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public KotlinType getPrimitiveArrayJetType(@NotNull PrimitiveType primitiveType) {
|
public KotlinType getPrimitiveArrayKotlinType(@NotNull PrimitiveType primitiveType) {
|
||||||
return primitiveTypeToArrayJetType.get(primitiveType);
|
return primitiveTypeToArrayKotlinType.get(primitiveType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code null} if not primitive
|
* @return {@code null} if not primitive
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public KotlinType getPrimitiveArrayJetTypeByPrimitiveJetType(@NotNull KotlinType jetType) {
|
public KotlinType getPrimitiveArrayKotlinTypeByPrimitiveKotlinType(@NotNull KotlinType kotlinType) {
|
||||||
return primitiveJetTypeToJetArrayType.get(jetType);
|
return primitiveKotlinTypeToKotlinArrayType.get(kotlinType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPrimitiveArray(@NotNull FqNameUnsafe arrayFqName) {
|
public static boolean isPrimitiveArray(@NotNull FqNameUnsafe arrayFqName) {
|
||||||
|
|||||||
+1
-1
@@ -100,7 +100,7 @@ public class AnnotationDeserializer(private val module: ModuleDescriptor) {
|
|||||||
val actualArrayType =
|
val actualArrayType =
|
||||||
if (arrayElements.isNotEmpty()) {
|
if (arrayElements.isNotEmpty()) {
|
||||||
val actualElementType = resolveArrayElementType(arrayElements.first(), nameResolver)
|
val actualElementType = resolveArrayElementType(arrayElements.first(), nameResolver)
|
||||||
builtIns.getPrimitiveArrayJetTypeByPrimitiveJetType(actualElementType) ?:
|
builtIns.getPrimitiveArrayKotlinTypeByPrimitiveKotlinType(actualElementType) ?:
|
||||||
builtIns.getArrayType(Variance.INVARIANT, actualElementType)
|
builtIns.getArrayType(Variance.INVARIANT, actualElementType)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -430,7 +430,7 @@ class PartialBodyResolveFilter(
|
|||||||
* Recursively visits code but does not enter constructs that may not affect smart casts/control flow
|
* Recursively visits code but does not enter constructs that may not affect smart casts/control flow
|
||||||
*/
|
*/
|
||||||
private abstract class ControlFlowVisitor : KtVisitorVoid() {
|
private abstract class ControlFlowVisitor : KtVisitorVoid() {
|
||||||
override fun visitJetElement(element: KtElement) {
|
override fun visitKtElement(element: KtElement) {
|
||||||
if (element.noControlFlowInside()) return
|
if (element.noControlFlowInside()) return
|
||||||
element.acceptChildren(this)
|
element.acceptChildren(this)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -267,7 +267,7 @@ public class IDELightClassGenerationSupport(private val project: Project) : Ligh
|
|||||||
if (decompiledClassOrObject is KtEnumEntry) {
|
if (decompiledClassOrObject is KtEnumEntry) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
val containingJetFile = decompiledClassOrObject.getContainingJetFile()
|
val containingJetFile = decompiledClassOrObject.getContainingKtFile()
|
||||||
if (!containingJetFile.isCompiled) {
|
if (!containingJetFile.isCompiled) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@@ -282,12 +282,12 @@ public class IDELightClassGenerationSupport(private val project: Project) : Ligh
|
|||||||
val relativeFqName = getClassRelativeName(decompiledClassOrObject)
|
val relativeFqName = getClassRelativeName(decompiledClassOrObject)
|
||||||
val iterator = relativeFqName.pathSegments().iterator()
|
val iterator = relativeFqName.pathSegments().iterator()
|
||||||
val base = iterator.next()
|
val base = iterator.next()
|
||||||
assert(rootLightClassForDecompiledFile.name == base.asString()) { "Light class for file:\n" + decompiledClassOrObject.getContainingJetFile().virtualFile.canonicalPath + "\nwas expected to have name: " + base.asString() + "\n Actual: " + rootLightClassForDecompiledFile.name }
|
assert(rootLightClassForDecompiledFile.name == base.asString()) { "Light class for file:\n" + decompiledClassOrObject.getContainingKtFile().virtualFile.canonicalPath + "\nwas expected to have name: " + base.asString() + "\n Actual: " + rootLightClassForDecompiledFile.name }
|
||||||
var current = rootLightClassForDecompiledFile
|
var current = rootLightClassForDecompiledFile
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
val name = iterator.next()
|
val name = iterator.next()
|
||||||
val innerClass = current.findInnerClassByName(name.asString(), false).sure {
|
val innerClass = current.findInnerClassByName(name.asString(), false).sure {
|
||||||
"Could not find corresponding inner/nested class " + relativeFqName + " in class " + decompiledClassOrObject.fqName + "\n" + "File: " + decompiledClassOrObject.getContainingJetFile().virtualFile.name
|
"Could not find corresponding inner/nested class " + relativeFqName + " in class " + decompiledClassOrObject.fqName + "\n" + "File: " + decompiledClassOrObject.getContainingKtFile().virtualFile.name
|
||||||
}
|
}
|
||||||
current = innerClass
|
current = innerClass
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -47,7 +47,7 @@ public class KotlinCacheService(val project: Project) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public fun getResolutionFacade(elements: List<KtElement>): ResolutionFacade {
|
public fun getResolutionFacade(elements: List<KtElement>): ResolutionFacade {
|
||||||
return getFacadeToAnalyzeFiles(elements.map { it.getContainingJetFile() })
|
return getFacadeToAnalyzeFiles(elements.map { it.getContainingKtFile() })
|
||||||
}
|
}
|
||||||
|
|
||||||
private val globalFacadesPerPlatform = listOf(JvmPlatform, JsPlatform).keysToMap { platform -> GlobalFacade(platform) }
|
private val globalFacadesPerPlatform = listOf(JvmPlatform, JsPlatform).keysToMap { platform -> GlobalFacade(platform) }
|
||||||
@@ -185,7 +185,7 @@ public class KotlinCacheService(val project: Project) {
|
|||||||
|
|
||||||
private fun KtCodeFragment.getContextFile(): KtFile? {
|
private fun KtCodeFragment.getContextFile(): KtFile? {
|
||||||
val contextElement = getContext() ?: return null
|
val contextElement = getContext() ?: return null
|
||||||
val contextFile = (contextElement as? KtElement)?.getContainingJetFile()
|
val contextFile = (contextElement as? KtElement)?.getContainingKtFile()
|
||||||
?: throw AssertionError("Analyzing kotlin code fragment of type $javaClass with java context of type ${contextElement.javaClass}")
|
?: throw AssertionError("Analyzing kotlin code fragment of type $javaClass with java context of type ${contextElement.javaClass}")
|
||||||
return if (contextFile is KtCodeFragment) contextFile.getContextFile() else contextFile
|
return if (contextFile is KtCodeFragment) contextFile.getContextFile() else contextFile
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -67,7 +67,7 @@ internal class PerFileAnalysisCache(val file: KtFile, val componentProvider: Com
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getAnalysisResults(element: KtElement): AnalysisResult {
|
fun getAnalysisResults(element: KtElement): AnalysisResult {
|
||||||
assert (element.getContainingJetFile() == file) { "Wrong file. Expected $file, but was ${element.getContainingJetFile()}" }
|
assert (element.getContainingKtFile() == file) { "Wrong file. Expected $file, but was ${element.getContainingKtFile()}" }
|
||||||
|
|
||||||
val analyzableParent = KotlinResolveDataProvider.findAnalyzableParent(element)
|
val analyzableParent = KotlinResolveDataProvider.findAnalyzableParent(element)
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ private object KotlinResolveDataProvider {
|
|||||||
// if none of the above worked, take the outermost declaration
|
// if none of the above worked, take the outermost declaration
|
||||||
?: PsiTreeUtil.getTopmostParentOfType(element, javaClass<KtDeclaration>())
|
?: PsiTreeUtil.getTopmostParentOfType(element, javaClass<KtDeclaration>())
|
||||||
// if even that didn't work, take the whole file
|
// if even that didn't work, take the whole file
|
||||||
?: element.getContainingJetFile()
|
?: element.getContainingKtFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun analyze(project: Project, componentProvider: ComponentProvider, analyzableElement: KtElement): AnalysisResult {
|
fun analyze(project: Project, componentProvider: ComponentProvider, analyzableElement: KtElement): AnalysisResult {
|
||||||
@@ -152,7 +152,7 @@ private object KotlinResolveDataProvider {
|
|||||||
return AnalysisResult.success(analyzeExpressionCodeFragment(componentProvider, analyzableElement), module)
|
return AnalysisResult.success(analyzeExpressionCodeFragment(componentProvider, analyzableElement), module)
|
||||||
}
|
}
|
||||||
|
|
||||||
val file = analyzableElement.getContainingJetFile()
|
val file = analyzableElement.getContainingKtFile()
|
||||||
if (LightClassUtil.belongsToKotlinBuiltIns(file) || file.getModuleInfo() is LibrarySourceInfo) {
|
if (LightClassUtil.belongsToKotlinBuiltIns(file) || file.getModuleInfo() is LibrarySourceInfo) {
|
||||||
// Library sources: mark file to skip
|
// Library sources: mark file to skip
|
||||||
file.putUserData(LibrarySourceHacks.SKIP_TOP_LEVEL_MEMBERS, true)
|
file.putUserData(LibrarySourceHacks.SKIP_TOP_LEVEL_MEMBERS, true)
|
||||||
@@ -161,7 +161,7 @@ private object KotlinResolveDataProvider {
|
|||||||
val resolveSession = componentProvider.get<ResolveSession>()
|
val resolveSession = componentProvider.get<ResolveSession>()
|
||||||
val trace = DelegatingBindingTrace(resolveSession.getBindingContext(), "Trace for resolution of " + analyzableElement)
|
val trace = DelegatingBindingTrace(resolveSession.getBindingContext(), "Trace for resolution of " + analyzableElement)
|
||||||
|
|
||||||
val targetPlatform = TargetPlatformDetector.getPlatform(analyzableElement.getContainingJetFile())
|
val targetPlatform = TargetPlatformDetector.getPlatform(analyzableElement.getContainingKtFile())
|
||||||
|
|
||||||
val lazyTopDownAnalyzer = createContainerForLazyBodyResolve(
|
val lazyTopDownAnalyzer = createContainerForLazyBodyResolve(
|
||||||
//TODO: should get ModuleContext
|
//TODO: should get ModuleContext
|
||||||
|
|||||||
+1
-1
@@ -71,7 +71,7 @@ internal class ProjectResolutionFacade(
|
|||||||
}
|
}
|
||||||
val results = elements.map {
|
val results = elements.map {
|
||||||
val perFileCache = synchronized(slruCache) {
|
val perFileCache = synchronized(slruCache) {
|
||||||
slruCache[it.getContainingJetFile()]
|
slruCache[it.getContainingKtFile()]
|
||||||
}
|
}
|
||||||
perFileCache.getAnalysisResults(it)
|
perFileCache.getAnalysisResults(it)
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -92,7 +92,7 @@ public class SourceNavigationHelper {
|
|||||||
@NotNull KtNamedDeclaration declaration,
|
@NotNull KtNamedDeclaration declaration,
|
||||||
@NotNull NavigationKind navigationKind
|
@NotNull NavigationKind navigationKind
|
||||||
) {
|
) {
|
||||||
KtFile containingFile = declaration.getContainingJetFile();
|
KtFile containingFile = declaration.getContainingKtFile();
|
||||||
VirtualFile libraryFile = containingFile.getVirtualFile();
|
VirtualFile libraryFile = containingFile.getVirtualFile();
|
||||||
if (libraryFile == null) return GlobalSearchScope.EMPTY_SCOPE;
|
if (libraryFile == null) return GlobalSearchScope.EMPTY_SCOPE;
|
||||||
|
|
||||||
@@ -365,7 +365,7 @@ public class SourceNavigationHelper {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static PsiClass getOriginalPsiClassOrCreateLightClass(@NotNull KtClassOrObject classOrObject) {
|
public static PsiClass getOriginalPsiClassOrCreateLightClass(@NotNull KtClassOrObject classOrObject) {
|
||||||
if (LightClassUtil.INSTANCE$.belongsToKotlinBuiltIns(classOrObject.getContainingJetFile())) {
|
if (LightClassUtil.INSTANCE$.belongsToKotlinBuiltIns(classOrObject.getContainingKtFile())) {
|
||||||
FqName fqName = classOrObject.getFqName();
|
FqName fqName = classOrObject.getFqName();
|
||||||
if (fqName != null) {
|
if (fqName != null) {
|
||||||
ClassId javaClassId = JavaToKotlinClassMap.INSTANCE.mapKotlinToJava(fqName.toUnsafe());
|
ClassId javaClassId = JavaToKotlinClassMap.INSTANCE.mapKotlinToJava(fqName.toUnsafe());
|
||||||
@@ -389,7 +389,7 @@ public class SourceNavigationHelper {
|
|||||||
}
|
}
|
||||||
String fqName = JvmClassName.byInternalName(internalName).getFqNameForClassNameWithoutDollars().asString();
|
String fqName = JvmClassName.byInternalName(internalName).getFqNameForClassNameWithoutDollars().asString();
|
||||||
|
|
||||||
KtFile file = classOrObject.getContainingJetFile();
|
KtFile file = classOrObject.getContainingKtFile();
|
||||||
|
|
||||||
VirtualFile vFile = file.getVirtualFile();
|
VirtualFile vFile = file.getVirtualFile();
|
||||||
Project project = file.getProject();
|
Project project = file.getProject();
|
||||||
@@ -444,10 +444,10 @@ public class SourceNavigationHelper {
|
|||||||
|
|
||||||
switch (navigationKind) {
|
switch (navigationKind) {
|
||||||
case CLASS_FILES_TO_SOURCES:
|
case CLASS_FILES_TO_SOURCES:
|
||||||
if (!from.getContainingJetFile().isCompiled()) return from;
|
if (!from.getContainingKtFile().isCompiled()) return from;
|
||||||
break;
|
break;
|
||||||
case SOURCES_TO_CLASS_FILES:
|
case SOURCES_TO_CLASS_FILES:
|
||||||
if (from.getContainingJetFile().isCompiled()) return from;
|
if (from.getContainingKtFile().isCompiled()) return from;
|
||||||
if (!ProjectRootsUtil.isInContent(from, false, true, false)) return from;
|
if (!ProjectRootsUtil.isInContent(from, false, true, false)) return from;
|
||||||
if (KtPsiUtil.isLocal(from)) return from;
|
if (KtPsiUtil.isLocal(from)) return from;
|
||||||
break;
|
break;
|
||||||
|
|||||||
+2
-2
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.psi.KtClassOrObject;
|
|||||||
import org.jetbrains.kotlin.psi.KtDynamicType;
|
import org.jetbrains.kotlin.psi.KtDynamicType;
|
||||||
import org.jetbrains.kotlin.psi.KtSimpleNameExpression;
|
import org.jetbrains.kotlin.psi.KtSimpleNameExpression;
|
||||||
import org.jetbrains.kotlin.psi.KtTypeParameter;
|
import org.jetbrains.kotlin.psi.KtTypeParameter;
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||||
|
|
||||||
class TypeKindHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
class TypeKindHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||||
@@ -58,7 +58,7 @@ class TypeKindHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void highlightAnnotation(@NotNull KtSimpleNameExpression expression) {
|
private void highlightAnnotation(@NotNull KtSimpleNameExpression expression) {
|
||||||
TextRange toHighlight = JetPsiUtilKt.getCalleeHighlightingRange(expression);
|
TextRange toHighlight = KtPsiUtilKt.getCalleeHighlightingRange(expression);
|
||||||
NameHighlighter.highlightName(holder, toHighlight, KotlinHighlightingColors.ANNOTATION);
|
NameHighlighter.highlightName(holder, toHighlight, KotlinHighlightingColors.ANNOTATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,4 +20,4 @@ import org.jetbrains.kotlin.psi.KtElement
|
|||||||
import org.jetbrains.kotlin.resolve.TargetPlatform
|
import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||||
|
|
||||||
val KtElement.platform: TargetPlatform
|
val KtElement.platform: TargetPlatform
|
||||||
get() = TargetPlatformDetector.getPlatform(getContainingJetFile())
|
get() = TargetPlatformDetector.getPlatform(getContainingKtFile())
|
||||||
@@ -114,7 +114,7 @@ public class ResolveElementCache(
|
|||||||
= getElementAdditionalResolve(function, function, BodyResolveMode.FULL)
|
= getElementAdditionalResolve(function, function, BodyResolveMode.FULL)
|
||||||
|
|
||||||
public fun resolvePrimaryConstructorParametersDefaultValues(ktClass: KtClass): BindingContext {
|
public fun resolvePrimaryConstructorParametersDefaultValues(ktClass: KtClass): BindingContext {
|
||||||
return constructorAdditionalResolve(resolveSession, ktClass, ktClass.getContainingJetFile()).bindingContext
|
return constructorAdditionalResolve(resolveSession, ktClass, ktClass.getContainingKtFile()).bindingContext
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getElementAdditionalResolve(resolveElement: KtElement, contextElement: KtElement, bodyResolveMode: BodyResolveMode): BindingContext {
|
fun getElementAdditionalResolve(resolveElement: KtElement, contextElement: KtElement, bodyResolveMode: BodyResolveMode): BindingContext {
|
||||||
@@ -142,7 +142,7 @@ public class ResolveElementCache(
|
|||||||
return getElementAdditionalResolve(resolveElement, contextElement, BodyResolveMode.FULL)
|
return getElementAdditionalResolve(resolveElement, contextElement, BodyResolveMode.FULL)
|
||||||
}
|
}
|
||||||
|
|
||||||
val file = resolveElement.getContainingJetFile()
|
val file = resolveElement.getContainingKtFile()
|
||||||
val statementToResolve = PartialBodyResolveFilter.findStatementToResolve(contextElement, resolveElement)
|
val statementToResolve = PartialBodyResolveFilter.findStatementToResolve(contextElement, resolveElement)
|
||||||
val partialResolveMap = partialBodyResolveCache.value
|
val partialResolveMap = partialBodyResolveCache.value
|
||||||
partialResolveMap[statementToResolve ?: resolveElement]
|
partialResolveMap[statementToResolve ?: resolveElement]
|
||||||
@@ -243,7 +243,7 @@ public class ResolveElementCache(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun performElementAdditionalResolve(resolveElement: KtElement, contextElement: KtElement, bodyResolveMode: BodyResolveMode): Pair<BindingContext, StatementFilter> {
|
private fun performElementAdditionalResolve(resolveElement: KtElement, contextElement: KtElement, bodyResolveMode: BodyResolveMode): Pair<BindingContext, StatementFilter> {
|
||||||
val file = resolveElement.getContainingJetFile()
|
val file = resolveElement.getContainingKtFile()
|
||||||
|
|
||||||
var statementFilterUsed = StatementFilter.NONE
|
var statementFilterUsed = StatementFilter.NONE
|
||||||
|
|
||||||
@@ -273,7 +273,7 @@ public class ResolveElementCache(
|
|||||||
is KtInitializerList -> delegationSpecifierAdditionalResolve(resolveSession, resolveElement, resolveElement.getParent() as KtEnumEntry, file)
|
is KtInitializerList -> delegationSpecifierAdditionalResolve(resolveSession, resolveElement, resolveElement.getParent() as KtEnumEntry, file)
|
||||||
|
|
||||||
is KtImportList -> {
|
is KtImportList -> {
|
||||||
val resolver = resolveSession.fileScopeProvider.getImportResolver(resolveElement.getContainingJetFile())
|
val resolver = resolveSession.fileScopeProvider.getImportResolver(resolveElement.getContainingKtFile())
|
||||||
resolver.forceResolveAllImports()
|
resolver.forceResolveAllImports()
|
||||||
resolveSession.trace
|
resolveSession.trace
|
||||||
}
|
}
|
||||||
@@ -355,10 +355,10 @@ public class ResolveElementCache(
|
|||||||
else {
|
else {
|
||||||
val fileAnnotationList = ktAnnotationEntry.getParentOfType<KtFileAnnotationList>(true)
|
val fileAnnotationList = ktAnnotationEntry.getParentOfType<KtFileAnnotationList>(true)
|
||||||
if (fileAnnotationList != null) {
|
if (fileAnnotationList != null) {
|
||||||
doResolveAnnotations(resolveSession.getFileAnnotations(fileAnnotationList.getContainingJetFile()))
|
doResolveAnnotations(resolveSession.getFileAnnotations(fileAnnotationList.getContainingKtFile()))
|
||||||
}
|
}
|
||||||
if (modifierList != null && modifierList.getParent() is KtFile) {
|
if (modifierList != null && modifierList.getParent() is KtFile) {
|
||||||
doResolveAnnotations(resolveSession.getDanglingAnnotations(modifierList.getContainingJetFile()))
|
doResolveAnnotations(resolveSession.getDanglingAnnotations(modifierList.getContainingKtFile()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -61,7 +61,7 @@ public class BuiltInsReferenceResolver(val project: Project, val startupManager:
|
|||||||
private fun initialize() {
|
private fun initialize() {
|
||||||
assert(moduleDescriptor == null) { "Attempt to initialize twice" }
|
assert(moduleDescriptor == null) { "Attempt to initialize twice" }
|
||||||
|
|
||||||
val jetBuiltInsFiles = getJetBuiltInsFiles()
|
val jetBuiltInsFiles = getBuiltInsKtFiles()
|
||||||
|
|
||||||
runReadAction {
|
runReadAction {
|
||||||
val newModuleContext = ContextForNewModule(project, Name.special("<built-ins resolver module>"), TargetPlatform.Default)
|
val newModuleContext = ContextForNewModule(project, Name.special("<built-ins resolver module>"), TargetPlatform.Default)
|
||||||
@@ -85,7 +85,7 @@ public class BuiltInsReferenceResolver(val project: Project, val startupManager:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getJetBuiltInsFiles(): Set<KtFile> {
|
private fun getBuiltInsKtFiles(): Set<KtFile> {
|
||||||
return getBuiltInsDirUrls().flatMapTo(hashSetOf<KtFile>()) { getBuiltInSourceFiles(it) }
|
return getBuiltInsDirUrls().flatMapTo(hashSetOf<KtFile>()) { getBuiltInSourceFiles(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -171,7 +171,7 @@ public class KotlinReferencesSearcher : QueryExecutorBase<PsiReference, Referenc
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
public fun processJetClassOrObject(element: KtClassOrObject, queryParameters: ReferencesSearch.SearchParameters) {
|
public fun processKtClassOrObject(element: KtClassOrObject, queryParameters: ReferencesSearch.SearchParameters) {
|
||||||
val className = element.getName()
|
val className = element.getName()
|
||||||
if (className != null) {
|
if (className != null) {
|
||||||
val lightClass = runReadAction { LightClassUtil.getPsiClass(element) }
|
val lightClass = runReadAction { LightClassUtil.getPsiClass(element) }
|
||||||
@@ -239,7 +239,7 @@ public class KotlinReferencesSearcher : QueryExecutorBase<PsiReference, Referenc
|
|||||||
|
|
||||||
private fun searchLightElements(queryParameters: ReferencesSearch.SearchParameters, element: PsiElement) {
|
private fun searchLightElements(queryParameters: ReferencesSearch.SearchParameters, element: PsiElement) {
|
||||||
when (element) {
|
when (element) {
|
||||||
is KtClassOrObject -> processJetClassOrObject(element, queryParameters)
|
is KtClassOrObject -> processKtClassOrObject(element, queryParameters)
|
||||||
is KtNamedFunction, is KtSecondaryConstructor -> {
|
is KtNamedFunction, is KtSecondaryConstructor -> {
|
||||||
val function = element as KtFunction
|
val function = element as KtFunction
|
||||||
val name = runReadAction { function.getName() }
|
val name = runReadAction { function.getName() }
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ package org.jetbrains.kotlin.idea.util
|
|||||||
|
|
||||||
import com.intellij.openapi.diagnostic.Logger
|
import com.intellij.openapi.diagnostic.Logger
|
||||||
import com.intellij.psi.tree.IElementType
|
import com.intellij.psi.tree.IElementType
|
||||||
import org.jetbrains.kotlin.parsing.JetExpressionParsing
|
import org.jetbrains.kotlin.parsing.KotlinExpressionParsing
|
||||||
import org.jetbrains.kotlin.parsing.JetExpressionParsing.Precedence.POSTFIX
|
import org.jetbrains.kotlin.parsing.KotlinExpressionParsing.Precedence.POSTFIX
|
||||||
import org.jetbrains.kotlin.parsing.JetExpressionParsing.Precedence.PREFIX
|
import org.jetbrains.kotlin.parsing.KotlinExpressionParsing.Precedence.PREFIX
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ public object PsiPrecedences {
|
|||||||
private val precedence: Map<IElementType, Int>
|
private val precedence: Map<IElementType, Int>
|
||||||
init {
|
init {
|
||||||
val builder = HashMap<IElementType, Int>()
|
val builder = HashMap<IElementType, Int>()
|
||||||
for ((i, record) in JetExpressionParsing.Precedence.values().withIndex()) {
|
for ((i, record) in KotlinExpressionParsing.Precedence.values().withIndex()) {
|
||||||
for (elementType in record.getOperations().getTypes()) {
|
for (elementType in record.getOperations().getTypes()) {
|
||||||
builder[elementType] = i
|
builder[elementType] = i
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public class ShortenReferences(val options: (KtElement) -> Options = { Options.D
|
|||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
public fun process(elements: Iterable<KtElement>, elementFilter: (PsiElement) -> FilterResult = { FilterResult.PROCESS }): Collection<KtElement> {
|
public fun process(elements: Iterable<KtElement>, elementFilter: (PsiElement) -> FilterResult = { FilterResult.PROCESS }): Collection<KtElement> {
|
||||||
return elements.groupBy { element -> element.getContainingJetFile() }
|
return elements.groupBy { element -> element.getContainingKtFile() }
|
||||||
.flatMap { shortenReferencesInFile(it.key, it.value, elementFilter) }
|
.flatMap { shortenReferencesInFile(it.key, it.value, elementFilter) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ public class KotlinIndicesHelper(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun KtCallableDeclaration.resolveToDescriptorsWithHack(): Collection<CallableDescriptor> {
|
private fun KtCallableDeclaration.resolveToDescriptorsWithHack(): Collection<CallableDescriptor> {
|
||||||
if (getContainingJetFile().isCompiled()) { //TODO: it's temporary while resolveToDescriptor does not work for compiled declarations
|
if (getContainingKtFile().isCompiled()) { //TODO: it's temporary while resolveToDescriptor does not work for compiled declarations
|
||||||
return resolutionFacade.resolveImportReference(moduleDescriptor, fqName!!).filterIsInstance<CallableDescriptor>()
|
return resolutionFacade.resolveImportReference(moduleDescriptor, fqName!!).filterIsInstance<CallableDescriptor>()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user