@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()); }
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);   }