@Test public void noEffectInRegularCode() throws Exception { final String original = "void main() { int a = 2; int b = 3; a + b + b; }"; final TranslationUnit tu = ParseHelper.parse(original); final List<SimplifyExprReductionOpportunity> ops = CompoundExprToSubExprReductionOpportunities .findOpportunities(MakeShaderJobFromFragmentShader.make(tu), new ReducerContext(false, ShadingLanguageVersion.GLSL_440, new RandomWrapper(0), new IdGenerator())); assertTrue(ops.isEmpty()); }
static List<SimplifyExprReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); }
CompoundExprToSubExprReductionOpportunities extends SimplifyExprReductionOpportunities { static List<SimplifyExprReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } }
CompoundExprToSubExprReductionOpportunities extends SimplifyExprReductionOpportunities { static List<SimplifyExprReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  CompoundExprToSubExprReductionOpportunities(
        TranslationUnit tu,
        ReducerContext context); }
CompoundExprToSubExprReductionOpportunities extends SimplifyExprReductionOpportunities { static List<SimplifyExprReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  CompoundExprToSubExprReductionOpportunities(
        TranslationUnit tu,
        ReducerContext context);  }
CompoundExprToSubExprReductionOpportunities extends SimplifyExprReductionOpportunities { static List<SimplifyExprReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  CompoundExprToSubExprReductionOpportunities(
        TranslationUnit tu,
        ReducerContext context);   }