diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-02-06 16:46:21 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-02-06 16:46:21 +0100 |
commit | 0073401253c5df1396cbe901594e81b8a722c044 (patch) | |
tree | 35ea391eae0174562161c9f8c2594005f6884cd7 /src/core/parser | |
parent | 313c07cca036472f493243263c4b3b6578f6361b (diff) |
added new resolve method.
Diffstat (limited to 'src/core/parser')
-rw-r--r-- | src/core/parser/ParserScope.hpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/core/parser/ParserScope.hpp b/src/core/parser/ParserScope.hpp index 7be3c4a..1de1592 100644 --- a/src/core/parser/ParserScope.hpp +++ b/src/core/parser/ParserScope.hpp @@ -197,7 +197,6 @@ public: { return selectOrThrow(RttiSet{&typeOf<T>()}, maxDepth).cast<T>(); } - }; /** @@ -638,6 +637,27 @@ public: } /** + * Tries to resolve a node for the given type and path for all nodes that + * are currently in the stack, starting with the topmost node on the stack. + * + * @tparam T is the type of the node that should be resolved. + * @param path is the path for which a node should be resolved. + * @param logger is the logger instance into which resolution problems + * should be logged. + * @return a reference at a resolved node or nullptr if no node could be + * found. + */ + template <class T> + Rooted<T> resolve(const std::vector<std::string> &path, Logger &logger) + { + // TODO: Rooted<Node> res = resolve(typeOf<T>(), path, + // logger).cast<T>(); + // does not work. Why? Bother stackoverflow with this. + Rooted<Node> res = ParserScopeBase::resolve(typeOf<T>(), path, logger); + return res.cast<T>(); + } + + /** * Resolves a typesystem type. Makes sure an array type is returned if an * array type is requested. * |