Skip to content

Commit 4448ba1

Browse files
committed
Kotlin: Add compatibility source for 1.7.0-RC
1 parent 078733c commit 4448ba1

File tree

6 files changed

+57
-0
lines changed

6 files changed

+57
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.github.codeql.utils.versions
2+
3+
import com.github.codeql.KotlinUsesExtractor
4+
import org.jetbrains.kotlin.ir.util.DeclarationStubGenerator
5+
6+
fun <TIrStub> KotlinUsesExtractor.getIrStubFromDescriptor(generateStub: (DeclarationStubGenerator) -> TIrStub) : TIrStub? {
7+
logger.error("Descriptors not yet supported for Kotlin 1.7")
8+
return null
9+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.github.codeql.utils.versions
2+
3+
import org.jetbrains.kotlin.ir.IrFileEntry
4+
5+
typealias FileEntry = IrFileEntry
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.github.codeql.utils.versions
2+
3+
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
4+
5+
fun functionN(pluginContext: IrPluginContext) = pluginContext.irBuiltIns::functionN
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.github.codeql.utils.versions
2+
3+
import com.intellij.psi.PsiElement
4+
import org.jetbrains.kotlin.backend.common.psi.PsiSourceManager
5+
import org.jetbrains.kotlin.backend.jvm.ir.getKtFile
6+
import org.jetbrains.kotlin.ir.IrElement
7+
import org.jetbrains.kotlin.ir.declarations.IrFile
8+
import org.jetbrains.kotlin.psi.KtFile
9+
10+
class Psi2Ir: Psi2IrFacade {
11+
override fun getKtFile(irFile: IrFile): KtFile? {
12+
return irFile.getKtFile()
13+
}
14+
15+
override fun findPsiElement(irElement: IrElement, irFile: IrFile): PsiElement? {
16+
return PsiSourceManager.findPsiElement(irElement, irFile)
17+
}
18+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.github.codeql.utils.versions
2+
3+
import org.jetbrains.kotlin.backend.jvm.ir.isRawType
4+
import org.jetbrains.kotlin.ir.types.IrSimpleType
5+
6+
7+
fun IrSimpleType.isRawType() = this.isRawType()
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.github.codeql.utils.versions
2+
3+
import org.jetbrains.kotlin.ir.types.IrType
4+
import org.jetbrains.kotlin.ir.types.makeNotNull
5+
import org.jetbrains.kotlin.ir.types.makeNullable
6+
7+
fun IrType.codeQlWithHasQuestionMark(b : Boolean): IrType {
8+
if (b) {
9+
return this.makeNullable()
10+
} else {
11+
return this.makeNotNull()
12+
}
13+
}

0 commit comments

Comments
 (0)