@Test public void testInOut() throws Exception { final String prog = "void f(inout int x) { } void main() { int a; f(a); }"; TranslationUnit tu = ParseHelper.parse(prog); List<SimplifyExprReductionOpportunity> ops = ExprToConstantReductionOpportunities .findOpportunities(MakeShaderJobFromFragmentShader.make(tu), new ReducerContext(true, ShadingLanguageVersion.ESSL_100, new RandomWrapper(0), new IdGenerator())); for (SimplifyExprReductionOpportunity op : ops) { op.applyReduction(); } assertEquals(PrettyPrinterVisitor.prettyPrintAsString(ParseHelper.parse(prog)), PrettyPrinterVisitor.prettyPrintAsString(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);   }