FunctionReductionOpportunities extends StandardVisitor { static List<FunctionReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  FunctionReductionOpportunities(TranslationUnit tu, ReducerContext context); @Override void visitFunctionCallExpr(FunctionCallExpr functionCallExpr);  }
@Test public void testRemovable() throws Exception { String program = "void notCalled() { }" + "void main() { }"; TranslationUnit tu = ParseHelper.parse(program); assertEquals(1, FunctionReductionOpportunities.findOpportunities( MakeShaderJobFromFragmentShader.make(tu), new ReducerContext(false, ShadingLanguageVersion.ESSL_100, new RandomWrapper(0), new IdGenerator())).size()); }