]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/reflect.h
Make function dependency collection its own visitor class
[libs/gl.git] / source / glsl / reflect.h
index a48ad53f8cfa9b960665af6a61cd66e2a475d686..72a50c3eb6368b303ba5bd6e2fad8f7095e0189b 100644 (file)
@@ -25,6 +25,24 @@ private:
        virtual void visit(VariableDeclaration &);
 };
 
+/** Collects dependencies of a function.  This includes global variables,
+interface blocks, other functions and types. */
+class DependencyCollector: private TraversingVisitor
+{
+private:
+       std::set<Node *> dependencies;
+       std::set<Node *> locals;
+
+public:
+       std::set<Node *> apply(FunctionDeclaration &);
+
+private:
+       virtual void visit(VariableReference &);
+       virtual void visit(InterfaceBlockReference &);
+       virtual void visit(FunctionCall &);
+       virtual void visit(VariableDeclaration &);
+};
+
 } // namespace SL
 } // namespace GL
 } // namespace Msp