FIR2IR: Drop a set of redundant or unclear TODOs

This commit is contained in:
Mikhail Glukhikh
2023-06-26 11:54:39 +03:00
committed by Space Team
parent c2135b72c4
commit 6f8e2b4718
6 changed files with 2 additions and 11 deletions
@@ -1615,7 +1615,6 @@ class Fir2IrDeclarationStorage(
val parentOrigin = (irParent as? IrDeclaration)?.origin ?: IrDeclarationOrigin.DEFINED val parentOrigin = (irParent as? IrDeclaration)?.origin ?: IrDeclarationOrigin.DEFINED
val declarationOrigin = computeDeclarationOrigin(firSymbol, parentOrigin) val declarationOrigin = computeDeclarationOrigin(firSymbol, parentOrigin)
// TODO: package fragment members (?)
when (val parent = irParent) { when (val parent = irParent) {
is Fir2IrLazyClass -> { is Fir2IrLazyClass -> {
assert(parentOrigin != IrDeclarationOrigin.DEFINED) { assert(parentOrigin != IrDeclarationOrigin.DEFINED) {
@@ -137,7 +137,6 @@ class Fir2IrImplicitCastInserter(
override fun visitWhenSubjectExpression(whenSubjectExpression: FirWhenSubjectExpression, data: IrElement): IrElement = data override fun visitWhenSubjectExpression(whenSubjectExpression: FirWhenSubjectExpression, data: IrElement): IrElement = data
// TODO: cast `condition` expression to boolean?
override fun visitWhenBranch(whenBranch: FirWhenBranch, data: IrElement): IrBranch { override fun visitWhenBranch(whenBranch: FirWhenBranch, data: IrElement): IrBranch {
val irBranch = data as IrBranch val irBranch = data as IrBranch
(irBranch.result as? IrContainerExpression)?.let { (irBranch.result as? IrContainerExpression)?.let {
@@ -151,7 +150,6 @@ class Fir2IrImplicitCastInserter(
// ================================================================================== // ==================================================================================
// TODO: cast `condition` expression to boolean?
override fun visitDoWhileLoop(doWhileLoop: FirDoWhileLoop, data: IrElement): IrElement { override fun visitDoWhileLoop(doWhileLoop: FirDoWhileLoop, data: IrElement): IrElement {
val loop = data as IrDoWhileLoop val loop = data as IrDoWhileLoop
(loop.body as? IrContainerExpression)?.let { (loop.body as? IrContainerExpression)?.let {
@@ -160,7 +158,6 @@ class Fir2IrImplicitCastInserter(
return data return data
} }
// TODO: cast `condition` expression to boolean?
override fun visitWhileLoop(whileLoop: FirWhileLoop, data: IrElement): IrElement { override fun visitWhileLoop(whileLoop: FirWhileLoop, data: IrElement): IrElement {
val loop = data as IrWhileLoop val loop = data as IrWhileLoop
(loop.body as? IrContainerExpression)?.let { (loop.body as? IrContainerExpression)?.let {
@@ -466,7 +466,7 @@ class Fir2IrVisitor(
} }
override fun visitWrappedArgumentExpression(wrappedArgumentExpression: FirWrappedArgumentExpression, data: Any?): IrElement { override fun visitWrappedArgumentExpression(wrappedArgumentExpression: FirWrappedArgumentExpression, data: Any?): IrElement {
// TODO: change this temporary hack to something correct // Note: we deal with specific arguments in CallAndReferenceGenerator
return convertToIrExpression(wrappedArgumentExpression.expression) return convertToIrExpression(wrappedArgumentExpression.expression)
} }
@@ -694,7 +694,6 @@ class Fir2IrVisitor(
} }
} }
} }
// TODO handle qualified "this" in instance methods of non-inner classes (inner class cases are handled by InnerClassesLowering)
return visitQualifiedAccessExpression(thisReceiverExpression, data) return visitQualifiedAccessExpression(thisReceiverExpression, data)
} }
@@ -165,7 +165,6 @@ internal class AdapterGenerator(
if (boundReceiver == null) { if (boundReceiver == null) {
IrFunctionExpressionImpl(startOffset, endOffset, type, irAdapterFunction, IrStatementOrigin.ADAPTED_FUNCTION_REFERENCE) IrFunctionExpressionImpl(startOffset, endOffset, type, irAdapterFunction, IrStatementOrigin.ADAPTED_FUNCTION_REFERENCE)
} else { } else {
// TODO add a bound receiver property to IrFunctionExpressionImpl?
val irAdapterRef = IrFunctionReferenceImpl( val irAdapterRef = IrFunctionReferenceImpl(
startOffset, endOffset, type, irAdapterFunction.symbol, irAdapterFunction.typeParameters.size, startOffset, endOffset, type, irAdapterFunction.symbol, irAdapterFunction.typeParameters.size,
irAdapterFunction.valueParameters.size, null, IrStatementOrigin.ADAPTED_FUNCTION_REFERENCE irAdapterFunction.valueParameters.size, null, IrStatementOrigin.ADAPTED_FUNCTION_REFERENCE
@@ -590,7 +589,6 @@ internal class AdapterGenerator(
argument: FirExpression, argument: FirExpression,
parameterType: ConeKotlinType parameterType: ConeKotlinType
): IrExpression { ): IrExpression {
// TODO: should refer to LanguageVersionSettings.SuspendConversion
if (this is IrBlock && origin == IrStatementOrigin.ADAPTED_FUNCTION_REFERENCE) { if (this is IrBlock && origin == IrStatementOrigin.ADAPTED_FUNCTION_REFERENCE) {
return this return this
} }
@@ -610,7 +608,6 @@ internal class AdapterGenerator(
val suspendConvertedType = parameterType.toIrType() as IrSimpleType val suspendConvertedType = parameterType.toIrType() as IrSimpleType
return argument.convertWithOffsets { startOffset, endOffset -> return argument.convertWithOffsets { startOffset, endOffset ->
val irAdapterFunction = createAdapterFunctionForArgument(startOffset, endOffset, suspendConvertedType, type, invokeSymbol) val irAdapterFunction = createAdapterFunctionForArgument(startOffset, endOffset, suspendConvertedType, type, invokeSymbol)
// TODO add a bound receiver property to IrFunctionExpressionImpl?
val irAdapterRef = IrFunctionReferenceImpl( val irAdapterRef = IrFunctionReferenceImpl(
startOffset, endOffset, suspendConvertedType, irAdapterFunction.symbol, irAdapterFunction.typeParameters.size, startOffset, endOffset, suspendConvertedType, irAdapterFunction.symbol, irAdapterFunction.typeParameters.size,
irAdapterFunction.valueParameters.size, null, IrStatementOrigin.SUSPEND_CONVERSION irAdapterFunction.valueParameters.size, null, IrStatementOrigin.SUSPEND_CONVERSION
@@ -972,7 +972,6 @@ class CallAndReferenceGenerator(
argument: FirExpression, argument: FirExpression,
parameter: FirValueParameter? parameter: FirValueParameter?
): IrExpression { ): IrExpression {
// TODO: Need to refer to language feature: AllowAssigningArrayElementsToVarargsInNamedFormForFunctions
if (this !is IrVarargImpl || if (this !is IrVarargImpl ||
parameter?.isVararg != true || parameter?.isVararg != true ||
argument !is FirVarargArgumentsExpression || argument !is FirVarargArgumentsExpression ||
@@ -157,7 +157,7 @@ class FirBasedSignatureComposer(override val mangler: FirMangler) : Fir2IrSignat
} }
is FirScript -> { is FirScript -> {
IdSignature.CommonSignature( IdSignature.CommonSignature(
packageFqName = declaration.name.asString(), // TODO: find package id packageFqName = declaration.name.asString(),
declarationFqName = declaration.name.asString(), declarationFqName = declaration.name.asString(),
id = builder.hashId, id = builder.hashId,
mask = builder.mask, mask = builder.mask,