Implement samWithReceiver support for scripts when ...
it configured from script compilation configuration #KT-34294 fixed
This commit is contained in:
+7
@@ -45,6 +45,7 @@ abstract class ScriptDefinition : UserDataHolderBase() {
|
||||
|
||||
abstract val baseClassType: KotlinType
|
||||
abstract val compilerOptions: Iterable<String>
|
||||
abstract val annotationsForSamWithReceivers: List<String>
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
inline fun <reified T : KotlinScriptDefinition> asLegacyOrNull(): T? =
|
||||
@@ -94,6 +95,9 @@ abstract class ScriptDefinition : UserDataHolderBase() {
|
||||
override val compilerOptions: Iterable<String>
|
||||
get() = legacyDefinition.additionalCompilerArguments ?: emptyList()
|
||||
|
||||
override val annotationsForSamWithReceivers: List<String>
|
||||
get() = legacyDefinition.annotationsForSamWithReceivers
|
||||
|
||||
override fun equals(other: Any?): Boolean = this === other || legacyDefinition == (other as? FromLegacy)?.legacyDefinition
|
||||
|
||||
override fun hashCode(): Int = legacyDefinition.hashCode()
|
||||
@@ -158,6 +162,9 @@ abstract class ScriptDefinition : UserDataHolderBase() {
|
||||
override val compilerOptions: Iterable<String>
|
||||
get() = compilationConfiguration[ScriptCompilationConfiguration.compilerOptions].orEmpty()
|
||||
|
||||
override val annotationsForSamWithReceivers: List<String>
|
||||
get() = compilationConfiguration[ScriptCompilationConfiguration.annotationsForSamWithReceivers].orEmpty().map { it.typeName }
|
||||
|
||||
override fun equals(other: Any?): Boolean = this === other ||
|
||||
(other as? FromConfigurations)?.let {
|
||||
compilationConfiguration == it.compilationConfiguration && evaluationConfiguration == it.evaluationConfiguration
|
||||
|
||||
Reference in New Issue
Block a user