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

Add treatment of tuple of basic types as builtin function arguments

parent 98019ba0
No related branches found
No related tags found
1 merge request!37Feature/language
......@@ -122,14 +122,45 @@ ASTNodeBuiltinFunctionExpressionBuilder::_getArgumentConverter(const ASTNodeData
using ParameterContentT = std::decay_t<decltype(parameter_content_v)>;
switch (argument_node_sub_data_type.m_data_type) {
case ASTNodeDataType::tuple_t: {
switch (argument_node_sub_data_type.m_data_type.contentType()) {
const auto& arg_content_type = argument_node_sub_data_type.m_data_type.contentType();
switch (arg_content_type) {
case ASTNodeDataType::type_id_t: {
return std::make_unique<FunctionTupleArgumentConverter<ParameterContentT, EmbeddedData>>(argument_number);
}
case ASTNodeDataType::bool_t: {
return std::make_unique<FunctionTupleArgumentConverter<ParameterContentT, bool>>(argument_number);
}
case ASTNodeDataType::unsigned_int_t: {
return std::make_unique<FunctionTupleArgumentConverter<ParameterContentT, uint64_t>>(argument_number);
}
case ASTNodeDataType::int_t: {
return std::make_unique<FunctionTupleArgumentConverter<ParameterContentT, int64_t>>(argument_number);
}
case ASTNodeDataType::double_t: {
return std::make_unique<FunctionTupleArgumentConverter<ParameterContentT, double>>(argument_number);
}
case ASTNodeDataType::string_t: {
return std::make_unique<FunctionTupleArgumentConverter<ParameterContentT, std::string>>(argument_number);
}
case ASTNodeDataType::vector_t: {
switch (arg_content_type.dimension()) {
case 1: {
return std::make_unique<FunctionTupleArgumentConverter<ParameterContentT, TinyVector<1>>>(argument_number);
}
case 2: {
return std::make_unique<FunctionTupleArgumentConverter<ParameterContentT, TinyVector<2>>>(argument_number);
}
case 3: {
return std::make_unique<FunctionTupleArgumentConverter<ParameterContentT, TinyVector<3>>>(argument_number);
}
default: {
throw UnexpectedError(dataTypeName(arg_content_type) +
" unexpected content of argument, invalid dimension of vector");
}
}
}
default: {
throw UnexpectedError(dataTypeName(argument_node_sub_data_type.m_data_type.contentType()) +
" unexpected tuple content type of argument ");
// return get_function_argument_converter_to_tuple_from_tuple(parameter_content_v);
throw UnexpectedError(dataTypeName(arg_content_type) + " unexpected tuple content type of argument ");
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment