@Test public void testDoNotReplace() throws Exception { final String original = "void main() { int a = 1, b = 2; int c = 3; }"; final TranslationUnit tu = ParseHelper.parse(original); final List<VariableDeclToExprReductionOpportunity> ops = VariableDeclToExprReductionOpportunities .findOpportunities(MakeShaderJobFromFragmentShader.make(tu), new ReducerContext(false, ShadingLanguageVersion.ESSL_100, new RandomWrapper(0), new IdGenerator())); assertTrue(ops.isEmpty()); }
static List<VariableDeclToExprReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); }
VariableDeclToExprReductionOpportunities extends ReductionOpportunitiesBase<VariableDeclToExprReductionOpportunity> { static List<VariableDeclToExprReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } }
VariableDeclToExprReductionOpportunities extends ReductionOpportunitiesBase<VariableDeclToExprReductionOpportunity> { static List<VariableDeclToExprReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  VariableDeclToExprReductionOpportunities(TranslationUnit tu, ReducerContext context); }
VariableDeclToExprReductionOpportunities extends ReductionOpportunitiesBase<VariableDeclToExprReductionOpportunity> { static List<VariableDeclToExprReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  VariableDeclToExprReductionOpportunities(TranslationUnit tu, ReducerContext context); @Override void visitDeclarationStmt(DeclarationStmt declarationStmt); }
VariableDeclToExprReductionOpportunities extends ReductionOpportunitiesBase<VariableDeclToExprReductionOpportunity> { static List<VariableDeclToExprReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  VariableDeclToExprReductionOpportunities(TranslationUnit tu, ReducerContext context); @Override void visitDeclarationStmt(DeclarationStmt declarationStmt);  }