translator: fix square brackets operator for binary expressions

This commit is contained in:
Alexey Stepanov
2016-08-11 10:10:57 +03:00
parent 0f86f30623
commit 7c7f0e4484
@@ -535,14 +535,18 @@ abstract class BlockCodegen(val state: TranslationState, val variableManager: Va
return evaluateElvisOperator(expr, scopeDepth) return evaluateElvisOperator(expr, scopeDepth)
} }
val left = evaluateExpression(expr.firstChild, scopeDepth) val left = evaluateExpression(expr.left, scopeDepth)
if (expr.firstChild is KtArrayAccessExpression) { if (expr.left is KtArrayAccessExpression) {
return null val callMaker = state.bindingContext.get(BindingContext.CALL, expr.left)
} else { if (callMaker!!.callType == Call.CallType.ARRAY_SET_METHOD) {
left ?: throw UnsupportedOperationException("Wrong binary exception: ${expr.text}") return left as LLVMVariable?
}
} }
val right = evaluateExpression(expr.lastChild, scopeDepth) ?: throw UnsupportedOperationException("Wrong binary exception: ${expr.text}") left ?: throw UnsupportedOperationException("Wrong binary exception: ${expr.text}")
val right = evaluateExpression(expr.right, scopeDepth) ?: throw UnsupportedOperationException("Wrong binary exception: ${expr.text}")
return executeBinaryExpression(operator, expr.operationReference, left, right) return executeBinaryExpression(operator, expr.operationReference, left, right)
} }