result / optional return type modifiers for functions (one for all returns)

This commit is contained in:
ProgramSnail 2023-07-29 14:48:45 +03:00
parent 68463509d8
commit 195a26f9b7
10 changed files with 74 additions and 36 deletions

View file

@ -22,9 +22,13 @@ FunctionDefinition::combine(FunctionDefinition &&other_function_definition) {
if (*name_.get() != *other_function_definition.name_.get()) {
return CombineResult::DIFFERENT_NAME_ERROR;
}
if (modifier_ != other_function_definition.modifier_) {
if (return_modifier_ != other_function_definition.return_modifier_) {
return CombineResult::DIFFERNENT_MODIFIER_ERROR;
}
if (method_modifier_ != other_function_definition.method_modifier_) {
return CombineResult::DIFFERNENT_MODIFIER_ERROR;
}
if (are_annotations_same_to_names_ !=
other_function_definition.are_annotations_same_to_names_) {
return CombineResult::ARGUMENTS_ERROR;
@ -158,7 +162,7 @@ FunctionDefinition::combine(FunctionDefinition &&other_function_definition) {
error_handling::handle_internal_error(
"Function arguments are not properly checked before merging "
"during combination",
this);
*this);
}
}
} else {