Add LanguageVersionSettings to KotlinTypeMapper
KotlinTypeMapper clients should use proper LanguageVersionSettings when possible.
This commit is contained in:
+6
-3
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.codegen.FrameMap
|
||||
import org.jetbrains.kotlin.codegen.state.IncompatibleClassTracker
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
|
||||
import org.jetbrains.kotlin.config.JvmTarget
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
@@ -46,7 +47,8 @@ class ParcelableDeclarationChecker : DeclarationChecker {
|
||||
override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) {
|
||||
val trace = context.trace
|
||||
when (descriptor) {
|
||||
is ClassDescriptor -> checkParcelableClass(descriptor, declaration, trace, trace.bindingContext)
|
||||
is ClassDescriptor ->
|
||||
checkParcelableClass(descriptor, declaration, trace, trace.bindingContext, context.languageVersionSettings)
|
||||
is SimpleFunctionDescriptor -> {
|
||||
val containingClass = descriptor.containingDeclaration as? ClassDescriptor
|
||||
val ktFunction = declaration as? KtFunction
|
||||
@@ -113,7 +115,8 @@ class ParcelableDeclarationChecker : DeclarationChecker {
|
||||
descriptor: ClassDescriptor,
|
||||
declaration: KtDeclaration,
|
||||
diagnosticHolder: DiagnosticSink,
|
||||
bindingContext: BindingContext
|
||||
bindingContext: BindingContext,
|
||||
languageVersionSettings: LanguageVersionSettings
|
||||
) {
|
||||
if (!descriptor.isParcelize) return
|
||||
|
||||
@@ -181,7 +184,7 @@ class ParcelableDeclarationChecker : DeclarationChecker {
|
||||
IncompatibleClassTracker.DoNothing,
|
||||
descriptor.module.name.asString(),
|
||||
JvmTarget.DEFAULT,
|
||||
KotlinTypeMapper.RELEASE_COROUTINES_DEFAULT,
|
||||
languageVersionSettings,
|
||||
false
|
||||
)
|
||||
|
||||
|
||||
@@ -38,7 +38,8 @@ class IdeaKotlinUastResolveProviderService : KotlinUastResolveProviderService {
|
||||
override fun getTypeMapper(element: KtElement): KotlinTypeMapper? {
|
||||
return KotlinTypeMapper(
|
||||
getBindingContext(element), ClassBuilderMode.LIGHT_CLASSES,
|
||||
IncompatibleClassTracker.DoNothing, JvmAbi.DEFAULT_MODULE_NAME, JvmTarget.DEFAULT, KotlinTypeMapper.RELEASE_COROUTINES_DEFAULT,
|
||||
IncompatibleClassTracker.DoNothing, JvmAbi.DEFAULT_MODULE_NAME, JvmTarget.DEFAULT,
|
||||
element.languageVersionSettings,
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
+2
-1
@@ -57,7 +57,8 @@ class UastAnalysisHandlerExtension : AnalysisHandlerExtension {
|
||||
|
||||
val typeMapper = KotlinTypeMapper(
|
||||
bindingContext, ClassBuilderMode.LIGHT_CLASSES,
|
||||
IncompatibleClassTracker.DoNothing, JvmAbi.DEFAULT_MODULE_NAME, JvmTarget.DEFAULT, KotlinTypeMapper.RELEASE_COROUTINES_DEFAULT,
|
||||
IncompatibleClassTracker.DoNothing, JvmAbi.DEFAULT_MODULE_NAME, JvmTarget.DEFAULT,
|
||||
KotlinTypeMapper.LANGUAGE_VERSION_SETTINGS_DEFAULT, // TODO use proper LanguageVersionSettings
|
||||
false
|
||||
)
|
||||
this.typeMapper = typeMapper
|
||||
|
||||
Reference in New Issue
Block a user