Re: Groovy truth and casting to boolean
Jochen Theodorou <[email protected]>
| Newsgroups | gmane.comp.lang.groovy.devel |
|---|---|
| Message-ID | <[email protected]> |
not only, but related
On 20.01.26 19:46, Milles, Eric (TR Technology) via dev wrote:
> 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
> }
>