Added exceptions for inconsistent use of typing.
This commit is contained in:
parent
17b8306394
commit
ce812d449b
@ -56,6 +56,11 @@ void parseAndAddConstantDeclarations(Context &context, ast::Domain &domain, ast:
|
||||
|
||||
tokenizer.skipWhiteSpace();
|
||||
}
|
||||
|
||||
const bool isTypingUsed = !domain.types.empty();
|
||||
|
||||
if (isTypingUsed && !constantDeclarations.empty() && !constantDeclarations.back()->type)
|
||||
throw ParserException(tokenizer, "missing type declaration for constant “" + constantDeclarations.back()->name + "”");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -56,6 +56,11 @@ void parseAndAddVariableDeclarations(Context &context, ast::Domain &domain, ast:
|
||||
|
||||
tokenizer.skipWhiteSpace();
|
||||
}
|
||||
|
||||
const bool isTypingUsed = !domain.types.empty();
|
||||
|
||||
if (isTypingUsed && !variableDeclarations.empty() && !variableDeclarations.back()->type)
|
||||
throw ParserException(tokenizer, "missing type declaration for variable “?" + variableDeclarations.back()->name + "”");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
Reference in New Issue
Block a user