From 0073401253c5df1396cbe901594e81b8a722c044 Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Fri, 6 Feb 2015 16:46:21 +0100 Subject: added new resolve method. --- src/core/parser/ParserScope.hpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/core/parser/ParserScope.hpp') 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()}, maxDepth).cast(); } - }; /** @@ -637,6 +636,27 @@ public: resultCallback); } + /** + * 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 + Rooted resolve(const std::vector &path, Logger &logger) + { + // TODO: Rooted res = resolve(typeOf(), path, + // logger).cast(); + // does not work. Why? Bother stackoverflow with this. + Rooted res = ParserScopeBase::resolve(typeOf(), path, logger); + return res.cast(); + } + /** * Resolves a typesystem type. Makes sure an array type is returned if an * array type is requested. -- cgit v1.2.3