Class StaticTypesIsCaseWriter

java.lang.Object
org.codehaus.groovy.classgen.asm.sc.StaticTypesIsCaseWriter

public class StaticTypesIsCaseWriter extends Object
Emits the isCase call the type checker selected for a case label, shared by the statically compiled switch expression and switch statement writers so that a label resolves the same way in either position (GROOVY-12407).
Since:
7.0.0
  • Method Details

    • writeDirectIsCase

      public static boolean writeDirectIsCase(WriterController controller, CaseStatement caseStatement, int selectorIndex, ClassNode selectorType)
      Emits the selected isCase as a direct method call via StaticInvocationWriter.writeDirectMethodCall, leaving a boolean on the operand stack for the following IFEQ.
      Parameters:
      controller - the writer controller
      caseStatement - the arm whose label is being tested
      selectorIndex - local variable slot holding the switch selector
      selectorType - type of that slot
      Returns:
      false when the type checker selected no target, in which case the caller emits its own comparison; true when the call was written