aboutsummaryrefslogtreecommitdiffstats
path: root/libjulia/optimiser/NameCollector.h
diff options
context:
space:
mode:
Diffstat (limited to 'libjulia/optimiser/NameCollector.h')
-rw-r--r--libjulia/optimiser/NameCollector.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/libjulia/optimiser/NameCollector.h b/libjulia/optimiser/NameCollector.h
index 7fe386f7..2d4a1d4b 100644
--- a/libjulia/optimiser/NameCollector.h
+++ b/libjulia/optimiser/NameCollector.h
@@ -66,5 +66,19 @@ private:
std::map<std::string, size_t> m_references;
};
+/**
+ * Specific AST walker that finds all variables that are assigned to.
+ */
+class Assignments: public ASTWalker
+{
+public:
+ using ASTWalker::operator ();
+ virtual void operator()(Assignment const& _assignment) override;
+
+ std::set<std::string> const& names() const { return m_names; }
+private:
+ std::set<std::string> m_names;
+};
+
}
}