KT-12928: decompose invocation like "a.foo(b)" to "$t = a; $s = $t.foo.bind($t); $s(b)" instead of "$t = a.foo; $t(b)", since in the latter case foo won't receive proper this. Add optimization that replaces "foo.bar.bind(baz)(args)" with "baz.bar(args)"

This commit is contained in:
Alexey Andreev
2016-07-01 12:14:05 +03:00
parent 07cb3e09b9
commit 88eef7337e
11 changed files with 157 additions and 3 deletions
@@ -221,6 +221,12 @@ public class InlineEvaluationOrderTestGenerated extends AbstractInlineEvaluation
doTest(fileName);
}
@TestMetadata("methodDecomposedWithBind.kt")
public void testMethodDecomposedWithBind() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/inlineEvaluationOrder/cases/methodDecomposedWithBind.kt");
doTest(fileName);
}
@TestMetadata("methodInlineCallQualifierWithSideEffect.kt")
public void testMethodInlineCallQualifierWithSideEffect() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/inlineEvaluationOrder/cases/methodInlineCallQualifierWithSideEffect.kt");
@@ -59,6 +59,18 @@ public class InlineMultiModuleTestGenerated extends AbstractInlineMultiModuleTes
doTest(fileName);
}
@TestMetadata("externalInlineCallDecomposed")
public void testExternalInlineCallDecomposed() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/inlineMultiModule/cases/externalInlineCallDecomposed/");
doTest(fileName);
}
@TestMetadata("externalInlineNewDecomposed")
public void testExternalInlineNewDecomposed() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/inlineMultiModule/cases/externalInlineNewDecomposed/");
doTest(fileName);
}
@TestMetadata("lambda")
public void testLambda() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/inlineMultiModule/cases/lambda/");