1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:17:45 +00:00

LibCpp: Support for parsing c-style fixed arrays (arr[2])

Also adds tests for finding declaration of arrays inside
CppComprehension which requires proper parsing for passing.

Side-effect of this patch: if we ctrl+click on array variables, it
should jump to the correct declaration inside HackStudio.
This commit is contained in:
iyush 2023-04-15 16:40:40 +02:00 committed by Sam Atkins
parent 34b04271f4
commit ac435f914c
7 changed files with 184 additions and 8 deletions

View file

@ -572,6 +572,24 @@ StringView TemplatizedName::full_name() const
return *m_full_name;
}
void SizedName::dump(FILE* output, size_t indent) const
{
Name::dump(output, indent);
print_indent(output, indent + 1);
StringBuilder dimension_info;
for (auto const& dim : m_dimensions) {
dimension_info.append('[');
dimension_info.append(dim);
dimension_info.append(']');
}
if (dimension_info.is_empty()) {
dimension_info.append("[]"sv);
}
outln(output, "{}", dimension_info.to_deprecated_string());
}
void CppCastExpression::dump(FILE* output, size_t indent) const
{
ASTNode::dump(output, indent);