[Wasm] Suppress unused parameters warning for functions with JS body
These parameters can be used in js(code)
This commit is contained in:
committed by
Space Team
parent
71e6b19760
commit
60ef7fcb49
+1
-1
@@ -731,7 +731,7 @@ class ControlFlowInformationProviderImpl private constructor(
|
||||
|
||||
if (functionDescriptor.isExpect || functionDescriptor.isActual ||
|
||||
functionDescriptor.isEffectivelyExternal() ||
|
||||
!diagnosticSuppressor.shouldReportUnusedParameter(variableDescriptor)
|
||||
!diagnosticSuppressor.shouldReportUnusedParameter(variableDescriptor, trace.bindingContext)
|
||||
) return
|
||||
|
||||
when (val owner = element.parent.parent) {
|
||||
|
||||
+5
-4
@@ -21,23 +21,24 @@ import org.jetbrains.kotlin.container.PlatformExtensionsClashResolver
|
||||
import org.jetbrains.kotlin.container.PlatformSpecificExtension
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
|
||||
@DefaultImplementation(PlatformDiagnosticSuppressor.Default::class)
|
||||
interface PlatformDiagnosticSuppressor : PlatformSpecificExtension<PlatformDiagnosticSuppressor>{
|
||||
fun shouldReportUnusedParameter(parameter: VariableDescriptor): Boolean
|
||||
fun shouldReportUnusedParameter(parameter: VariableDescriptor, bindingContext: BindingContext): Boolean
|
||||
|
||||
fun shouldReportNoBody(descriptor: CallableMemberDescriptor): Boolean
|
||||
|
||||
object Default : PlatformDiagnosticSuppressor {
|
||||
override fun shouldReportUnusedParameter(parameter: VariableDescriptor): Boolean = true
|
||||
override fun shouldReportUnusedParameter(parameter: VariableDescriptor, bindingContext: BindingContext): Boolean = true
|
||||
|
||||
override fun shouldReportNoBody(descriptor: CallableMemberDescriptor): Boolean = true
|
||||
}
|
||||
}
|
||||
|
||||
class CompositePlatformDiagnosticSuppressor(private val suppressors: List<PlatformDiagnosticSuppressor>) : PlatformDiagnosticSuppressor {
|
||||
override fun shouldReportUnusedParameter(parameter: VariableDescriptor): Boolean =
|
||||
suppressors.all { it.shouldReportUnusedParameter(parameter) }
|
||||
override fun shouldReportUnusedParameter(parameter: VariableDescriptor, bindingContext: BindingContext): Boolean =
|
||||
suppressors.all { it.shouldReportUnusedParameter(parameter, bindingContext) }
|
||||
|
||||
override fun shouldReportNoBody(descriptor: CallableMemberDescriptor): Boolean =
|
||||
suppressors.all { it.shouldReportNoBody(descriptor) }
|
||||
|
||||
Reference in New Issue
Block a user