Skip to content
Snippets Groups Projects
Commit 772d4f35 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add a bunch of lcov exclusion directives

This is only related to debugging helpers that cannot be reached when everything
is fine.

Fix issue #13
parent f40aeca6
No related branches found
No related tags found
2 merge requests!37Feature/language,!27Issue/16
...@@ -29,10 +29,12 @@ ASTNodeAffectationExpressionBuilder::ASTNodeAffectationExpressionBuilder(ASTNode ...@@ -29,10 +29,12 @@ ASTNodeAffectationExpressionBuilder::ASTNodeAffectationExpressionBuilder(ASTNode
n.m_node_processor = std::make_unique<AffectationProcessor<OperatorT, ValueT, double>>(n); n.m_node_processor = std::make_unique<AffectationProcessor<OperatorT, ValueT, double>>(n);
break; break;
} }
// LCOV_EXCL_START
default: { default: {
throw parse_error("unexpected error: undefined operand type for affectation", throw parse_error("unexpected error: undefined operand type for affectation",
std::vector{n.children[1]->begin()}); std::vector{n.children[1]->begin()});
} }
// LCOV_EXCL_STOP
} }
}; };
...@@ -61,10 +63,12 @@ ASTNodeAffectationExpressionBuilder::ASTNodeAffectationExpressionBuilder(ASTNode ...@@ -61,10 +63,12 @@ ASTNodeAffectationExpressionBuilder::ASTNodeAffectationExpressionBuilder(ASTNode
n.m_node_processor = std::make_unique<AffectationProcessor<OperatorT, std::string, std::string>>(n); n.m_node_processor = std::make_unique<AffectationProcessor<OperatorT, std::string, std::string>>(n);
break; break;
} }
// LCOV_EXCL_START
default: { default: {
throw parse_error("unexpected error: undefined operand type for string affectation", throw parse_error("unexpected error: undefined operand type for string affectation",
std::vector{n.children[1]->begin()}); std::vector{n.children[1]->begin()});
} }
// LCOV_EXCL_STOP
} }
} else { } else {
throw parse_error("unexpected error: undefined operator type", std::vector{n.children[0]->begin()}); throw parse_error("unexpected error: undefined operator type", std::vector{n.children[0]->begin()});
......
...@@ -29,10 +29,12 @@ ASTNodeCFunctionExpressionBuilder::_getArgumentConverter(const ASTNodeDataType& ...@@ -29,10 +29,12 @@ ASTNodeCFunctionExpressionBuilder::_getArgumentConverter(const ASTNodeDataType&
case ASTNodeDataType::double_t: { case ASTNodeDataType::double_t: {
return std::make_unique<FunctionArgumentConverter<ParameterT, double>>(argument_number); return std::make_unique<FunctionArgumentConverter<ParameterT, double>>(argument_number);
} }
// LCOV_EXCL_START
default: { default: {
throw parse_error("unexpected error: invalid argument type for function", throw parse_error("unexpected error: invalid argument type for function",
std::vector{argument_node_sub_data_type.m_parent_node.begin()}); std::vector{argument_node_sub_data_type.m_parent_node.begin()});
} }
// LCOV_EXCL_STOP
} }
}; };
...@@ -50,10 +52,12 @@ ASTNodeCFunctionExpressionBuilder::_getArgumentConverter(const ASTNodeDataType& ...@@ -50,10 +52,12 @@ ASTNodeCFunctionExpressionBuilder::_getArgumentConverter(const ASTNodeDataType&
case ASTNodeDataType::double_t: { case ASTNodeDataType::double_t: {
return get_function_argument_converter_for(double{}); return get_function_argument_converter_for(double{});
} }
// LCOV_EXCL_START
default: { default: {
throw parse_error("unexpected error: undefined parameter type for function", throw parse_error("unexpected error: undefined parameter type for function",
std::vector{argument_node_sub_data_type.m_parent_node.begin()}); std::vector{argument_node_sub_data_type.m_parent_node.begin()});
} }
// LCOV_EXCL_STOP
} }
}; };
......
...@@ -180,7 +180,9 @@ ASTNodeFunctionExpressionBuilder::_getFunctionProcessor(const ASTNodeDataType ex ...@@ -180,7 +180,9 @@ ASTNodeFunctionExpressionBuilder::_getFunctionProcessor(const ASTNodeDataType ex
if constexpr (std::is_same_v<ReturnT, std::string>) { if constexpr (std::is_same_v<ReturnT, std::string>) {
return std::make_unique<FunctionExpressionProcessor<ReturnT, std::string>>(function_component_expression); return std::make_unique<FunctionExpressionProcessor<ReturnT, std::string>>(function_component_expression);
} else { } else {
// LCOV_EXCL_START
throw parse_error("unexpected error: invalid string conversion", std::vector{node.children[1]->begin()}); throw parse_error("unexpected error: invalid string conversion", std::vector{node.children[1]->begin()});
// LCOV_EXCL_STOP
} }
} }
// LCOV_EXCL_START // LCOV_EXCL_START
......
...@@ -32,10 +32,12 @@ ASTNodeListAffectationExpressionBuilder::_buildAffectationProcessor( ...@@ -32,10 +32,12 @@ ASTNodeListAffectationExpressionBuilder::_buildAffectationProcessor(
list_affectation_processor->template add<ValueT, double>(value_node); list_affectation_processor->template add<ValueT, double>(value_node);
break; break;
} }
// LCOV_EXCL_START
default: { default: {
throw parse_error("unexpected error: invalid operand type for affectation", throw parse_error("unexpected error: invalid operand type for affectation",
std::vector{node_sub_data_type.m_parent_node.begin()}); std::vector{node_sub_data_type.m_parent_node.begin()});
} }
// LCOV_EXCL_STOP
} }
}; };
...@@ -62,10 +64,12 @@ ASTNodeListAffectationExpressionBuilder::_buildAffectationProcessor( ...@@ -62,10 +64,12 @@ ASTNodeListAffectationExpressionBuilder::_buildAffectationProcessor(
list_affectation_processor->template add<std::string, std::string>(value_node); list_affectation_processor->template add<std::string, std::string>(value_node);
break; break;
} }
// LCOV_EXCL_START
default: { default: {
throw parse_error("invalid operand type for string affectation", throw parse_error("invalid operand type for string affectation",
std::vector{node_sub_data_type.m_parent_node.begin()}); std::vector{node_sub_data_type.m_parent_node.begin()});
} }
// LCOV_EXCL_STOP
} }
} else { } else {
throw parse_error("unexpected error: undefined operator type for string affectation", throw parse_error("unexpected error: undefined operator type for string affectation",
...@@ -98,9 +102,12 @@ ASTNodeListAffectationExpressionBuilder::_buildAffectationProcessor( ...@@ -98,9 +102,12 @@ ASTNodeListAffectationExpressionBuilder::_buildAffectationProcessor(
add_affectation_processor_for_string_data(node_sub_data_type); add_affectation_processor_for_string_data(node_sub_data_type);
break; break;
} }
// LCOV_EXCL_START
default: { default: {
throw parse_error("undefined value type for tuple affectation", std::vector{value_node.begin()}); throw parse_error("unexpected error: undefined value type for tuple affectation",
std::vector{value_node.begin()});
} }
// LCOV_EXCL_STOP
} }
}; };
......
...@@ -6,8 +6,9 @@ ASTNodeNaturalConversionChecker::ASTNodeNaturalConversionChecker(const ASTNode& ...@@ -6,8 +6,9 @@ ASTNodeNaturalConversionChecker::ASTNodeNaturalConversionChecker(const ASTNode&
{ {
if (not isNaturalConversion(data_type, target_data_type)) { if (not isNaturalConversion(data_type, target_data_type)) {
std::ostringstream error_message; std::ostringstream error_message;
error_message << "invalid implicit conversion: " << dataTypeName(data_type) << " -> " error_message << "invalid implicit conversion: ";
<< dataTypeName(target_data_type); error_message << rang::fgB::red << dataTypeName(data_type) << " -> " << dataTypeName(target_data_type)
<< rang::fg::reset;
throw parse_error(error_message.str(), node.begin()); throw parse_error(error_message.str(), node.begin());
} }
} }
...@@ -208,7 +208,9 @@ class BinaryExpressionProcessor final : public INodeProcessor ...@@ -208,7 +208,9 @@ class BinaryExpressionProcessor final : public INodeProcessor
BinaryExpressionProcessor(ASTNode& node) : m_node{node} BinaryExpressionProcessor(ASTNode& node) : m_node{node}
{ {
if constexpr (not _is_defined) { if constexpr (not _is_defined) {
// LCOV_EXCL_START
throw parse_error("invalid operands to binary expression", std::vector{m_node.begin()}); throw parse_error("invalid operands to binary expression", std::vector{m_node.begin()});
// LCOV_EXCL_STOP
} }
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment