boolean isBracketAssign = binaryNode != null && binaryNode.getOperator() == OperatorType.ASSIGNMENT
&& binaryNode.getLeftOperandNode() instanceof DynamicAccessNode;
ITypeDefinition destinationType = null;
if (isBracketAssign)
destinationType = binaryNode.getLeftOperandNode().resolveType(currentScope.getProject());
TernaryOperatorNode ternaryNode = (TernaryOperatorNode)iNode;
IExpressionNode valueNode;
IDefinition type_def; //= valueNode.resolveType(currentScope.getProject()); //SemanticUtils.getDefinitionOfUnderlyingType(,
// true, currentScope.getProject());
boolean need_coerce = false;
InstructionList result = createInstructionList(iNode, test.size() + when_true.size() + when_false.size() + 2);
Label tail = new Label();
result.addAll(test);
result.addInstruction(OP_iffalse, when_false.getLabel());
result.addAll(when_true);
valueNode = ternaryNode.getLeftOperandNode();
type_def = valueNode.resolveType(currentScope.getProject());
need_coerce = type_def != null && !type_def.equals(destinationType);
if (need_coerce && isBracketAssign)
coerce(result, destinationType);
result.addInstruction(OP_jump, tail);
result.addAll(when_false);
valueNode = ternaryNode.getRightOperandNode();
type_def = valueNode.resolveType(currentScope.getProject());
need_coerce = type_def != null && !type_def.equals(destinationType);
if (need_coerce && isBracketAssign)
coerce(result, destinationType);
result.labelNext(tail);