Fixed constant parsing if no problem is specified.

This commit is contained in:
Patrick Lühne 2017-06-17 17:06:49 +02:00
parent 78b4636028
commit c84cafda18
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF

View File

@ -77,10 +77,13 @@ ast::ConstantPointer parseConstant(Context &context, ASTContext &astContext)
if (constant)
return std::move(constant.value());
constant = findConstant(constantName, astContext.problem.value()->objects);
if (astContext.problem)
{
constant = findConstant(constantName, astContext.problem.value()->objects);
if (constant)
return std::move(constant.value());
if (constant)
return std::move(constant.value());
}
throw ParserException(tokenizer.location(), "constant “" + constantName + "” used but never declared");
}