Support basic light-classes basic with FIR for CLI

This commit is contained in:
Denis Zharkov
2019-08-23 16:22:30 +03:00
parent e7410348a7
commit bf610323cf
38 changed files with 1077 additions and 11 deletions
@@ -36,6 +36,8 @@ interface FirRegularClass : FirClass, @VisitedSupertype FirClassLikeDeclaration<
}
fun replaceSupertypes(newSupertypes: List<FirTypeRef>): FirRegularClass
fun setCallbackOnSupertypesComputed(callback: () -> Unit)
}
val FirRegularClass.classId get() = symbol.classId
@@ -63,6 +63,8 @@ open class FirClassImpl(
override fun replaceSupertypes(newSupertypes: List<FirTypeRef>): FirRegularClass {
superTypeRefs.clear()
superTypeRefs.addAll(newSupertypes)
callbackOnSupertypesComputed?.invoke()
callbackOnSupertypesComputed = null
return this
}
@@ -76,4 +78,10 @@ open class FirClassImpl(
companionObject = declarations.asSequence().filterIsInstance<FirRegularClass>().firstOrNull { it.isCompanion }
return result
}
private var callbackOnSupertypesComputed: (() -> Unit)? = null
override fun setCallbackOnSupertypesComputed(callback: () -> Unit) {
callbackOnSupertypesComputed = callback
}
}
@@ -54,9 +54,17 @@ class FirEnumEntryImpl(
override fun replaceSupertypes(newSupertypes: List<FirTypeRef>): FirRegularClass {
superTypeRefs.clear()
superTypeRefs.addAll(newSupertypes)
callbackOnSupertypesComputed?.invoke()
callbackOnSupertypesComputed = null
return this
}
private var callbackOnSupertypesComputed: (() -> Unit)? = null
override fun setCallbackOnSupertypesComputed(callback: () -> Unit) {
callbackOnSupertypesComputed = callback
}
override fun replaceTypeRef(newTypeRef: FirTypeRef) {
typeRef = newTypeRef
}
@@ -85,4 +93,4 @@ class FirEnumEntryImpl(
return this
}
}
}