use of org.jetbrains.kotlin.js.backend.ast.JsBlock in project kotlin by JetBrains.
the class OverloadedAssignmentTranslator method overloadedMethodInvocation.
@NotNull
private JsExpression overloadedMethodInvocation(AccessTranslator accessTranslator) {
JsBlock innerBlock = new JsBlock();
TranslationContext innerContext = context().innerBlock(innerBlock);
JsExpression oldValue = accessTranslator.translateAsGet();
JsBlock argumentBlock = new JsBlock();
TranslationContext argumentContext = innerContext.innerBlock(argumentBlock);
KtExpression argumentPsi = expression.getRight();
assert argumentPsi != null;
JsExpression argument = Translation.translateAsExpression(argumentPsi, argumentContext);
if (!argumentBlock.isEmpty()) {
oldValue = innerContext.defineTemporary(oldValue);
innerContext.addStatementsToCurrentBlockFrom(argumentBlock);
}
Map<KtExpression, JsExpression> aliases = new HashMap<KtExpression, JsExpression>();
aliases.put(argumentPsi, argument);
innerContext = innerContext.innerContextWithAliasesForExpressions(aliases);
JsExpression result = CallTranslator.translate(innerContext, resolvedCall, oldValue);
context().addStatementsToCurrentBlockFrom(innerBlock);
return result;
}
Aggregations