KT-8386: pass mutable list to JsInvocation from intrinsic generator, so that inliner had a chance to replace arguments
This commit is contained in:
@@ -215,6 +215,12 @@ public class InlineJsTestGenerated extends AbstractInlineJsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("iteratorOnInlineFunctionResult.kt")
|
||||||
|
public void testIteratorOnInlineFunctionResult() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/inline/cases/iteratorOnInlineFunctionResult.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("jsCode.kt")
|
@TestMetadata("jsCode.kt")
|
||||||
public void testJsCode() throws Exception {
|
public void testJsCode() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/inline/cases/jsCode.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/inline/cases/jsCode.kt");
|
||||||
|
|||||||
@@ -239,10 +239,6 @@ public final class TranslationUtils {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static List<JsExpression> generateInvocationArguments(@NotNull JsExpression receiver, @NotNull List<JsExpression> arguments) {
|
public static List<JsExpression> generateInvocationArguments(@NotNull JsExpression receiver, @NotNull List<JsExpression> arguments) {
|
||||||
if (arguments.isEmpty()) {
|
|
||||||
return Collections.singletonList(receiver);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<JsExpression> argumentList = new ArrayList<JsExpression>(1 + arguments.size());
|
List<JsExpression> argumentList = new ArrayList<JsExpression>(1 + arguments.size());
|
||||||
argumentList.add(receiver);
|
argumentList.add(receiver);
|
||||||
argumentList.addAll(arguments);
|
argumentList.addAll(arguments);
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
inline fun bar(f: () -> Int): Array<Int> = arrayOf(f())
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val iterator = bar { 23 }.iterator()
|
||||||
|
assertEquals(true, iterator.hasNext())
|
||||||
|
assertEquals(23, iterator.next())
|
||||||
|
assertEquals(false, iterator.hasNext())
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user