<commit_before>package org.jetbrains.kotlin.backend.konan.descriptors

import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.types.KotlinType

fun ClassDescriptor?.getter2Descriptor(methodName: Name) = this?.let {
    this.unsubstitutedMemberScope.getContributedDescriptors{true}
            .firstOrNull {
                it.name == methodName
            } ?.let {
        return@let (it as? PropertyDescriptor)?.getter
    }
}

fun ClassDescriptor?.signature2Descriptor(methodName: Name, signature:Array<KotlinType> = emptyArray()) = this?.let {
    this
            .unsubstitutedMemberScope
            .getContributedFunctions(methodName, NoLookupLocation.FROM_BACKEND)
            .firstOrNull {
                return@firstOrNull it.valueParameters.size == signature.size
                        && (signature.isEmpty() || it.valueParameters.any {
                    p -> val index = it.valueParameters.indexOf(p)
                    return@any p.type == signature[index]
        })
    }
}

val PropertyDescriptor.backingField: PropertyDescriptor? 
    get() {
        val backingFieldAnnotation = FqName("konan.internal.HasBackingField")
        return if (this.annotations.findAnnotation(backingFieldAnnotation) != null) this else null
    }

fun DeclarationDescriptor.deepPrint() {
    this.accept(DeepPrintVisitor(PrintVisitor()), 0)
}

internal val String.synthesizedName get() = Name.identifier("\$" + this)
<commit_msg>UTILS: String.synthesizedString added<commit_after>package org.jetbrains.kotlin.backend.konan.descriptors

import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.types.KotlinType

fun ClassDescriptor?.getter2Descriptor(methodName: Name) = this?.let {
    this.unsubstitutedMemberScope.getContributedDescriptors{true}
            .firstOrNull {
                it.name == methodName
            } ?.let {
        return@let (it as? PropertyDescriptor)?.getter
    }
}

fun ClassDescriptor?.signature2Descriptor(methodName: Name, signature:Array<KotlinType> = emptyArray()) = this?.let {
    this
            .unsubstitutedMemberScope
            .getContributedFunctions(methodName, NoLookupLocation.FROM_BACKEND)
            .firstOrNull {
                return@firstOrNull it.valueParameters.size == signature.size
                        && (signature.isEmpty() || it.valueParameters.any {
                    p -> val index = it.valueParameters.indexOf(p)
                    return@any p.type == signature[index]
        })
    }
}

val PropertyDescriptor.backingField: PropertyDescriptor? 
    get() {
        val backingFieldAnnotation = FqName("konan.internal.HasBackingField")
        return if (this.annotations.findAnnotation(backingFieldAnnotation) != null) this else null
    }

fun DeclarationDescriptor.deepPrint() {
    this.accept(DeepPrintVisitor(PrintVisitor()), 0)
}

internal val String.synthesizedName get() = Name.identifier(this.synthesizedString)

internal val String.synthesizedString get() = "\$$this"
{'fraction_non_alphanumeric': 0.09867866179364633, 'fraction_numerical': 0.0016868147315153219, 'mean_word_length': 3.425373134328358, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5112313', 'n_tokens_mistral': 1030, 'n_tokens_neox': 967, 'n_words': 158}