@Test public void testDoNotRemoveParamIfOverloaded() throws Exception { final String shader = "float foo(int a, float b) {" + " return float(a);" + "}" + "void foo(int a) {" + "}" + "void main() {" + " foo(2, 3.0);" + " foo(2);" + "}"; final TranslationUnit tu = ParseHelper.parse(shader); List<RemoveUnusedParameterReductionOpportunity> opportunities = findOpportunities(tu, true); assertEquals(0, opportunities.size()); }
static List<RemoveUnusedParameterReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); }
RemoveUnusedParameterReductionOpportunities extends ReductionOpportunitiesBase<RemoveUnusedParameterReductionOpportunity> { static List<RemoveUnusedParameterReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } }
RemoveUnusedParameterReductionOpportunities extends ReductionOpportunitiesBase<RemoveUnusedParameterReductionOpportunity> { static List<RemoveUnusedParameterReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  RemoveUnusedParameterReductionOpportunities(TranslationUnit tu,
                                                      ReducerContext context); }
RemoveUnusedParameterReductionOpportunities extends ReductionOpportunitiesBase<RemoveUnusedParameterReductionOpportunity> { static List<RemoveUnusedParameterReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  RemoveUnusedParameterReductionOpportunities(TranslationUnit tu,
                                                      ReducerContext context); @Override void visitTranslationUnit(TranslationUnit translationUnit); @Override void visitFunctionDefinition(FunctionDefinition functionDefinition); @Override void visitVariableIdentifierExpr(VariableIdentifierExpr variableIdentifierExpr); @Override void visitFunctionPrototype(FunctionPrototype functionPrototype); }
RemoveUnusedParameterReductionOpportunities extends ReductionOpportunitiesBase<RemoveUnusedParameterReductionOpportunity> { static List<RemoveUnusedParameterReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  RemoveUnusedParameterReductionOpportunities(TranslationUnit tu,
                                                      ReducerContext context); @Override void visitTranslationUnit(TranslationUnit translationUnit); @Override void visitFunctionDefinition(FunctionDefinition functionDefinition); @Override void visitVariableIdentifierExpr(VariableIdentifierExpr variableIdentifierExpr); @Override void visitFunctionPrototype(FunctionPrototype functionPrototype);  }