@Test public void testNothingToRemove() throws Exception { final String program = "void main() {\n" + " float k = 1.0;\n" + " gl_FragColor = vec4(k, 0.0, 0.0, 0.0);\n" + "}\n"; final TranslationUnit tu = ParseHelper.parse(program); List<VariableDeclReductionOpportunity> ops = VariableDeclReductionOpportunities .findOpportunities( MakeShaderJobFromFragmentShader.make(tu), new ReducerContext( false, ShadingLanguageVersion.ESSL_100, new RandomWrapper(0), new IdGenerator()) ); assertEquals(0, ops.size()); }
static List<VariableDeclReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); }
VariableDeclReductionOpportunities extends ReductionOpportunitiesBase<VariableDeclReductionOpportunity> { static List<VariableDeclReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } }
VariableDeclReductionOpportunities extends ReductionOpportunitiesBase<VariableDeclReductionOpportunity> { static List<VariableDeclReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  VariableDeclReductionOpportunities(TranslationUnit tu,
                                             ReducerContext context); }
VariableDeclReductionOpportunities extends ReductionOpportunitiesBase<VariableDeclReductionOpportunity> { static List<VariableDeclReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  VariableDeclReductionOpportunities(TranslationUnit tu,
                                             ReducerContext context); @Override void visitVariableIdentifierExpr(VariableIdentifierExpr variableIdentifierExpr); }
VariableDeclReductionOpportunities extends ReductionOpportunitiesBase<VariableDeclReductionOpportunity> { static List<VariableDeclReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  VariableDeclReductionOpportunities(TranslationUnit tu,
                                             ReducerContext context); @Override void visitVariableIdentifierExpr(VariableIdentifierExpr variableIdentifierExpr);  }