JS: decomposition of array literal
This commit is contained in:
@@ -74,6 +74,13 @@ class ExpressionDecomposer private (
|
||||
return decomposer.additionalStatements
|
||||
}
|
||||
}
|
||||
|
||||
override fun visit(x: JsArrayLiteral, ctx: JsContext<*>): Boolean {
|
||||
val elements = x.getExpressions()
|
||||
processByIndices(elements, elements.indicesOfExtractable)
|
||||
return false
|
||||
}
|
||||
|
||||
override fun visit(x: JsInvocation, ctx: JsContext<*>): Boolean {
|
||||
CallableInvocationAdapter(x).process()
|
||||
return false
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(array(1, 2), array(fizz(1), buzz(2)))
|
||||
assertEquals("fizz(1);buzz(2);", pullLog())
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(array(1, 2, 3, 4), array(fizz(1), buzz(2), fizz(3), buzz(4)))
|
||||
assertEquals("fizz(1);buzz(2);fizz(3);buzz(4);", pullLog())
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(array(array(1, 2), array(3, 4)), array(array(fizz(1), buzz(2)), array(fizz(3), buzz(4))))
|
||||
assertEquals("fizz(1);buzz(2);fizz(3);buzz(4);", pullLog())
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user