Remove dependency of fir2ir/fir.entrypoint on psi2ir
This commit is contained in:
committed by
Space Team
parent
4b8471d806
commit
d96112b944
@@ -16,9 +16,6 @@ dependencies {
|
|||||||
api(project(":compiler:fir:checkers:checkers.native"))
|
api(project(":compiler:fir:checkers:checkers.native"))
|
||||||
api(project(":js:js.frontend"))
|
api(project(":js:js.frontend"))
|
||||||
|
|
||||||
// TODO: do not use GeneratorExtensions in `FirAnalyzerFacade.convertToIr`, and make this an 'implementation' dependency.
|
|
||||||
api(project(":compiler:ir.psi2ir"))
|
|
||||||
|
|
||||||
implementation(project(":compiler:fir:resolve"))
|
implementation(project(":compiler:fir:resolve"))
|
||||||
implementation(project(":compiler:fir:fir2ir:jvm-backend"))
|
implementation(project(":compiler:fir:fir2ir:jvm-backend"))
|
||||||
implementation(project(":compiler:backend.jvm"))
|
implementation(project(":compiler:backend.jvm"))
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ dependencies {
|
|||||||
compileOnly(project(":compiler:fir:semantics"))
|
compileOnly(project(":compiler:fir:semantics"))
|
||||||
compileOnly(project(":compiler:fir:tree"))
|
compileOnly(project(":compiler:fir:tree"))
|
||||||
compileOnly(project(":compiler:ir.tree"))
|
compileOnly(project(":compiler:ir.tree"))
|
||||||
compileOnly(project(":compiler:ir.psi2ir"))
|
|
||||||
compileOnly(project(":compiler:ir.backend.common"))
|
compileOnly(project(":compiler:ir.backend.common"))
|
||||||
compileOnly(project(":compiler:ir.serialization.common"))
|
compileOnly(project(":compiler:ir.serialization.common"))
|
||||||
|
|
||||||
|
|||||||
-1
@@ -43,7 +43,6 @@ import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
|
|||||||
import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection
|
import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection
|
||||||
import org.jetbrains.kotlin.ir.util.*
|
import org.jetbrains.kotlin.ir.util.*
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.psi2ir.generators.implicitCastTo
|
|
||||||
import org.jetbrains.kotlin.types.AbstractTypeChecker
|
import org.jetbrains.kotlin.types.AbstractTypeChecker
|
||||||
import org.jetbrains.kotlin.types.Variance
|
import org.jetbrains.kotlin.types.Variance
|
||||||
import org.jetbrains.kotlin.types.model.TypeVariance
|
import org.jetbrains.kotlin.types.model.TypeVariance
|
||||||
|
|||||||
-2
@@ -42,8 +42,6 @@ import org.jetbrains.kotlin.ir.util.isFunctionTypeOrSubtype
|
|||||||
import org.jetbrains.kotlin.ir.util.isInterface
|
import org.jetbrains.kotlin.ir.util.isInterface
|
||||||
import org.jetbrains.kotlin.ir.util.isMethodOfAny
|
import org.jetbrains.kotlin.ir.util.isMethodOfAny
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.psi2ir.generators.hasNoSideEffects
|
|
||||||
import org.jetbrains.kotlin.psi2ir.generators.isUnchanging
|
|
||||||
import org.jetbrains.kotlin.resolve.calls.NewCommonSuperTypeCalculator.commonSuperType
|
import org.jetbrains.kotlin.resolve.calls.NewCommonSuperTypeCalculator.commonSuperType
|
||||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||||
|
|||||||
-7
@@ -41,7 +41,6 @@ import org.jetbrains.kotlin.psi2ir.intermediate.*
|
|||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||||
import org.jetbrains.kotlin.resolve.ImportedFromObjectCallableDescriptor
|
import org.jetbrains.kotlin.resolve.ImportedFromObjectCallableDescriptor
|
||||||
import org.jetbrains.kotlin.resolve.calls.components.isArrayOrArrayLiteral
|
|
||||||
import org.jetbrains.kotlin.resolve.calls.components.isVararg
|
import org.jetbrains.kotlin.resolve.calls.components.isVararg
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.*
|
import org.jetbrains.kotlin.resolve.calls.model.*
|
||||||
import org.jetbrains.kotlin.resolve.calls.tower.NewResolvedCallImpl
|
import org.jetbrains.kotlin.resolve.calls.tower.NewResolvedCallImpl
|
||||||
@@ -210,12 +209,6 @@ private fun StatementGenerator.generateThisOrSuperReceiver(receiver: ReceiverVal
|
|||||||
return generateThisReceiver(ktReceiver.startOffsetSkippingComments, ktReceiver.endOffset, type, classDescriptor)
|
return generateThisReceiver(ktReceiver.startOffsetSkippingComments, ktReceiver.endOffset, type, classDescriptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IrExpression.implicitCastTo(expectedType: IrType?): IrExpression {
|
|
||||||
if (expectedType == null) return this
|
|
||||||
|
|
||||||
return IrTypeOperatorCallImpl(startOffset, endOffset, expectedType, IrTypeOperator.IMPLICIT_CAST, expectedType, this)
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun StatementGenerator.generateBackingFieldReceiver(
|
internal fun StatementGenerator.generateBackingFieldReceiver(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.psi2ir.generators
|
|||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
|
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptor
|
import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptor
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
|
||||||
import org.jetbrains.kotlin.ir.expressions.*
|
import org.jetbrains.kotlin.ir.expressions.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.*
|
import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||||
import org.jetbrains.kotlin.ir.types.IrDynamicType
|
import org.jetbrains.kotlin.ir.types.IrDynamicType
|
||||||
@@ -454,16 +453,6 @@ internal class CallGenerator(statementGenerator: StatementGenerator) : Statement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IrExpression.isUnchanging(): Boolean =
|
|
||||||
this is IrFunctionExpression ||
|
|
||||||
(this is IrCallableReference<*> && dispatchReceiver == null && extensionReceiver == null) ||
|
|
||||||
this is IrClassReference ||
|
|
||||||
this is IrConst<*> ||
|
|
||||||
(this is IrGetValue && !symbol.owner.let { it is IrVariable && it.isVar })
|
|
||||||
|
|
||||||
fun IrExpression.hasNoSideEffects(): Boolean =
|
|
||||||
isUnchanging() || this is IrGetValue
|
|
||||||
|
|
||||||
internal fun CallGenerator.generateCall(
|
internal fun CallGenerator.generateCall(
|
||||||
ktElement: KtElement,
|
ktElement: KtElement,
|
||||||
call: CallBuilder,
|
call: CallBuilder,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
|||||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||||
import org.jetbrains.kotlin.psi2ir.generators.hasNoSideEffects
|
import org.jetbrains.kotlin.ir.expressions.hasNoSideEffects
|
||||||
import org.jetbrains.kotlin.psi2ir.isValueArgumentReorderingRequired
|
import org.jetbrains.kotlin.psi2ir.isValueArgumentReorderingRequired
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
|
|||||||
@@ -6,7 +6,10 @@
|
|||||||
package org.jetbrains.kotlin.ir.expressions
|
package org.jetbrains.kotlin.ir.expressions
|
||||||
|
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||||
|
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
||||||
|
import org.jetbrains.kotlin.ir.expressions.impl.IrTypeOperatorCallImpl
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrFileSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrFileSymbol
|
||||||
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
import org.jetbrains.kotlin.ir.util.fileOrNull
|
import org.jetbrains.kotlin.ir.util.fileOrNull
|
||||||
|
|
||||||
@Suppress("unused") // Used in kotlin-native
|
@Suppress("unused") // Used in kotlin-native
|
||||||
@@ -51,3 +54,19 @@ fun IrStringConcatenation.addArgument(argument: IrExpression) {
|
|||||||
|
|
||||||
val IrContainerExpression.isTransparentScope: Boolean
|
val IrContainerExpression.isTransparentScope: Boolean
|
||||||
get() = this is IrComposite
|
get() = this is IrComposite
|
||||||
|
|
||||||
|
fun IrExpression.implicitCastTo(expectedType: IrType?): IrExpression {
|
||||||
|
if (expectedType == null) return this
|
||||||
|
|
||||||
|
return IrTypeOperatorCallImpl(startOffset, endOffset, expectedType, IrTypeOperator.IMPLICIT_CAST, expectedType, this)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun IrExpression.isUnchanging(): Boolean =
|
||||||
|
this is IrFunctionExpression ||
|
||||||
|
(this is IrCallableReference<*> && dispatchReceiver == null && extensionReceiver == null) ||
|
||||||
|
this is IrClassReference ||
|
||||||
|
this is IrConst<*> ||
|
||||||
|
(this is IrGetValue && !symbol.owner.let { it is IrVariable && it.isVar })
|
||||||
|
|
||||||
|
fun IrExpression.hasNoSideEffects(): Boolean =
|
||||||
|
isUnchanging() || this is IrGetValue
|
||||||
|
|||||||
-1
@@ -32,7 +32,6 @@ import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
|||||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
||||||
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.psi2ir.generators.implicitCastTo
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user