AstUtil { public static List<FunctionPrototype> getFunctionPrototypesFromShader(TranslationUnit shader) { return getPrototypesForAllFunctions(shader.getTopLevelDeclarations()); } private  AstUtil(); static List<FunctionPrototype> getFunctionPrototypesFromShader(TranslationUnit shader); static List<FunctionPrototype> getPrototypesForAllFunctions(List<Declaration> decls);  }
@Test public void getFunctionPrototypesFromShader() throws Exception { String program = "int bar(int x) { return 2; }\n" + "void foo();\n" + "void foo() { }\n" + "int foo(int x) { return 3; }\n" + "void main() { }\n"; TranslationUnit tu = ParseHelper.parse(program); List<FunctionPrototype> prototypes = AstUtil.getFunctionPrototypesFromShader(tu); assertEquals(4, prototypes.size()); }