Fix parsing of array type parameters
This commit is contained in:
parent
6efcb23d6b
commit
b97aa3f212
@ -391,7 +391,25 @@ namespace parsing {
|
|||||||
std::optional<std::string> param_name{};
|
std::optional<std::string> param_name{};
|
||||||
if (inner.peek().type == token::Type::Ident) {
|
if (inner.peek().type == token::Type::Ident) {
|
||||||
param_name = inner.expect(token::Type::Ident).content;
|
param_name = inner.expect(token::Type::Ident).content;
|
||||||
|
|
||||||
|
std::cout << inner.peek().formatted() << std::endl;
|
||||||
|
auto postfix = parse_array_postfix(inner, true);
|
||||||
|
while (postfix.ok()) {
|
||||||
|
auto array_postfix = postfix.unwrap();
|
||||||
|
if (array_postfix) {
|
||||||
|
param_ty = std::shared_ptr<types::Type>{
|
||||||
|
new types::ArrayType(param_ty, *array_postfix)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
param_ty = std::shared_ptr<types::Type>{
|
||||||
|
new types::PointerType(param_ty)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
postfix = parse_array_postfix(inner, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
params.push_back(std::pair(param_name, std::move(param_ty)));
|
params.push_back(std::pair(param_name, std::move(param_ty)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user