[FE] Remove dependecy on :core:descriptors from :compiler:psi

This commit is contained in:
Dmitriy Novozhilov
2021-09-09 11:08:20 +03:00
committed by TeamCityServer
parent 1d6b4d1d3c
commit 00c60bf569
5 changed files with 3 additions and 20 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ dependencies {
val compile by configurations
val compileOnly by configurations
compile(project(":core:descriptors"))
compile(project(":core:compiler.common"))
compile(project(":compiler:util"))
compile(project(":compiler:frontend.common"))
compile(project(":kotlin-script-runtime"))
@@ -1,75 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.psi;
import com.intellij.lang.ASTNode;
import kotlin.annotations.jvm.ReadOnly;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.lexer.KtTokens;
import org.jetbrains.kotlin.resolve.scopes.receivers.Receiver;
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
import java.util.List;
public interface Call {
// SAFE_ACCESS or DOT or so
@Nullable
ASTNode getCallOperationNode();
default boolean isSemanticallyEquivalentToSafeCall() {
return getCallOperationNode() != null && getCallOperationNode().getElementType() == KtTokens.SAFE_ACCESS;
}
@Nullable
Receiver getExplicitReceiver();
@Nullable
ReceiverValue getDispatchReceiver();
@Nullable
KtExpression getCalleeExpression();
@Nullable
KtValueArgumentList getValueArgumentList();
@ReadOnly
@NotNull
List<? extends ValueArgument> getValueArguments();
@ReadOnly
@NotNull
List<? extends LambdaArgument> getFunctionLiteralArguments();
@ReadOnly
@NotNull
List<KtTypeProjection> getTypeArguments();
@Nullable
KtTypeArgumentList getTypeArgumentList();
@NotNull
KtElement getCallElement();
enum CallType {
DEFAULT, ARRAY_GET_METHOD, ARRAY_SET_METHOD, INVOKE, CONTAINS
}
@NotNull
Call.CallType getCallType();
}
@@ -26,10 +26,8 @@ import com.intellij.psi.impl.source.tree.FileElement
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.tree.IElementType
import com.intellij.testFramework.LightVirtualFile
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.psi.psiUtil.getElementTextWithContext
import org.jetbrains.kotlin.types.KotlinType
import java.util.*
abstract class KtCodeFragment(
@@ -195,11 +193,9 @@ abstract class KtCodeFragment(
companion object {
const val IMPORT_SEPARATOR: String = ","
val RUNTIME_TYPE_EVALUATOR: Key<Function1<KtExpression, KotlinType?>> = Key.create("RUNTIME_TYPE_EVALUATOR")
val FAKE_CONTEXT_FOR_JAVA_FILE: Key<Function0<KtElement>> = Key.create("FAKE_CONTEXT_FOR_JAVA_FILE")
private val LOG = Logger.getInstance(KtCodeFragment::class.java)
}
}
var KtCodeFragment.externalDescriptors: List<DeclarationDescriptor>? by CopyablePsiUserDataProperty(Key.create("EXTERNAL_DESCRIPTORS"))
@@ -9,11 +9,10 @@ import com.intellij.lang.ASTNode
import org.jetbrains.kotlin.psi.psiUtil.getChildOfType
import org.jetbrains.kotlin.psi.stubs.KotlinContractEffectStub
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes
import org.jetbrains.kotlin.types.checker.findCorrespondingSupertype
class KtContractEffect: KtElementImplStub<KotlinContractEffectStub> {
constructor(node: ASTNode): super(node)
constructor(stub: KotlinContractEffectStub): super(stub, KtStubElementTypes.CONTRACT_EFFECT)
}
fun KtContractEffect.getExpression(): KtExpression = getChildOfType()!!
fun KtContractEffect.getExpression(): KtExpression = getChildOfType()!!
@@ -12,8 +12,6 @@ import com.intellij.psi.*
import com.intellij.psi.stubs.StubElement
import com.intellij.psi.tree.TokenSet
import org.jetbrains.kotlin.KtNodeTypes
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
import org.jetbrains.kotlin.lexer.KotlinLexer
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
import org.jetbrains.kotlin.lexer.KtTokens
@@ -664,16 +662,6 @@ fun isTopLevelInFileOrScript(element: PsiElement): Boolean {
}
}
fun KtModifierKeywordToken.toVisibility(): DescriptorVisibility {
return when (this) {
KtTokens.PUBLIC_KEYWORD -> DescriptorVisibilities.PUBLIC
KtTokens.PRIVATE_KEYWORD -> DescriptorVisibilities.PRIVATE
KtTokens.PROTECTED_KEYWORD -> DescriptorVisibilities.PROTECTED
KtTokens.INTERNAL_KEYWORD -> DescriptorVisibilities.INTERNAL
else -> throw IllegalArgumentException("Unknown visibility modifier:$this")
}
}
fun KtFile.getFileOrScriptDeclarations() = if (isScript()) script!!.declarations else declarations
fun KtExpression.getBinaryWithTypeParent(): KtBinaryExpressionWithTypeRHS? {