diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-05-11 12:07:56 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-05-11 12:07:56 +0200 |
commit | 5a2e172ce1f2d823bf0957602662bbab0c0dcd0b (patch) | |
tree | f3645c87168542ec8c5f753e944e9382091ac22e /cli/semantics/unit.hxx | |
parent | d4274a0d8bd3bb210b8085332f4c827486ede2f3 (diff) |
Move lookup to semantic graph from parser
Diffstat (limited to 'cli/semantics/unit.hxx')
-rw-r--r-- | cli/semantics/unit.hxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cli/semantics/unit.hxx b/cli/semantics/unit.hxx index f20ba82..cd4198b 100644 --- a/cli/semantics/unit.hxx +++ b/cli/semantics/unit.hxx @@ -8,6 +8,7 @@ #include <map> #include <vector> +#include <string> #include <semantics/elements.hxx> #include <semantics/namespace.hxx> @@ -139,6 +140,24 @@ namespace semantics typedef std::vector<includes*> includes_list; public: + // Lookup a name in the specified starting scope. Empty scope denotes + // the global namespace. Starting scope should be a fully-qualified + // name while name can be qualified but should not be fully-qualified + // (to lookup a fully-qualified name use the global namespace as the + // starting scope). + // + // The lookup starts in this unit and continues in all the units that + // this unit includes, transitively. + // + // The outer flag specifies whether to search the outer scopes. + // + template <typename T> + T* + lookup (std::string const& scope, + std::string const& name, + bool outer = true); + + public: typedef pointer_iterator<includes_list::const_iterator> includes_iterator; @@ -286,4 +305,6 @@ namespace semantics }; } +#include <semantics/unit.txx> + #endif // CLI_SEMANTICS_UNIT_HXX |