Supported inlining functions which access properties via field.
This commit is contained in:
@@ -102,8 +102,7 @@ public class InlineCodegen implements CallGenerator {
|
|||||||
codegen.getContext().isInlineFunction() ? InlineStrategy.IN_PLACE : functionDescriptor.getInlineStrategy();
|
codegen.getContext().isInlineFunction() ? InlineStrategy.IN_PLACE : functionDescriptor.getInlineStrategy();
|
||||||
this.asFunctionInline = false;
|
this.asFunctionInline = false;
|
||||||
|
|
||||||
isSameModule = !(functionDescriptor instanceof DeserializedSimpleFunctionDescriptor) /*not compiled library*/ &&
|
isSameModule = JvmCodegenUtil.isCallInsideSameModuleAsDeclared(functionDescriptor, codegen.getContext());
|
||||||
JvmCodegenUtil.isCallInsideSameModuleAsDeclared(functionDescriptor, codegen.getContext());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -141,6 +141,11 @@ public class IncrementalJpsTestGenerated extends AbstractIncrementalJpsTest {
|
|||||||
doTest("jps-plugin/testData/incremental/packageFilesChangedInTurn/");
|
doTest("jps-plugin/testData/incremental/packageFilesChangedInTurn/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("packageInlineFunctionAccessingField")
|
||||||
|
public void testPackageInlineFunctionAccessingField() throws Exception {
|
||||||
|
doTest("jps-plugin/testData/incremental/packageInlineFunctionAccessingField/");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("packageInlineFunctionChanged")
|
@TestMetadata("packageInlineFunctionChanged")
|
||||||
public void testPackageInlineFunctionChanged() throws Exception {
|
public void testPackageInlineFunctionChanged() throws Exception {
|
||||||
doTest("jps-plugin/testData/incremental/packageInlineFunctionChanged/");
|
doTest("jps-plugin/testData/incremental/packageInlineFunctionChanged/");
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
Cleaning output files:
|
||||||
|
out/production/module/test/TestPackage-usage-*.class
|
||||||
|
out/production/module/test/TestPackage.class
|
||||||
|
End of files
|
||||||
|
Compiling files:
|
||||||
|
src/usage.kt
|
||||||
|
End of files
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
val property = ":)"
|
||||||
|
|
||||||
|
inline fun f(body: () -> Unit) {
|
||||||
|
println("i'm inline function" + property)
|
||||||
|
body()
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package other
|
||||||
|
|
||||||
|
val property = ":)"
|
||||||
|
|
||||||
|
inline fun f(body: () -> Unit) {
|
||||||
|
println("i'm inline function" + property)
|
||||||
|
body()
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
f { println("to be inlined") }
|
||||||
|
other.f { println("to be inlined") }
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
f { println("to be inlined") }
|
||||||
|
other.f { println("to be inlined") }
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user