Make JVM backend work with Collection.size as val
0. Such properties are called special because their accessor JVM name differs from usual one
1. When making call to such property, always choose special name
2. When generating Kotlin class inheriting such property generate `final bridge int size() { return this.getSize(); }`
3. If there is no `size` declaration in current class generate `bridge int getSize() { // super-call }`
This commit is contained in:
@@ -69,7 +69,7 @@ public fun <Function : FunctionHandle, Signature> generateBridges(
|
||||
return bridgesToGenerate.map { Bridge(it, method) }.toSet()
|
||||
}
|
||||
|
||||
private fun <Function : FunctionHandle> findAllReachableDeclarations(function: Function): MutableSet<Function> {
|
||||
public fun <Function : FunctionHandle> findAllReachableDeclarations(function: Function): MutableSet<Function> {
|
||||
val collector = object : DFS.NodeHandlerWithListResult<Function, Function>() {
|
||||
override fun afterChildren(current: Function) {
|
||||
if (current.isDeclaration) {
|
||||
@@ -86,7 +86,7 @@ private fun <Function : FunctionHandle> findAllReachableDeclarations(function: F
|
||||
* Given a concrete function, finds an implementation (a concrete declaration) of this function in the supertypes.
|
||||
* The implementation is guaranteed to exist because if it wouldn't, the given function would've been abstract
|
||||
*/
|
||||
private fun <Function : FunctionHandle> findConcreteSuperDeclaration(function: Function): Function {
|
||||
public fun <Function : FunctionHandle> findConcreteSuperDeclaration(function: Function): Function {
|
||||
require(!function.isAbstract, { "Only concrete functions have implementations: $function" })
|
||||
|
||||
if (function.isDeclaration) return function
|
||||
|
||||
@@ -47,7 +47,7 @@ public fun <Signature> generateBridgesForFunctionDescriptor(
|
||||
* can generate a bridge near an implementation (of course, in case it has a super-declaration with a different signature). Ultimately this
|
||||
* eases the process of determining what bridges are already generated in our supertypes and need to be inherited, not regenerated.
|
||||
*/
|
||||
private data class DescriptorBasedFunctionHandle(val descriptor: FunctionDescriptor) : FunctionHandle {
|
||||
public data class DescriptorBasedFunctionHandle(val descriptor: FunctionDescriptor) : FunctionHandle {
|
||||
private val overridden = descriptor.getOverriddenDescriptors().map { DescriptorBasedFunctionHandle(it.getOriginal()) }
|
||||
|
||||
override val isDeclaration: Boolean =
|
||||
|
||||
Reference in New Issue
Block a user