Index strings

This commit is contained in:
2025-02-12 20:47:47 +01:00
parent f991686330
commit 62d9398772
10 changed files with 166 additions and 76 deletions

View File

@ -58,11 +58,43 @@ namespace gcc
{
return "Char";
}
else if (type == elna_string_type_node)
{
return "String";
}
else if (is_void_type(type)) // For procedures without a return type.
{
return "()";
}
else if (is_pointer_type(type))
{
return std::string("\"pointer to " + print_type(TREE_TYPE(type)) + "\"");
return std::string("pointer to " + print_type(TREE_TYPE(type)));
}
else if (TREE_CODE(type) == ARRAY_TYPE)
else if (is_procedure_type(type))
{
std::string output = "proc(";
tree parameter_type = TYPE_ARG_TYPES(type);
while (parameter_type != NULL_TREE)
{
output += print_type(TREE_VALUE(parameter_type));
parameter_type = TREE_CHAIN(parameter_type);
if (TREE_VALUE(parameter_type) == void_type_node)
{
break;
}
else
{
output += ", ";
}
}
output += ')';
if (!is_void_type(TREE_TYPE(type)))
{
output += " -> " + print_type(TREE_TYPE(type));
}
return output;
}
else if (is_array_type(type))
{
return "array";
}
@ -78,6 +110,7 @@ namespace gcc
{
return "<<unknown-type>>";
}
gcc_unreachable();
}
}
}