mirror of
https://github.com/github/codeql.git
synced 2026-02-11 20:51:06 +01:00
Kotlin: Remove support for Kotlin versions 1.6 and 1.7
This change rolls up all files from v1_6_0, v1_6_20, v1_7_0 and v_1_7_20.
In addition, versioned files that are not overridden by any later Kotlin versions (i.e. files that only have one copy under utils/versions) are inlined and removed to simplify list of changes.
List of removed/inlined files:
allOverriddenIncludingSelf.kt
copyTo.kt
ExperimentalCompilerApi.kt
getFileClassFqName.kt
IsUnderscoreParameter.kt
ReferenceEntity.kt
SyntheticBodyKind.kt
Types.kt
withHasQuestionMark.kt
This commit is contained in:
@@ -1343,7 +1343,7 @@ open class KotlinFileExtractor(
|
||||
extractTypeAccessRecursive(substitutedType, location, id, -1)
|
||||
}
|
||||
val syntheticParameterNames =
|
||||
isUnderscoreParameter(vp) ||
|
||||
vp.origin == IrDeclarationOrigin.UNDERSCORE_PARAMETER ||
|
||||
((vp.parent as? IrFunction)?.let { hasSynthesizedParameterNames(it) } ?: true)
|
||||
val javaParameter =
|
||||
when (val callable = (vp.parent as? IrFunction)?.let { getJavaCallable(it) }) {
|
||||
@@ -2836,7 +2836,7 @@ open class KotlinFileExtractor(
|
||||
when {
|
||||
kind == IrSyntheticBodyKind.ENUM_VALUES -> tw.writeKtSyntheticBody(callable, 1)
|
||||
kind == IrSyntheticBodyKind.ENUM_VALUEOF -> tw.writeKtSyntheticBody(callable, 2)
|
||||
kind == kind_ENUM_ENTRIES -> tw.writeKtSyntheticBody(callable, 3)
|
||||
kind == IrSyntheticBodyKind.ENUM_ENTRIES -> tw.writeKtSyntheticBody(callable, 3)
|
||||
else -> {
|
||||
logger.errorElement("Unhandled synthetic body kind " + kind, b)
|
||||
}
|
||||
@@ -3344,7 +3344,7 @@ open class KotlinFileExtractor(
|
||||
// that specified the default values, which will in turn dynamically dispatch back to the
|
||||
// relevant override.
|
||||
val overriddenCallTarget =
|
||||
(callTarget as? IrSimpleFunction)?.allOverriddenIncludingSelf()?.firstOrNull {
|
||||
(callTarget as? IrSimpleFunction)?.allOverridden(includeSelf = true)?.firstOrNull {
|
||||
it.overriddenSymbols.isEmpty() &&
|
||||
it.valueParameters.any { p -> p.defaultValue != null }
|
||||
} ?: callTarget
|
||||
|
||||
@@ -936,7 +936,7 @@ open class KotlinUsesExtractor(
|
||||
return arrayInfo.componentTypeResults
|
||||
}
|
||||
owner is IrClass -> {
|
||||
val args = if (s.codeQlIsRawType()) null else s.arguments
|
||||
val args = if (s.isRawType()) null else s.arguments
|
||||
|
||||
return useSimpleTypeClass(owner, args, s.isNullableCodeQL())
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.github.codeql
|
||||
|
||||
import com.github.codeql.utils.versions.copyParameterToFunction
|
||||
import com.github.codeql.utils.versions.createImplicitParameterDeclarationWithWrappedDescriptor
|
||||
import java.lang.annotation.ElementType
|
||||
import java.util.HashSet
|
||||
@@ -21,7 +20,9 @@ import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||
import org.jetbrains.kotlin.ir.declarations.IrConstructor
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.declarations.IrEnumEntry
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||
import org.jetbrains.kotlin.ir.declarations.IrProperty
|
||||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||
import org.jetbrains.kotlin.ir.expressions.IrClassReference
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.expressions.IrGetEnumValue
|
||||
@@ -31,6 +32,7 @@ import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.types.typeWith
|
||||
import org.jetbrains.kotlin.ir.util.constructedClass
|
||||
import org.jetbrains.kotlin.ir.util.constructors
|
||||
import org.jetbrains.kotlin.ir.util.copyTo
|
||||
import org.jetbrains.kotlin.ir.util.deepCopyWithSymbols
|
||||
import org.jetbrains.kotlin.ir.util.defaultType
|
||||
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
|
||||
@@ -330,7 +332,7 @@ class MetaAnnotationSupport(
|
||||
)
|
||||
return
|
||||
}
|
||||
val newParam = copyParameterToFunction(thisReceiever, this)
|
||||
val newParam = thisReceiever.copyTo(this)
|
||||
dispatchReceiverParameter = newParam
|
||||
body =
|
||||
factory
|
||||
|
||||
@@ -12,9 +12,11 @@ import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
|
||||
import org.jetbrains.kotlin.ir.util.parentClassOrNull
|
||||
import org.jetbrains.kotlin.load.java.sources.JavaSourceElement
|
||||
import org.jetbrains.kotlin.load.java.structure.impl.classFiles.BinaryJavaClass
|
||||
import org.jetbrains.kotlin.load.kotlin.FacadeClassSource
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmPackagePartSource
|
||||
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinarySourceElement
|
||||
import org.jetbrains.kotlin.load.kotlin.VirtualFileKotlinClass
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
|
||||
// Adapted from Kotlin's interpreter/Utils.kt function 'internalName'
|
||||
// Translates class names into their JLS section 13.1 binary name,
|
||||
@@ -31,6 +33,40 @@ fun getFileClassName(f: IrFile) =
|
||||
.replaceFirst(Regex("""\.kt$"""), "")
|
||||
.replaceFirstChar { it.uppercase() }) + "Kt")
|
||||
|
||||
fun getFileClassFqName(d: IrDeclaration): FqName? {
|
||||
// d is in a file class.
|
||||
// Get the name in a similar way to the compiler's ExternalPackageParentPatcherLowering
|
||||
// visitMemberAccess/generateOrGetFacadeClass.
|
||||
|
||||
// But first, fields aren't IrMemberWithContainerSource, so we need
|
||||
// to get back to the property (if there is one)
|
||||
if (d is IrField) {
|
||||
val propSym = d.correspondingPropertySymbol
|
||||
if (propSym != null) {
|
||||
return getFileClassFqName(propSym.owner)
|
||||
}
|
||||
}
|
||||
|
||||
// Now the main code
|
||||
if (d is IrMemberWithContainerSource) {
|
||||
val containerSource = d.containerSource
|
||||
if (containerSource is FacadeClassSource) {
|
||||
val facadeClassName = containerSource.facadeClassName
|
||||
if (facadeClassName != null) {
|
||||
// TODO: This is really a multifile-class rather than a file-class,
|
||||
// but for now we treat them the same.
|
||||
return facadeClassName.fqNameForTopLevelClassMaybeWithDollars
|
||||
} else {
|
||||
return containerSource.className.fqNameForTopLevelClassMaybeWithDollars
|
||||
}
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
fun getIrElementBinaryName(that: IrElement): String {
|
||||
if (that is IrFile) {
|
||||
val shortName = getFileClassName(that)
|
||||
|
||||
@@ -2,9 +2,38 @@ package com.github.codeql.utils
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||
import org.jetbrains.kotlin.ir.symbols.*
|
||||
import org.jetbrains.kotlin.name.CallableId
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
fun getClassByFqName(pluginContext: IrPluginContext, fqName: FqName): IrClassSymbol? {
|
||||
val id = ClassId.topLevel(fqName)
|
||||
return getClassByClassId(pluginContext, id)
|
||||
}
|
||||
|
||||
fun getClassByClassId(pluginContext: IrPluginContext, id: ClassId): IrClassSymbol? {
|
||||
return pluginContext.referenceClass(id)
|
||||
}
|
||||
|
||||
fun getFunctionsByFqName(
|
||||
pluginContext: IrPluginContext,
|
||||
pkgName: FqName,
|
||||
name: Name
|
||||
): Collection<IrSimpleFunctionSymbol> {
|
||||
val id = CallableId(pkgName, name)
|
||||
return pluginContext.referenceFunctions(id)
|
||||
}
|
||||
|
||||
fun getPropertiesByFqName(
|
||||
pluginContext: IrPluginContext,
|
||||
pkgName: FqName,
|
||||
name: Name
|
||||
): Collection<IrPropertySymbol> {
|
||||
val id = CallableId(pkgName, name)
|
||||
return pluginContext.referenceProperties(id)
|
||||
}
|
||||
|
||||
fun getClassByFqName(pluginContext: IrPluginContext, fqName: String): IrClassSymbol? {
|
||||
return getClassByFqName(pluginContext, FqName(fqName))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.github.codeql.utils
|
||||
|
||||
import com.github.codeql.utils.versions.allOverriddenIncludingSelf
|
||||
import com.github.codeql.utils.versions.CodeQLIrConst
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.ir.declarations.IrAnnotationContainer
|
||||
@@ -9,6 +8,7 @@ import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
||||
import org.jetbrains.kotlin.ir.util.allOverridden
|
||||
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
|
||||
import org.jetbrains.kotlin.ir.util.packageFqName
|
||||
import org.jetbrains.kotlin.ir.util.parentClassOrNull
|
||||
@@ -62,7 +62,7 @@ private val specialFunctionShortNames = specialFunctions.keys.map { it.functionN
|
||||
|
||||
private fun getSpecialJvmName(f: IrFunction): String? {
|
||||
if (specialFunctionShortNames.contains(f.name) && f is IrSimpleFunction) {
|
||||
f.allOverriddenIncludingSelf().forEach { overriddenFunc ->
|
||||
f.allOverridden(includeSelf = true).forEach { overriddenFunc ->
|
||||
overriddenFunc.parentClassOrNull?.fqNameWhenAvailable?.let { parentFqName ->
|
||||
specialFunctions[MethodKey(parentFqName, f.name)]?.let {
|
||||
return it
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.github.codeql.utils
|
||||
import com.github.codeql.KotlinUsesExtractor
|
||||
import com.github.codeql.Logger
|
||||
import com.github.codeql.getJavaEquivalentClassId
|
||||
import com.github.codeql.utils.versions.codeQlWithHasQuestionMark
|
||||
import com.github.codeql.utils.versions.createImplicitParameterDeclarationWithWrappedDescriptor
|
||||
import com.github.codeql.utils.versions.*
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||
@@ -21,6 +20,8 @@ import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.DescriptorlessExternalPackageFragmentSymbol
|
||||
import org.jetbrains.kotlin.ir.types.addAnnotations
|
||||
import org.jetbrains.kotlin.ir.types.classifierOrNull
|
||||
import org.jetbrains.kotlin.ir.types.makeNotNull
|
||||
import org.jetbrains.kotlin.ir.types.makeNullable
|
||||
import org.jetbrains.kotlin.ir.types.typeWith
|
||||
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
||||
import org.jetbrains.kotlin.ir.types.IrStarProjection
|
||||
@@ -36,6 +37,14 @@ import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||
|
||||
fun IrType.codeQlWithHasQuestionMark(b: Boolean): IrType {
|
||||
if (b) {
|
||||
return this.makeNullable()
|
||||
} else {
|
||||
return this.makeNotNull()
|
||||
}
|
||||
}
|
||||
|
||||
fun IrType.substituteTypeArguments(params: List<IrTypeParameter>, arguments: List<IrTypeArgument>) =
|
||||
when (this) {
|
||||
is IrSimpleType -> substituteTypeArguments(params.map { it.symbol }.zip(arguments).toMap())
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
package org.jetbrains.kotlin.compiler.plugin
|
||||
|
||||
@RequiresOptIn("This API is experimental. There are no stability guarantees for it")
|
||||
annotation class ExperimentalCompilerApi
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||
import org.jetbrains.kotlin.psi.KtParameter
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||
import org.jetbrains.kotlin.resolve.calls.util.isSingleUnderscore
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
|
||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||
fun isUnderscoreParameter(vp: IrValueParameter) =
|
||||
try {
|
||||
DescriptorToSourceUtils.getSourceFromDescriptor(vp.descriptor)
|
||||
?.safeAs<KtParameter>()
|
||||
?.isSingleUnderscore == true
|
||||
} catch (e: NotImplementedError) {
|
||||
// Some kinds of descriptor throw in `getSourceFromDescriptor` as that method is not
|
||||
// normally expected to
|
||||
// be applied to synthetic functions.
|
||||
false
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.github.codeql.utils
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||
import org.jetbrains.kotlin.ir.symbols.*
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
fun getClassByFqName(pluginContext: IrPluginContext, fqName: FqName): IrClassSymbol? {
|
||||
return pluginContext.referenceClass(fqName)
|
||||
}
|
||||
|
||||
fun getClassByClassId(pluginContext: IrPluginContext, id: ClassId): IrClassSymbol? {
|
||||
return getClassByFqName(pluginContext, id.asSingleFqName())
|
||||
}
|
||||
|
||||
fun getFunctionsByFqName(
|
||||
pluginContext: IrPluginContext,
|
||||
pkgName: FqName,
|
||||
name: Name
|
||||
): Collection<IrSimpleFunctionSymbol> {
|
||||
val fqName = pkgName.child(name)
|
||||
return pluginContext.referenceFunctions(fqName)
|
||||
}
|
||||
|
||||
fun getPropertiesByFqName(
|
||||
pluginContext: IrPluginContext,
|
||||
pkgName: FqName,
|
||||
name: Name
|
||||
): Collection<IrPropertySymbol> {
|
||||
val fqName = pkgName.child(name)
|
||||
return pluginContext.referenceProperties(fqName)
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.ir.expressions.IrSyntheticBodyKind
|
||||
|
||||
val kind_ENUM_ENTRIES: IrSyntheticBodyKind? = null
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.backend.jvm.codegen.isRawType
|
||||
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
||||
|
||||
fun IrSimpleType.codeQlIsRawType() = this.isRawType()
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.ir.allOverridden
|
||||
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
||||
|
||||
fun IrSimpleFunction.allOverriddenIncludingSelf() = this.allOverridden(includeSelf = true)
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.ir.copyTo
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||
|
||||
fun copyParameterToFunction(p: IrValueParameter, f: IrFunction) = p.copyTo(f)
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.ir.createImplicitParameterDeclarationWithWrappedDescriptor
|
||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||
|
||||
fun IrClass.createImplicitParameterDeclarationWithWrappedDescriptor() =
|
||||
this.createImplicitParameterDeclarationWithWrappedDescriptor()
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
|
||||
fun getFileClassFqName(@Suppress("UNUSED_PARAMETER") d: IrDeclaration): FqName? {
|
||||
return null
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
||||
import org.jetbrains.kotlin.ir.types.impl.IrTypeBase
|
||||
|
||||
fun getKotlinType(s: IrSimpleType) = (s as? IrTypeBase)?.kotlinType
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.withHasQuestionMark
|
||||
|
||||
fun IrType.codeQlWithHasQuestionMark(b: Boolean): IrType {
|
||||
return this.withHasQuestionMark(b)
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||
|
||||
fun isUnderscoreParameter(vp: IrValueParameter) =
|
||||
vp.origin == IrDeclarationOrigin.UNDERSCORE_PARAMETER
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.isRawType
|
||||
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
||||
|
||||
fun IrSimpleType.codeQlIsRawType() = this.isRawType()
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||
import org.jetbrains.kotlin.ir.declarations.IrField
|
||||
import org.jetbrains.kotlin.ir.declarations.IrMemberWithContainerSource
|
||||
import org.jetbrains.kotlin.load.kotlin.FacadeClassSource
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
|
||||
fun getFileClassFqName(d: IrDeclaration): FqName? {
|
||||
// d is in a file class.
|
||||
// Get the name in a similar way to the compiler's ExternalPackageParentPatcherLowering
|
||||
// visitMemberAccess/generateOrGetFacadeClass.
|
||||
|
||||
// But first, fields aren't IrMemberWithContainerSource, so we need
|
||||
// to get back to the property (if there is one)
|
||||
if (d is IrField) {
|
||||
val propSym = d.correspondingPropertySymbol
|
||||
if (propSym != null) {
|
||||
return getFileClassFqName(propSym.owner)
|
||||
}
|
||||
}
|
||||
|
||||
// Now the main code
|
||||
if (d is IrMemberWithContainerSource) {
|
||||
val containerSource = d.containerSource
|
||||
if (containerSource is FacadeClassSource) {
|
||||
val facadeClassName = containerSource.facadeClassName
|
||||
if (facadeClassName != null) {
|
||||
// TODO: This is really a multifile-class rather than a file-class,
|
||||
// but for now we treat them the same.
|
||||
return facadeClassName.fqNameForTopLevelClassMaybeWithDollars
|
||||
} else {
|
||||
return containerSource.className.fqNameForTopLevelClassMaybeWithDollars
|
||||
}
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.makeNotNull
|
||||
import org.jetbrains.kotlin.ir.types.makeNullable
|
||||
|
||||
fun IrType.codeQlWithHasQuestionMark(b: Boolean): IrType {
|
||||
if (b) {
|
||||
return this.makeNullable()
|
||||
} else {
|
||||
return this.makeNotNull()
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
||||
import org.jetbrains.kotlin.ir.util.allOverridden
|
||||
|
||||
fun IrSimpleFunction.allOverriddenIncludingSelf() = this.allOverridden(includeSelf = true)
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||
import org.jetbrains.kotlin.ir.util.copyTo
|
||||
|
||||
fun copyParameterToFunction(p: IrValueParameter, f: IrFunction) = p.copyTo(f)
|
||||
@@ -1,4 +0,0 @@
|
||||
package com.github.codeql
|
||||
|
||||
// The compiler provides the annotation class, so we don't need to do
|
||||
// anything
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.github.codeql.utils
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||
import org.jetbrains.kotlin.ir.symbols.*
|
||||
import org.jetbrains.kotlin.name.CallableId
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
fun getClassByFqName(pluginContext: IrPluginContext, fqName: FqName): IrClassSymbol? {
|
||||
val id = ClassId.topLevel(fqName)
|
||||
return getClassByClassId(pluginContext, id)
|
||||
}
|
||||
|
||||
fun getClassByClassId(pluginContext: IrPluginContext, id: ClassId): IrClassSymbol? {
|
||||
return pluginContext.referenceClass(id)
|
||||
}
|
||||
|
||||
fun getFunctionsByFqName(
|
||||
pluginContext: IrPluginContext,
|
||||
pkgName: FqName,
|
||||
name: Name
|
||||
): Collection<IrSimpleFunctionSymbol> {
|
||||
val id = CallableId(pkgName, name)
|
||||
return pluginContext.referenceFunctions(id)
|
||||
}
|
||||
|
||||
fun getPropertiesByFqName(
|
||||
pluginContext: IrPluginContext,
|
||||
pkgName: FqName,
|
||||
name: Name
|
||||
): Collection<IrPropertySymbol> {
|
||||
val id = CallableId(pkgName, name)
|
||||
return pluginContext.referenceProperties(id)
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.ir.expressions.IrSyntheticBodyKind
|
||||
|
||||
val kind_ENUM_ENTRIES: IrSyntheticBodyKind? = IrSyntheticBodyKind.ENUM_ENTRIES
|
||||
Reference in New Issue
Block a user