JVM IR: Use package visibility for fields of captured variables
This commit is contained in:
committed by
Alexander Udalov
parent
443269af0a
commit
02e78bcd76
@@ -129,10 +129,7 @@ internal val localDeclarationsPhase = makeIrFilePhase(
|
|||||||
declaration.visibility
|
declaration.visibility
|
||||||
|
|
||||||
override fun forCapturedField(value: IrValueSymbol): Visibility =
|
override fun forCapturedField(value: IrValueSymbol): Visibility =
|
||||||
if (value is IrValueParameterSymbol && value.owner.isCrossinline)
|
JavaVisibilities.PACKAGE_VISIBILITY // avoid requiring a synthetic accessor for it
|
||||||
JavaVisibilities.PACKAGE_VISIBILITY // avoid requiring a synthetic accessor for it
|
|
||||||
else
|
|
||||||
Visibilities.PRIVATE
|
|
||||||
|
|
||||||
private fun scopedVisibility(inInlineFunctionScope: Boolean): Visibility =
|
private fun scopedVisibility(inInlineFunctionScope: Boolean): Visibility =
|
||||||
if (inInlineFunctionScope) Visibilities.PUBLIC else JavaVisibilities.PACKAGE_VISIBILITY
|
if (inInlineFunctionScope) Visibilities.PUBLIC else JavaVisibilities.PACKAGE_VISIBILITY
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
annotation class ClsAnn
|
annotation class ClsAnn
|
||||||
|
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
annotation class Simple(val value: String)
|
annotation class Simple(val value: String)
|
||||||
|
|
||||||
fun localCaptured(): Any {
|
fun localCaptured(): Any {
|
||||||
|
|||||||
+2
-2
@@ -49,7 +49,7 @@ public abstract class helpers/ContinuationAdapter {
|
|||||||
@kotlin.Metadata
|
@kotlin.Metadata
|
||||||
public final class helpers/CoroutineUtilKt$handleExceptionContinuation$1 {
|
public final class helpers/CoroutineUtilKt$handleExceptionContinuation$1 {
|
||||||
// source: 'CoroutineUtil.kt'
|
// source: 'CoroutineUtil.kt'
|
||||||
private synthetic final field $x: kotlin.jvm.functions.Function1
|
synthetic final field $x: kotlin.jvm.functions.Function1
|
||||||
private final @org.jetbrains.annotations.NotNull field context: kotlin.coroutines.EmptyCoroutineContext
|
private final @org.jetbrains.annotations.NotNull field context: kotlin.coroutines.EmptyCoroutineContext
|
||||||
inner (anonymous) class helpers/CoroutineUtilKt$handleExceptionContinuation$1
|
inner (anonymous) class helpers/CoroutineUtilKt$handleExceptionContinuation$1
|
||||||
method <init>(p0: kotlin.jvm.functions.Function1): void
|
method <init>(p0: kotlin.jvm.functions.Function1): void
|
||||||
@@ -61,7 +61,7 @@ public final class helpers/CoroutineUtilKt$handleExceptionContinuation$1 {
|
|||||||
@kotlin.Metadata
|
@kotlin.Metadata
|
||||||
public final class helpers/CoroutineUtilKt$handleResultContinuation$1 {
|
public final class helpers/CoroutineUtilKt$handleResultContinuation$1 {
|
||||||
// source: 'CoroutineUtil.kt'
|
// source: 'CoroutineUtil.kt'
|
||||||
private synthetic final field $x: kotlin.jvm.functions.Function1
|
synthetic final field $x: kotlin.jvm.functions.Function1
|
||||||
private final @org.jetbrains.annotations.NotNull field context: kotlin.coroutines.EmptyCoroutineContext
|
private final @org.jetbrains.annotations.NotNull field context: kotlin.coroutines.EmptyCoroutineContext
|
||||||
inner (anonymous) class helpers/CoroutineUtilKt$handleResultContinuation$1
|
inner (anonymous) class helpers/CoroutineUtilKt$handleResultContinuation$1
|
||||||
method <init>(p0: kotlin.jvm.functions.Function1): void
|
method <init>(p0: kotlin.jvm.functions.Function1): void
|
||||||
|
|||||||
Vendored
+1
-1
@@ -19,4 +19,4 @@ fun test() {
|
|||||||
// 1 final synthetic LReceiver; \$this_useExtensionLambda
|
// 1 final synthetic LReceiver; \$this_useExtensionLambda
|
||||||
|
|
||||||
// JVM_IR_TEMPLATES
|
// JVM_IR_TEMPLATES
|
||||||
// 1 private final synthetic LReceiver; \$this
|
// 1 final synthetic LReceiver; \$this
|
||||||
-4
@@ -10,8 +10,4 @@ fun Receiver.bar() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// JVM_TEMPLATES
|
|
||||||
// 1 final synthetic LReceiver; \$this_bar
|
// 1 final synthetic LReceiver; \$this_bar
|
||||||
|
|
||||||
// JVM_IR_TEMPLATES
|
|
||||||
// 1 private final synthetic LReceiver; \$this_bar
|
|
||||||
+1
-3
@@ -15,9 +15,7 @@ class Outer {
|
|||||||
fun outerFoo() {}
|
fun outerFoo() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// JVM_TEMPLATES
|
|
||||||
// 1 final synthetic LOuter\$Inner; this\$0
|
// 1 final synthetic LOuter\$Inner; this\$0
|
||||||
|
|
||||||
// JVM_IR_TEMPLATES
|
// JVM_IR_TEMPLATES
|
||||||
// 1 private final synthetic LOuter\$Inner; this\$0
|
// 1 final synthetic LOuter; this\$1
|
||||||
// 1 private final synthetic LOuter; this\$1
|
|
||||||
|
|||||||
+1
-1
@@ -19,4 +19,4 @@ fun test() {
|
|||||||
// 1 final synthetic LReceiver; \$this_label
|
// 1 final synthetic LReceiver; \$this_label
|
||||||
|
|
||||||
// JVM_IR_TEMPLATES
|
// JVM_IR_TEMPLATES
|
||||||
// 1 private final synthetic LReceiver; \$this
|
// 1 final synthetic LReceiver; \$this
|
||||||
Vendored
+2
-2
@@ -22,5 +22,5 @@ fun Foo.test(bar: Bar) {
|
|||||||
// 1 final synthetic LBar; \$this_test
|
// 1 final synthetic LBar; \$this_test
|
||||||
|
|
||||||
// JVM_IR_TEMPLATES
|
// JVM_IR_TEMPLATES
|
||||||
// 1 private final synthetic LFoo; \$this_test
|
// 1 final synthetic LFoo; \$this_test
|
||||||
// 1 private final synthetic LBar; \$this_test\$1
|
// 1 final synthetic LBar; \$this_test\$1
|
||||||
+1
-1
@@ -16,4 +16,4 @@ class Outer {
|
|||||||
// 1 final synthetic LOuter\$Inner; this\$0
|
// 1 final synthetic LOuter\$Inner; this\$0
|
||||||
|
|
||||||
// JVM_IR_TEMPLATES
|
// JVM_IR_TEMPLATES
|
||||||
// 1 private final synthetic LOuter; this\$0
|
// 2 final synthetic LOuter; this\$0
|
||||||
|
|||||||
Vendored
+1
-1
@@ -16,4 +16,4 @@ class Outer {
|
|||||||
// 1 final synthetic LOuter\$Inner; this\$0
|
// 1 final synthetic LOuter\$Inner; this\$0
|
||||||
|
|
||||||
// JVM_IR_TEMPLATES
|
// JVM_IR_TEMPLATES
|
||||||
// 1 private final synthetic LOuter; this\$0
|
// 2 final synthetic LOuter; this\$0
|
||||||
Vendored
+1
-1
@@ -16,4 +16,4 @@ class Outer {
|
|||||||
// 1 final synthetic LOuter\$Inner; this\$0
|
// 1 final synthetic LOuter\$Inner; this\$0
|
||||||
|
|
||||||
// JVM_IR_TEMPLATES
|
// JVM_IR_TEMPLATES
|
||||||
// 1 private final synthetic LOuter; this\$0
|
// 2 final synthetic LOuter; this\$0
|
||||||
|
|||||||
@@ -10,8 +10,4 @@ class Host {
|
|||||||
fun foo() {}
|
fun foo() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// JVM_TEMPLATES
|
|
||||||
// 1 final synthetic LHost; this\$0
|
// 1 final synthetic LHost; this\$0
|
||||||
|
|
||||||
// JVM_IR_TEMPLATES
|
|
||||||
// 1 private final synthetic LHost; this\$0
|
|
||||||
Reference in New Issue
Block a user