Re: Groovy truth and casting to boolean
"Milles, Eric (TR Technology) via dev" <dev-GSC0n/0aZo1d/SJB6HiN2Ni2O/[email protected]>
| Newsgroups | gmane.comp.lang.groovy.devel |
|---|---|
| Message-ID | <PH7PR03MB7224A6F59FA4D554EBD9C4F48A89A@PH7PR03MB7224.namprd03.prod.outlook.com> |
Is this discussion in reference to this part of InvokeDynamicWriter?
public void castNonPrimitiveToBool(final ClassNode sourceType) {
writeIndyCast(sourceType, boolean_TYPE);
}
private void writeIndyCast(final ClassNode sourceType, final ClassNode targetType) {
String descriptor = "(" + getTypeDescription(sourceType) + ')' + getTypeDescription(targetType);
controller.getMethodVisitor().visitInvokeDynamicInsn(CAST.getCallSiteName(), descriptor, BSM, CAST_ARGS);
controller.getOperandStack().replace(targetType); // cast converts top operand from source to target type
}