File tree Expand file tree Collapse file tree 4 files changed +20
-0
lines changed
kotlin-compiler-extensions
main/kotlin/com/javiersc/kotlin/compiler/extensions/fir Expand file tree Collapse file tree 4 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 44
55### Added
66
7+ - ` FirBasedSymbol<*>.isProperty(): Boolean `
8+ - ` FirBasedSymbol<*>.isFunction(): Boolean `
79- ` FirBasedSymbol<*>.hasOwner: Boolean `
810- ` <reified T> classId(): ClassId `
911- ` ClassId.toCallableId(): CallableId `
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ public final class com/javiersc/kotlin/compiler/extensions/common/NameKt {
2020
2121public final class com/javiersc/kotlin/compiler/extensions/fir/FirBasedSymbolKt {
2222 public static final fun getHasOwner (Lorg/jetbrains/kotlin/fir/symbols/FirBasedSymbol;)Z
23+ public static final fun isFunction (Lorg/jetbrains/kotlin/fir/symbols/FirBasedSymbol;)Z
24+ public static final fun isProperty (Lorg/jetbrains/kotlin/fir/symbols/FirBasedSymbol;)Z
2325 public static final fun packageFqName (Lorg/jetbrains/kotlin/fir/symbols/FirBasedSymbol;)Lorg/jetbrains/kotlin/name/FqName;
2426}
2527
Original file line number Diff line number Diff line change 99 // TODO: https://github.com/facebook/ktfmt/pull/400
1010 // https://github.com/facebook/ktfmt/issues/314
1111 format.isEnabled.set(false )
12+ languageSettings { //
13+ experimentalContracts()
14+ }
1215 publishing()
1316 }
1417
Original file line number Diff line number Diff line change 11package com.javiersc.kotlin.compiler.extensions.fir
22
3+ import kotlin.contracts.contract
34import org.jetbrains.kotlin.fir.getOwnerLookupTag
45import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
56import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
67import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol
8+ import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol
9+ import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
710import org.jetbrains.kotlin.name.FqName
811
912public fun FirBasedSymbol <* >.packageFqName (): FqName ? {
@@ -16,3 +19,13 @@ public fun FirBasedSymbol<*>.packageFqName(): FqName? {
1619
1720public val FirBasedSymbol <* >.hasOwner: Boolean
1821 get() = runCatching { getOwnerLookupTag() }.getOrNull() != null
22+
23+ public fun FirBasedSymbol <* >.isProperty (): Boolean {
24+ contract { returns(true ) implies (this @FirBasedSymbol is FirPropertySymbol ) }
25+ return this is FirPropertySymbol
26+ }
27+
28+ public fun FirBasedSymbol <* >.isFunction (): Boolean {
29+ contract { returns(true ) implies (this @FirBasedSymbol is FirFunctionSymbol ) }
30+ return this is FirFunctionSymbol
31+ }
You can’t perform that action at this time.
0 commit comments