diff options
Diffstat (limited to 'src/core/parser')
| -rw-r--r-- | src/core/parser/ParserScope.cpp | 9 | ||||
| -rw-r--r-- | src/core/parser/ParserScope.hpp | 7 | 
2 files changed, 11 insertions, 5 deletions
diff --git a/src/core/parser/ParserScope.cpp b/src/core/parser/ParserScope.cpp index 4f44a96..1937697 100644 --- a/src/core/parser/ParserScope.cpp +++ b/src/core/parser/ParserScope.cpp @@ -90,7 +90,10 @@ Rooted<Node> ParserScopeBase::select(RttiSet types, int maxDepth)  			return nodes[i];  		}  	} -	return nullptr; +	throw LoggableException{ +	    std::string( +	        "Expected be inside an element of one of the internal types ") + +	    Utils::join(types, "\", \"", "\"", "\"")};  }  /* Class DeferredResolution */ @@ -352,9 +355,9 @@ bool ParserScope::resolveValue(Variant &data, Handle<Type> type,  			    return Type::MagicCallbackResult::NOT_FOUND;  		    } -  		    // Check whether the inner type of the constant is correct -		    Type::MagicCallbackResult res = Type::MagicCallbackResult::FOUND_VALID; +		    Type::MagicCallbackResult res = +		        Type::MagicCallbackResult::FOUND_VALID;  		    Rooted<Type> constantType = constant->getType();  		    if (!constantType->checkIsa(innerType)) {  			    logger.error(std::string("Expected value of type \"") + diff --git a/src/core/parser/ParserScope.hpp b/src/core/parser/ParserScope.hpp index 057d918..dc1b1bf 100644 --- a/src/core/parser/ParserScope.hpp +++ b/src/core/parser/ParserScope.hpp @@ -145,22 +145,25 @@ public:  	/**  	 * Ascends in the stack starting with the leaf node, returns the first node -	 * that matches the type given in the RttiSet or nullptr if none matches. +	 * that matches the type given in the RttiSet. Throws an exception if no +	 * node matches.  	 *  	 * @param types is a set of Rtti types for which should be searched in the  	 * stack.  	 * @param maxDepth is the maximum number of stack entries the selection  	 * function may ascend. A negative value indicates no limitation. +	 * @return the matching node.  	 */  	Rooted<Node> select(RttiSet types, int maxDepth = -1);  	/**  	 * Ascends in the stack starting with the leaf node, returns the first node -	 * that matches the given type or nullptr if none matches. +	 * that matches the given type. Throws an exception if no node matches.  	 *  	 * @tparam T is the type that should be searched in the stack.  	 * @param maxDepth is the maximum number of stack entries the selection  	 * function may ascend. A negative value indicates no limitation. +	 * @return the matching node.  	 */  	template <class T>  	Rooted<T> select(int maxDepth = -1)  | 
