FIR2IR: generate both dispatch & extension receiver without 'else if'
This commit is contained in:
@@ -847,7 +847,8 @@ class Fir2IrVisitor(
|
|||||||
val ownerFunction = symbol.owner
|
val ownerFunction = symbol.owner
|
||||||
if (ownerFunction.dispatchReceiverParameter != null) {
|
if (ownerFunction.dispatchReceiverParameter != null) {
|
||||||
dispatchReceiver = qualifiedAccess.findIrDispatchReceiver()
|
dispatchReceiver = qualifiedAccess.findIrDispatchReceiver()
|
||||||
} else if (ownerFunction.extensionReceiverParameter != null) {
|
}
|
||||||
|
if (ownerFunction.extensionReceiverParameter != null) {
|
||||||
extensionReceiver = qualifiedAccess.findIrExtensionReceiver()
|
extensionReceiver = qualifiedAccess.findIrExtensionReceiver()
|
||||||
}
|
}
|
||||||
this
|
this
|
||||||
|
|||||||
@@ -50,8 +50,7 @@ class JvmIrCodegenFactory(private val phaseConfig: PhaseConfig) : CodegenFactory
|
|||||||
|
|
||||||
val stubGenerator = irProviders.filterIsInstance<DeclarationStubGenerator>().first()
|
val stubGenerator = irProviders.filterIsInstance<DeclarationStubGenerator>().first()
|
||||||
for (descriptor in symbolTable.wrappedTopLevelCallableDescriptors()) {
|
for (descriptor in symbolTable.wrappedTopLevelCallableDescriptors()) {
|
||||||
descriptor as WrappedDeclarationDescriptor<*>
|
val parentClass = stubGenerator.generateOrGetFacadeClass(descriptor as WrappedDeclarationDescriptor<*>)
|
||||||
val parentClass = stubGenerator.generateOrGetFacadeClass(descriptor)
|
|
||||||
descriptor.owner.parent = parentClass ?: throw AssertionError("Facade class for ${descriptor.name} not found")
|
descriptor.owner.parent = parentClass ?: throw AssertionError("Facade class for ${descriptor.name} not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
class It {
|
class It {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
class It {
|
class It {
|
||||||
operator fun next() = 5
|
operator fun next() = 5
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS
|
// IGNORE_BACKEND: JS
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
object A {
|
object A {
|
||||||
fun Int.foo(a: Int = 1): Int {
|
fun Int.foo(a: Int = 1): Int {
|
||||||
return a
|
return a
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
class A {
|
class A {
|
||||||
fun Int.foo(a: Int = 1): Int {
|
fun Int.foo(a: Int = 1): Int {
|
||||||
return a
|
return a
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
class A {
|
class A {
|
||||||
fun Double.foo(a: Double = 1.0): Double {
|
fun Double.foo(a: Double = 1.0): Double {
|
||||||
return a
|
return a
|
||||||
|
|||||||
Vendored
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
class A {
|
class A {
|
||||||
fun Double.foo(a: Double = 1.0, b: Double = 1.0): Double {
|
fun Double.foo(a: Double = 1.0, b: Double = 1.0): Double {
|
||||||
return a + b
|
return a + b
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
class A {
|
class A {
|
||||||
private val sb: StringBuilder = StringBuilder()
|
private val sb: StringBuilder = StringBuilder()
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
class Request(val path: String) {
|
class Request(val path: String) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
|
|
||||||
class C() {
|
class C() {
|
||||||
fun Any.toMyPrefixedString(prefix: String = "", suffix: String="") : String = prefix + " " + suffix
|
fun Any.toMyPrefixedString(prefix: String = "", suffix: String="") : String = prefix + " " + suffix
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
class A
|
class A
|
||||||
|
|
||||||
class B {
|
class B {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
class Outer {
|
class Outer {
|
||||||
class Nested{
|
class Nested{
|
||||||
fun foo(s: String) = s.extension()
|
fun foo(s: String) = s.extension()
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
package name
|
package name
|
||||||
|
|
||||||
class Test() {
|
class Test() {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
// KT-6153 java.lang.IllegalStateException while building
|
// KT-6153 java.lang.IllegalStateException while building
|
||||||
object Bug {
|
object Bug {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
open class A {
|
open class A {
|
||||||
open val a = "OK"
|
open val a = "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
class Bob {
|
class Bob {
|
||||||
fun Bob.bar() = "OK"
|
fun Bob.bar() = "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
open class B {
|
open class B {
|
||||||
val p = "OK"
|
val p = "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ FILE fqName:<root> fileName:/destructuring1.kt
|
|||||||
VAR name:x type:kotlin.Int [val]
|
VAR name:x type:kotlin.Int [val]
|
||||||
CALL 'public final fun component1 (): kotlin.Int [operator] declared in <root>.B' type=kotlin.Int origin=null
|
CALL 'public final fun component1 (): kotlin.Int [operator] declared in <root>.B' type=kotlin.Int origin=null
|
||||||
$this: GET_VAR 'val tmp_0: <root>.A [val] declared in <root>.test' type=<root>.A origin=null
|
$this: GET_VAR 'val tmp_0: <root>.A [val] declared in <root>.test' type=<root>.A origin=null
|
||||||
|
$receiver: GET_VAR 'val tmp_0: <root>.A [val] declared in <root>.test' type=<root>.A origin=null
|
||||||
VAR name:y type:kotlin.Int [val]
|
VAR name:y type:kotlin.Int [val]
|
||||||
CALL 'public final fun component2 (): kotlin.Int [operator] declared in <root>.B' type=kotlin.Int origin=null
|
CALL 'public final fun component2 (): kotlin.Int [operator] declared in <root>.B' type=kotlin.Int origin=null
|
||||||
$this: GET_VAR 'val tmp_0: <root>.A [val] declared in <root>.test' type=<root>.A origin=null
|
$this: GET_VAR 'val tmp_0: <root>.A [val] declared in <root>.test' type=<root>.A origin=null
|
||||||
|
$receiver: GET_VAR 'val tmp_0: <root>.A [val] declared in <root>.test' type=<root>.A origin=null
|
||||||
|
|||||||
Vendored
+1
@@ -34,3 +34,4 @@ FILE fqName:<root> fileName:/nullabilityAssertionOnExtensionReceiver.kt
|
|||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
CALL 'public final fun memberExtension (): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=null
|
CALL 'public final fun memberExtension (): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=null
|
||||||
$this: GET_VAR '<this>: <root>.C declared in <root>.testMemberExt' type=<root>.C origin=null
|
$this: GET_VAR '<this>: <root>.C declared in <root>.testMemberExt' type=<root>.C origin=null
|
||||||
|
$receiver: CALL 'public open fun s (): kotlin.String? declared in <root>.J' type=kotlin.String? origin=null
|
||||||
|
|||||||
Reference in New Issue
Block a user