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);   }
@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()); }
@Test public void testSwitch() throws Exception { final String program = "#version 310 es\n" + "void main() {\n" + " switch(0) {\n" + " case - 1:\n" + " 1;\n" + " }\n" + "}\n"; final TranslationUnit tu = ParseHelper.parse(program); final List<SimplifyExprReductionOpportunity> ops = CompoundExprToSubExprReductionOpportunities .findOpportunities(MakeShaderJobFromFragmentShader.make(tu), new ReducerContext(true, ShadingLanguageVersion.ESSL_310, new RandomWrapper(0), new IdGenerator())); assertEquals(0, ops.size()); }