@Test public void testReturnsRemovedDoWhile() throws Exception { final String program = "int foo() {" + " int x = 2;" + " do {" + " x++;" + " if (x > 10) {" + " return x;" + " }" + " } while (x < 100);" + " return 10;" + "}"; final String expected = "int foo() {" + " bool foo_has_returned = false;" + " int foo_return_value;" + " int x = 2;" + " do {" + " x++;" + " if (x > 10) {" + " {" + " foo_return_value = x;" + " foo_has_returned = true;" + " }" + " }" + " } while ((!foo_has_returned) && x < 100);" + " if(!foo_has_returned) {" + " {" + " foo_return_value = 10;" + " foo_has_returned = true;" + " }" + " }" + " return foo_return_value;" + "}"; final TranslationUnit tu = ParseHelper.parse(program); final FunctionDefinition fd = findFunctionDefinition(tu, "foo"); ReturnRemover.removeReturns(fd, ShadingLanguageVersion.ESSL_300); CompareAstsDuplicate.assertEqualAsts(expected, tu); }
public static void removeReturns(FunctionDefinition fd, ShadingLanguageVersion shadingLanguageVersion) throws CannotRemoveReturnsException { new ReturnRemover(fd, shadingLanguageVersion).doRemoveReturns(); }
ReturnRemover { public static void removeReturns(FunctionDefinition fd, ShadingLanguageVersion shadingLanguageVersion) throws CannotRemoveReturnsException { new ReturnRemover(fd, shadingLanguageVersion).doRemoveReturns(); } }
ReturnRemover { public static void removeReturns(FunctionDefinition fd, ShadingLanguageVersion shadingLanguageVersion) throws CannotRemoveReturnsException { new ReturnRemover(fd, shadingLanguageVersion).doRemoveReturns(); } private  ReturnRemover(FunctionDefinition fd, ShadingLanguageVersion shadingLanguageVersion); }
ReturnRemover { public static void removeReturns(FunctionDefinition fd, ShadingLanguageVersion shadingLanguageVersion) throws CannotRemoveReturnsException { new ReturnRemover(fd, shadingLanguageVersion).doRemoveReturns(); } private  ReturnRemover(FunctionDefinition fd, ShadingLanguageVersion shadingLanguageVersion); static void removeReturns(FunctionDefinition fd, ShadingLanguageVersion
      shadingLanguageVersion); }
ReturnRemover { public static void removeReturns(FunctionDefinition fd, ShadingLanguageVersion shadingLanguageVersion) throws CannotRemoveReturnsException { new ReturnRemover(fd, shadingLanguageVersion).doRemoveReturns(); } private  ReturnRemover(FunctionDefinition fd, ShadingLanguageVersion shadingLanguageVersion); static void removeReturns(FunctionDefinition fd, ShadingLanguageVersion
      shadingLanguageVersion);  }