return coerceToType(context, elseValue, resultType);
}
// evaluate the value and store it in a variable
LabelNode nullValue = new LabelNode("nullCondition");
Variable tempVariable = context.createTempVariable(valueType);
Block block = new Block(context)
.append(coerceToType(context, value, valueType).getNode())
.append(ifWasNullClearPopAndGoto(context, nullValue, void.class, valueType))
.putVariable(tempVariable.getLocalVariableDefinition());
// build the statements
elseValue = typedByteCodeNode(new Block(context).visitLabel(nullValue).append(coerceToType(context, elseValue, resultType).getNode()), resultType);
// reverse list because current if statement builder doesn't support if/else so we need to build the if statements bottom up
for (TypedWhenClause whenClause : Lists.reverse(new ArrayList<>(whenClauses))) {
LabelNode nullCondition = new LabelNode("nullCondition");
Block condition = new Block(context)
.append(coerceToType(context, whenClause.condition, valueType).getNode())
.append(ifWasNullPopAndGoto(context, nullCondition, boolean.class, valueType))
.getVariable(tempVariable.getLocalVariableDefinition())
.invokeStatic(Operations.class, "equal", boolean.class, valueType, valueType)
.visitLabel(nullCondition)
.putVariable("wasNull", false);
elseValue = typedByteCodeNode(new IfStatement(context,