Skip to content

Commit 6007b23

Browse files
mcpiromanSpace Team
authored andcommitted
[IR] Add IrChecker interface
common for element type and symbol checkers.
1 parent 4eaae30 commit 6007b23

File tree

6 files changed

+18
-31
lines changed

6 files changed

+18
-31
lines changed

compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/IrValidator.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import org.jetbrains.kotlin.backend.common.checkers.checkTreeConsistency
1212
import org.jetbrains.kotlin.backend.common.checkers.context.*
1313
import org.jetbrains.kotlin.backend.common.checkers.declaration.*
1414
import org.jetbrains.kotlin.backend.common.checkers.expression.*
15-
import org.jetbrains.kotlin.backend.common.checkers.symbol.IrSymbolChecker
1615
import org.jetbrains.kotlin.backend.common.checkers.symbol.IrVisibilityChecker
17-
import org.jetbrains.kotlin.backend.common.checkers.type.IrTypeChecker
16+
import org.jetbrains.kotlin.backend.common.checkers.IrSymbolChecker
17+
import org.jetbrains.kotlin.backend.common.checkers.IrTypeChecker
1818
import org.jetbrains.kotlin.backend.common.checkers.type.IrTypeParameterScopeChecker
1919
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
2020
import org.jetbrains.kotlin.cli.common.messages.MessageCollector

compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/checkers/IrChecker.kt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,26 @@
66
package org.jetbrains.kotlin.backend.common.checkers
77

88
import org.jetbrains.kotlin.backend.common.checkers.context.CheckerContext
9+
import org.jetbrains.kotlin.backend.common.checkers.context.ContextUpdater
910
import org.jetbrains.kotlin.ir.IrElement
11+
import org.jetbrains.kotlin.ir.symbols.IrSymbol
12+
import org.jetbrains.kotlin.ir.types.IrType
1013
import kotlin.reflect.KClass
1114

15+
sealed interface IrChecker
16+
1217
abstract class IrElementChecker<in E : IrElement>(
1318
elementClass: KClass<in E>,
14-
) {
19+
) : IrChecker {
1520
internal val elementClass: Class<in E> = elementClass.java
1621

1722
abstract fun check(element: E, context: CheckerContext)
1823
}
24+
25+
interface IrTypeChecker : IrChecker {
26+
fun check(type: IrType, container: IrElement, context: CheckerContext)
27+
}
28+
29+
interface IrSymbolChecker : IrChecker {
30+
fun check(symbol: IrSymbol, container: IrElement, context: CheckerContext)
31+
}

compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/checkers/symbol/IrSymbolChecker.kt

Lines changed: 0 additions & 14 deletions
This file was deleted.

compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/checkers/symbol/IrVisibilityChecker.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package org.jetbrains.kotlin.backend.common.checkers.symbol
77

8+
import org.jetbrains.kotlin.backend.common.checkers.IrSymbolChecker
89
import org.jetbrains.kotlin.backend.common.checkers.checkVisibility
910
import org.jetbrains.kotlin.backend.common.checkers.context.CheckerContext
1011
import org.jetbrains.kotlin.ir.IrElement

compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/checkers/type/IrTypeChecker.kt

Lines changed: 0 additions & 14 deletions
This file was deleted.

compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/checkers/type/IrTypeParameterScopeChecker.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package org.jetbrains.kotlin.backend.common.checkers.type
77

8+
import org.jetbrains.kotlin.backend.common.checkers.IrTypeChecker
89
import org.jetbrains.kotlin.backend.common.checkers.context.CheckerContext
910
import org.jetbrains.kotlin.ir.IrElement
1011
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol

0 commit comments

Comments
 (0)