JS backend: made JsInvocation arguments modifieable

This commit is contained in:
Alexey Tsvetkov
2014-07-21 17:31:46 +04:00
committed by Zalim Bashorov
parent 96e5985ca9
commit 53fe237499
2 changed files with 3 additions and 2 deletions
@@ -23,7 +23,7 @@ public final class JsInvocation extends JsExpressionImpl.JsExpressionHasArgument
}
public JsInvocation(JsExpression qualifier, JsExpression arg) {
this(qualifier, Collections.singletonList(arg));
this(qualifier, new SmartList<JsExpression>(arg));
}
public JsInvocation(JsExpression qualifier, JsExpression... arguments) {
@@ -34,12 +34,13 @@ import org.jetbrains.k2js.translate.reference.CallArgumentTranslator
import org.jetbrains.jet.lang.descriptors.CallableMemberDescriptor
import org.jetbrains.jet.lang.descriptors.Visibilities
import org.jetbrains.jet.lang.psi.Call.CallType
import com.intellij.util.SmartList
import org.jetbrains.k2js.translate.utils.JsDescriptorUtils
import org.jetbrains.jet.lang.resolve.DescriptorUtils
public fun addReceiverToArgs(receiver: JsExpression, arguments: List<JsExpression>): List<JsExpression> {
if (arguments.isEmpty())
return Collections.singletonList(receiver)
return SmartList(receiver)
val argumentList = ArrayList<JsExpression>(1 + arguments.size())
argumentList.add(receiver)