Package org.apache.flink.table.codesplit
Class AddBoolBeforeReturnRewriter
- java.lang.Object
-
- org.apache.flink.table.codesplit.AddBoolBeforeReturnRewriter
-
- All Implemented Interfaces:
CodeRewriter
@Internal public class AddBoolBeforeReturnRewriter extends Object implements CodeRewriter
A helper class ofFunctionSplitter.Add a boolean variable before each return statement so that when the function is split, the outer function can determine whether to return early with this boolean variable.
The name of the variable is stored in a list of map. Index of list is the index of class (outer class is 0, 1st inner class is 1, 2nd inner class is 2, etc.), key of map is function name and its parameters.
Before
public class Example { public void myFun(int[] a) { if (a[0] > 0) { a[0] += 5; return; } a[0] -= 5; return; } }After
public class Example { boolean myFunHasReturned$0; public void myFun(int[] a) { if (a[0] > 0) { a[0] += 5; { myFunHasReturned$0 = true; return; } } a[0] -= 5; { myFunHasReturned$0 = true; return; } } }
-
-
Constructor Summary
Constructors Constructor Description AddBoolBeforeReturnRewriter(String code, int maxMethodLength)
-