mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-31 03:40:08 +00:00
Replace [...] with [?]
This commit is contained in:
+4
-4
@@ -5275,11 +5275,11 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
|
||||
if (cl->type != nullptr) {
|
||||
type = nullptr;
|
||||
|
||||
// [...]Type
|
||||
// [?]Type
|
||||
if (cl->type->kind == AstNode_ArrayType && cl->type->ArrayType.count != nullptr) {
|
||||
AstNode *count = cl->type->ArrayType.count;
|
||||
if (count->kind == AstNode_UnaryExpr &&
|
||||
count->UnaryExpr.op.kind == Token_Ellipsis) {
|
||||
count->UnaryExpr.op.kind == Token_Question) {
|
||||
type = make_type_array(c->allocator, check_type(c, cl->type->ArrayType.elem), -1);
|
||||
is_to_be_determined_array_count = true;
|
||||
}
|
||||
@@ -6278,8 +6278,8 @@ gbString write_expr_to_string(gbString str, AstNode *node) {
|
||||
str = gb_string_append_rune(str, '[');
|
||||
if (at->count != nullptr &&
|
||||
at->count->kind == AstNode_UnaryExpr &&
|
||||
at->count->UnaryExpr.op.kind == Token_Ellipsis) {
|
||||
str = gb_string_appendc(str, "...");
|
||||
at->count->UnaryExpr.op.kind == Token_Question) {
|
||||
str = gb_string_appendc(str, "?");
|
||||
} else {
|
||||
str = write_expr_to_string(str, at->count);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1770,8 +1770,8 @@ AstNode *parse_operand(AstFile *f, bool lhs) {
|
||||
AstNode *count_expr = nullptr;
|
||||
bool is_vector = false;
|
||||
|
||||
if (f->curr_token.kind == Token_Ellipsis) {
|
||||
count_expr = ast_unary_expr(f, expect_token(f, Token_Ellipsis), nullptr);
|
||||
if (f->curr_token.kind == Token_Question) {
|
||||
count_expr = ast_unary_expr(f, expect_token(f, Token_Question), nullptr);
|
||||
} else if (allow_token(f, Token_dynamic)) {
|
||||
expect_token(f, Token_CloseBracket);
|
||||
return ast_dynamic_array_type(f, token, parse_type(f));
|
||||
|
||||
Reference in New Issue
Block a user