Class TypeSwitch

  • All Implemented Interfaces:
    Inlineable, Named

    public class TypeSwitch
    extends MethodProc
    implements Inlineable
    Implement 'typeswitch' (as in XQuery) or 'typecase'. Usage: (typeswitch SELECTOR CASE-LAMBDA ... DEFAULT-LAMBDA) Each CASE-LAMBDA is a 1-argument MethodProc, while DEFAULT-LAMBDA is a 1-argument Procedure. Calls the first CASE-LAMBDA such that SELECTOR is a valid argument; if there is none, calls DEFAULT-LAMBDA. In the current implementation, all of CASE-LAMBDA and DEFAULT-LAMBDA must be LambdaExps, and the call must be inlined.
    • Field Detail

      • typeSwitch

        public static final TypeSwitch typeSwitch
    • Constructor Detail

      • TypeSwitch

        public TypeSwitch​(String name)
    • Method Detail

      • numArgs

        public int numArgs()
        Description copied from class: Procedure
        Return minArgs()|(maxArgs<<12). We use a single virtual function to reduce the number of methods in the system, as well as the number of virtual method table entries. We shift by 12 so the number can normally be represented using a sipush instruction, without requiring a constant pool entry.
        Overrides:
        numArgs in class Procedure