SPeCS Packages Documentation
    Preparing search index...

    Transforms a switch statement into an if statement.

    This means that code like this:

    	int num = 1, a;
    
    	switch (num) {
    	    case 1:
             a = 10;
    	   default:
    	   	    a = 30;
    	        break;
    	   case 2:
    	       a = 20;
    	       break;
        case 3 ... 7:
            a = 30;
    	}
    

    Will be transformed into:

     int num = 1, a;
    
     if (num == 1)
         goto case_1;
     else if (num == 2)
         goto case_2;
     else if (num >= 3 && num <= 7)
          goto case_3_7;
     else
          goto case_default;
    
     case_1:
         a = 10;
     case_default:
         a = 80;
         goto switch_exit;
     case_2:
         a = 20;
         goto switch_exit;
     case_3_7:
         a = 30;
    
     switch_exit:
     ;
    

    Hierarchy (View Summary)

    Index
    _name: string = "TransformSwitchToIf"

    Name of the pass

    _traversalType: TraversalType
    • get name(): string

      Returns string

      Name of the pass

    • get traversalType(): TraversalType

      Order in which the join point's descendants should be visited

      Returns TraversalType

    • Applies this pass starting at the given join point. If no join point is given, uses the root join point

      Parameters

      • $jp: LaraJoinPoint

        Joint point on which the pass will be applied

      Returns PassResult

      Results of applying this pass to the given joint point