M jasm/assemble/assembler_impl/operators_impl.cpp +15 -4
@@ 9,6 9,15 @@ namespace jasm {
using namespace core;
+/// Returns "was" if number is 1, otherwise "were"
+const char *was_or_were(uint32_t number)
+{
+ if (number != 1) {
+ return "were";
+ }
+ return "was";
+}
+
bool Assembler::verify_numeric_argument(bool generate, const ExpressionComponent &operator_component, const Value &right, Value &result)
{
if (!is_numeric(right)) {
@@ 159,9 168,11 @@ bool Assembler::verify_num_arguments_and
const ExpressionComponent &ec = components[operator_index];
std::stringstream ss;
ss << "Wrong number of arguments. " << num_args - skip_args << " argument";
- if (num_args - skip_args != 1)
+ if (num_args - skip_args != 1) {
ss << "s";
- ss << " was expected and " << num_args_count << " was given.";
+ }
+ ss << ' ' << was_or_were(num_args - skip_args) << " expected and " << num_args_count;
+ ss << ' ' << was_or_were(num_args_count) << " given.";
report_error(ec.source_location, AssemblyErrorCodes::WrongNumberOfArguments, ss.str());
}
set_unknown(result);
@@ 1088,7 1099,7 @@ void Assembler::operator_function_call(b
ss << to_string(func_type) << " takes at least " << func_desc.num_arguments << " argument";
if (func_desc.num_arguments != 1)
ss << "s";
- ss << " and " << num_args << " was given.";
+ ss << " and " << num_args << ' ' << was_or_were(num_args) << " given.";
report_error(ec.source_location, AssemblyErrorCodes::TooFewFunctionArguments, ss.str());
}
set_unknown(result);
@@ 1183,7 1194,7 @@ void Assembler::operator_method_closure_
if (method_desc.num_arguments != 1) {
ss << "s";
}
- ss << " and " << num_args << " was given.";
+ ss << " and " << num_args << ' ' << was_or_were(num_args) << " given.";
report_error(ec.source_location, AssemblyErrorCodes::NoOfArgumentsDoesNotMatchMethodSignature, ss.str());
}
set_unknown(result);
M jasm/unit_tests/results/test_function_min_with_zero_arguments.stdout +1 -1
@@ 1,2 1,2 @@
-unit_tests/test_function_min_with_zero_arguments.asm(5,15) : Error 3065 : Too few function arguments given. Function min takes at least 1 argument and 0 was given.
+unit_tests/test_function_min_with_zero_arguments.asm(5,15) : Error 3065 : Too few function arguments given. Function min takes at least 1 argument and 0 were given.
Assembly ended with errors.
M jasm/unit_tests/results/test_function_wrong_number_of_arguments.stdout +1 -1
@@ 1,2 1,2 @@
-unit_tests/test_function_wrong_number_of_arguments.asm(4,11) : Error 3025 : Wrong number of arguments. 1 argument was expected and 2 was given.
+unit_tests/test_function_wrong_number_of_arguments.asm(4,11) : Error 3025 : Wrong number of arguments. 1 argument was expected and 2 were given.
Assembly ended with errors.
M jasm/unit_tests/results/test_list_erase_with_too_few_arguments.stdout +1 -1
@@ 1,2 1,2 @@
-unit_tests/test_list_erase_with_too_few_arguments.asm(5,19) : Error 3053 : Number of method arguments doesn't match method signature. Method erase takes at least 1 argument and 0 was given.
+unit_tests/test_list_erase_with_too_few_arguments.asm(5,19) : Error 3053 : Number of method arguments doesn't match method signature. Method erase takes at least 1 argument and 0 were given.
Assembly ended with errors.
M jasm/unit_tests/results/test_list_keep_with_too_few_arguments.stdout +1 -1
@@ 1,2 1,2 @@
-unit_tests/test_list_keep_with_too_few_arguments.asm(5,18) : Error 3053 : Number of method arguments doesn't match method signature. Method keep takes at least 1 argument and 0 was given.
+unit_tests/test_list_keep_with_too_few_arguments.asm(5,18) : Error 3053 : Number of method arguments doesn't match method signature. Method keep takes at least 1 argument and 0 were given.
Assembly ended with errors.
M jasm/unit_tests/results/test_list_sort_macro_requires_two_arguments.stdout +1 -1
@@ 1,2 1,2 @@
-unit_tests/test_list_sort_macro_requires_two_arguments.asm(9,10) : Error 3025 : Wrong number of arguments. 1 argument was expected and 2 was given.
+unit_tests/test_list_sort_macro_requires_two_arguments.asm(9,10) : Error 3025 : Wrong number of arguments. 1 argument was expected and 2 were given.
Assembly ended with errors.
M jasm/unit_tests/results/test_list_sort_takes_one_argument.stdout +1 -1
@@ 1,2 1,2 @@
-unit_tests/test_list_sort_takes_one_argument.asm(4,9) : Error 3053 : Number of method arguments doesn't match method signature. Method sort takes 1 argument and 0 was given.
+unit_tests/test_list_sort_takes_one_argument.asm(4,9) : Error 3053 : Number of method arguments doesn't match method signature. Method sort takes 1 argument and 0 were given.
Assembly ended with errors.
M jasm/unit_tests/results/test_too_few_arguments_to_variable_argument_function.stdout +1 -1
@@ 1,2 1,2 @@
-unit_tests/test_too_few_arguments_to_variable_argument_function.asm(5,18) : Error 3065 : Too few function arguments given. Function format takes at least 1 argument and 0 was given.
+unit_tests/test_too_few_arguments_to_variable_argument_function.asm(5,18) : Error 3065 : Too few function arguments given. Function format takes at least 1 argument and 0 were given.
Assembly ended with errors.
M jasm/unit_tests/results/test_wrong_number_of_macro_arguments.stdout +1 -1
@@ 1,2 1,2 @@
-unit_tests/test_wrong_number_of_macro_arguments.asm(10,3) : Error 3025 : Wrong number of arguments. 2 arguments was expected and 1 was given.
+unit_tests/test_wrong_number_of_macro_arguments.asm(10,3) : Error 3025 : Wrong number of arguments. 2 arguments were expected and 1 was given.
Assembly ended with errors.