Kotlin: Use packageFqName rather than fqName

Upstream master says:
   error: using 'fqName: FqName' is an error. Please use `packageFqName` instead
This commit is contained in:
Ian Lynagh
2023-08-31 15:37:06 +01:00
parent 261ba8e02d
commit d511d46cde
4 changed files with 12 additions and 10 deletions

View File

@@ -107,7 +107,7 @@ open class KotlinFileExtractor(
fun extractFileContents(file: IrFile, id: Label<DbFile>) {
with("file", file) {
val locId = tw.getWholeFileLocation()
val pkg = file.fqName.asString()
val pkg = file.packageFqName.asString()
val pkgId = extractPackage(pkg)
tw.writeHasLocation(id, locId)
tw.writeCupackage(id, pkgId)
@@ -1901,8 +1901,9 @@ open class KotlinFileExtractor(
verboseln("No match as didn't find target package")
return false
}
if (targetPkg.fqName.asString() != pName) {
verboseln("No match as package name is ${targetPkg.fqName.asString()}")
val targetName = targetPkg.packageFqName.asString()
if (targetName != pName) {
verboseln("No match as package name is $targetName")
return false
}
verboseln("Match")
@@ -2556,8 +2557,9 @@ open class KotlinFileExtractor(
verboseln("No match as didn't find target package")
return false
}
if (targetPkg.fqName.asString() != pkgName) {
verboseln("No match as package name is ${targetPkg.fqName.asString()} not $pkgName")
val targetName = targetPkg.packageFqName.asString()
if (targetName != pkgName) {
verboseln("No match as package name is $targetName not $pkgName")
return false
}
verboseln("Match")

View File

@@ -83,7 +83,7 @@ open class KotlinUsesExtractor(
)
fun extractFileClass(f: IrFile): Label<out DbClassorinterface> {
val pkg = f.fqName.asString()
val pkg = f.packageFqName.asString()
val jvmName = getFileClassName(f)
val id = extractFileClass(pkg, jvmName)
if (tw.lm.fileClassLocationsExtracted.add(f)) {
@@ -848,7 +848,7 @@ open class KotlinUsesExtractor(
when(dp) {
is IrFile ->
if(canBeTopLevel) {
usePackage(dp.fqName.asString())
usePackage(dp.packageFqName.asString())
} else {
extractFileClass(dp)
}

View File

@@ -12,7 +12,7 @@ import com.github.codeql.utils.*
class PrimitiveTypeMapping(val logger: Logger, val pluginContext: IrPluginContext) {
fun getPrimitiveInfo(s: IrSimpleType) =
s.classOrNull?.let {
if ((it.owner.parent as? IrPackageFragment)?.fqName == StandardNames.BUILT_INS_PACKAGE_FQ_NAME)
if ((it.owner.parent as? IrPackageFragment)?.packageFqName == StandardNames.BUILT_INS_PACKAGE_FQ_NAME)
mapping[it.owner.name]
else
null

View File

@@ -33,7 +33,7 @@ fun getFileClassName(f: IrFile) =
fun getIrElementBinaryName(that: IrElement): String {
if (that is IrFile) {
val shortName = getFileClassName(that)
val pkg = that.fqName.asString()
val pkg = that.packageFqName.asString()
return if (pkg.isEmpty()) shortName else "$pkg.$shortName"
}
@@ -59,7 +59,7 @@ fun getIrElementBinaryName(that: IrElement): String {
.forEach {
when (it) {
is IrClass -> internalName.insert(0, getName(it) + "$")
is IrPackageFragment -> it.fqName.asString().takeIf { fqName -> fqName.isNotEmpty() }?.let { fqName -> internalName.insert(0, "$fqName.") }
is IrPackageFragment -> it.packageFqName.asString().takeIf { fqName -> fqName.isNotEmpty() }?.let { fqName -> internalName.insert(0, "$fqName.") }
}
}
return internalName.toString()