From b29af12c86ef34d61b0574f0016ae6046b0ec278 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Tue, 3 Feb 2015 17:41:00 +0100 Subject: Improved error message --- src/core/parser/ParserScope.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/core') diff --git a/src/core/parser/ParserScope.cpp b/src/core/parser/ParserScope.cpp index 42225ca..e10302b 100644 --- a/src/core/parser/ParserScope.cpp +++ b/src/core/parser/ParserScope.cpp @@ -352,11 +352,10 @@ bool ParserScope::resolveValue(Variant &data, Handle type, return Type::MagicCallbackResult::NOT_FOUND; } - // Set the data to the value of the constant - innerData = constant->getValue(); // Check whether the inner type of the constant is correct // TODO: Use correct "isa" provided by Type + Type::MagicCallbackResult res = Type::MagicCallbackResult::FOUND_VALID; Rooted constantType = constant->getType(); if (innerType != constantType) { logger.error(std::string("Expected value of type \"") + @@ -365,10 +364,16 @@ bool ParserScope::resolveValue(Variant &data, Handle type, constant->getName() + std::string("\" of type \"") + constantType->getName() + "\" instead.", - *owner); - return Type::MagicCallbackResult::FOUND_INVALID; + innerData); + logger.note("Constant was defined here:", *constant); + res = Type::MagicCallbackResult::FOUND_INVALID; } - return Type::MagicCallbackResult::FOUND_VALID; + + // Set the data to the value of the constant (even if an error + // happend -- probably the type is was not that wrong -- who knows? + innerData = constant->getValue(); + + return res; }); } -- cgit v1.2.3