@Test public void testReturnsRemovedVoid() throws Exception { final String program = "void foo() {" + " int x = 2;" + " int y = 3;" + " x = y;" + " if (x == y) {" + " return;" + " } else {" + " for (int i = 0; i < 100; i++) {" + " if (i > x) {" + " return;" + " }" + " y += i;" + " }" + " }" + " x++;" + "}"; final String expected = "void foo() {" + " bool foo_has_returned = false;" + " int x = 2;" + " int y = 3;" + " x = y;" + " if (x == y) {" + " foo_has_returned = true;" + " } else {" + " for (int i = 0; (!foo_has_returned) && i < 100; i++) {" + " if (i > x) {" + " foo_has_returned = true;" + " }" + " if (!foo_has_returned) {" + " y += i;" + " }" + " }" + " }" + " if(!foo_has_returned) {" + " x++;" + " }" + "}"; 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);  }