IR: fix compiler warnings
This commit is contained in:
@@ -161,7 +161,7 @@ open class MutableController(val context: JsIrBackendContext, val lowerings: Lis
|
||||
private var restricted: Boolean = false
|
||||
private var declarationListsRestricted = false
|
||||
|
||||
private inline fun <T> (() -> T).withRestrictions(
|
||||
private fun <T> (() -> T).withRestrictions(
|
||||
newRestrictedToDeclaration: IrDeclaration? = null,
|
||||
newBodiesEnabled: Boolean? = null,
|
||||
newRestricted: Boolean? = null,
|
||||
|
||||
+1
-1
@@ -140,7 +140,7 @@ class ExportModelGenerator(val context: JsIrBackendContext) {
|
||||
klass: IrClass
|
||||
): ExportedDeclaration? {
|
||||
when (val exportability = classExportability(klass)) {
|
||||
is Exportability.Prohibited -> return error(exportability.reason)
|
||||
is Exportability.Prohibited -> error(exportability.reason)
|
||||
is Exportability.NotNeeded -> return null
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -357,7 +357,7 @@ class CallableReferenceLowering(private val context: CommonBackendContext) : Bod
|
||||
fun build(): Pair<IrClass, IrConstructor> {
|
||||
val clazz = buildReferenceClass()
|
||||
val ctor = createConstructor(clazz)
|
||||
val invoke = createInvokeMethod(clazz)
|
||||
createInvokeMethod(clazz)
|
||||
createNameProperty(clazz)
|
||||
// TODO: create name property for KFunction*
|
||||
|
||||
|
||||
+3
-3
@@ -44,7 +44,7 @@ class EnumUsageLowering(val context: JsIrBackendContext) : BodyLoweringPass {
|
||||
override fun visitGetEnumValue(expression: IrGetEnumValue): IrExpression {
|
||||
val enumEntry = expression.symbol.owner
|
||||
val klass = enumEntry.parent as IrClass
|
||||
return if (klass.isExternal) lowerExternalEnumEntry(enumEntry, klass) else lowerEnumEntry(enumEntry, klass)
|
||||
return if (klass.isExternal) lowerExternalEnumEntry(enumEntry, klass) else lowerEnumEntry(enumEntry)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -78,7 +78,7 @@ class EnumUsageLowering(val context: JsIrBackendContext) : BodyLoweringPass {
|
||||
}
|
||||
}
|
||||
|
||||
private fun lowerEnumEntry(enumEntry: IrEnumEntry, klass: IrClass) =
|
||||
private fun lowerEnumEntry(enumEntry: IrEnumEntry) =
|
||||
enumEntry.getInstanceFun!!.run { JsIrBuilder.buildCall(symbol) }
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ class EnumEntryInstancesBodyLowering(val context: JsIrBackendContext) : BodyLowe
|
||||
val index = (irBody as IrBlockBody).statements
|
||||
.indexOfFirst { it is IrTypeOperatorCall && it.argument is IrDelegatingConstructorCall } + 1
|
||||
|
||||
(irBody as IrBlockBody).statements.add(index, context.createIrBuilder(container.symbol).run {
|
||||
irBody.statements.add(index, context.createIrBuilder(container.symbol).run {
|
||||
irSetField(null, entry.correspondingField!!, irGet(entryClass.thisReceiver!!))
|
||||
})
|
||||
}
|
||||
|
||||
+1
@@ -52,6 +52,7 @@ abstract class AbstractSuspendFunctionsLowering<C : CommonBackendContext>(val co
|
||||
|
||||
protected abstract fun IrBlockBodyBuilder.generateCoroutineStart(invokeSuspendFunction: IrFunction, receiver: IrExpression)
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
protected fun initializeStateMachine(coroutineConstructors: List<IrConstructor>, coroutineClassThis: IrValueDeclaration) {
|
||||
// Do nothing by default
|
||||
// TODO find out if Kotlin/Native needs this method.
|
||||
|
||||
+1
-1
@@ -187,7 +187,7 @@ class JsIntrinsicTransformers(backendContext: JsIrBackendContext) {
|
||||
}
|
||||
|
||||
add(intrinsics.jsBoxIntrinsic) { call, context ->
|
||||
val arg = translateCallArguments(call as IrCall, context).single()
|
||||
val arg = translateCallArguments(call, context).single()
|
||||
val inlineClass = call.getTypeArgument(0)!!.getInlinedClass()!!
|
||||
val constructor = inlineClass.declarations.filterIsInstance<IrConstructor>().single { it.isPrimary }
|
||||
JsNew(context.getNameForConstructor(constructor).makeRef(), listOf(arg))
|
||||
|
||||
@@ -324,9 +324,6 @@ class NameTables(
|
||||
return sanitizeName(field.name.asString()) + "__error"
|
||||
}
|
||||
|
||||
require(name != null) {
|
||||
"Can't find name for member field ${field.render()}"
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
||||
@@ -340,10 +337,6 @@ class NameTables(
|
||||
return sanitizeName(function.name.asString()) + "__error" // TODO one case is a virtual method of an abstract class with no implementation
|
||||
}
|
||||
|
||||
// TODO report backend error
|
||||
require(name != null) {
|
||||
"Can't find name for member function ${function.render()}"
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user