diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-02-03 17:41:00 +0100 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-02-03 17:41:00 +0100 |
commit | b29af12c86ef34d61b0574f0016ae6046b0ec278 (patch) | |
tree | 59d9f1eb21389b09f11a24da4075ccb408181f7b | |
parent | f21e8c6d72eb498435094f07ec5ca120d58e1e02 (diff) |
Improved error message
-rw-r--r-- | src/core/parser/ParserScope.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
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> 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<Type> 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> 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; }); } |