@Test public void testSingleLiveVariable() throws Exception { final String program = "void main() { int GLF_live3_a; GLF_live3_a; }"; final TranslationUnit tu = ParseHelper.parse(program); final List<SimplifyExprReductionOpportunity> ops = ExprToConstantReductionOpportunities .findOpportunities(MakeShaderJobFromFragmentShader.make(tu), new ReducerContext(false, ShadingLanguageVersion.ESSL_100, new RandomWrapper(0), new IdGenerator())); assertEquals(1, ops.size()); ops.get(0).applyReduction(); CompareAsts.assertEqualAsts("void main() { int GLF_live3_a; 1; }", tu); }
static List<SimplifyExprReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); }
ExprToConstantReductionOpportunities extends SimplifyExprReductionOpportunities { static List<SimplifyExprReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } }
ExprToConstantReductionOpportunities 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  ExprToConstantReductionOpportunities(
        TranslationUnit tu,
        ReducerContext context); }
ExprToConstantReductionOpportunities 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  ExprToConstantReductionOpportunities(
        TranslationUnit tu,
        ReducerContext context);  }
ExprToConstantReductionOpportunities 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  ExprToConstantReductionOpportunities(
        TranslationUnit tu,
        ReducerContext context);   }