Allowing not declaring implicit “object” type without warning or error.
This commit is contained in:
parent
4c0583c91f
commit
bbf2a7d02d
|
@ -33,10 +33,14 @@ ast::PrimitiveTypePointer parsePrimitiveType(Context &context, ast::Domain &doma
|
||||||
// If the type has not been declared yet, add it but issue a warning
|
// If the type has not been declared yet, add it but issue a warning
|
||||||
if (matchingType == types.end())
|
if (matchingType == types.end())
|
||||||
{
|
{
|
||||||
if (context.mode != Mode::Compatibility)
|
// “object” type is always allowed without warning
|
||||||
throw ParserException(tokenizer, "primitive type “" + typeName + "” used without or before declaration");
|
if (typeName != "object")
|
||||||
|
{
|
||||||
|
if (context.mode != Mode::Compatibility)
|
||||||
|
throw ParserException(tokenizer, "primitive type “" + typeName + "” used without or before declaration");
|
||||||
|
|
||||||
context.warningCallback(tokenizer, "primitive type “" + typeName + "” used without or before declaration, silently adding declaration");
|
context.warningCallback(tokenizer, "primitive type “" + typeName + "” used without or before declaration, silently adding declaration");
|
||||||
|
}
|
||||||
|
|
||||||
types.emplace_back(std::make_unique<ast::PrimitiveTypeDeclaration>(std::move(typeName)));
|
types.emplace_back(std::make_unique<ast::PrimitiveTypeDeclaration>(std::move(typeName)));
|
||||||
|
|
||||||
|
|
Reference in New Issue