Correct the Array_Type.len comment and assign tok when making Ellipsis node

This commit is contained in:
Damian Tarnawski
2024-07-29 22:14:42 +02:00
parent 7f17d4eb7f
commit 478b2d7444
2 changed files with 2 additions and 1 deletions

View File

@@ -757,7 +757,7 @@ Array_Type :: struct {
using node: Expr,
open: tokenizer.Pos,
tag: ^Expr,
len: ^Expr, // Ellipsis node for [?]T array types, nil for slice types
len: ^Expr, // Unary_Expr node for [?]T array types, nil for slice types
close: tokenizer.Pos,
elem: ^Expr,
}

View File

@@ -1778,6 +1778,7 @@ parse_var_type :: proc(p: ^Parser, flags: ast.Field_Flags) -> ^ast.Expr {
type = ast.new(ast.Bad_Expr, tok.pos, end_pos(tok))
}
e := ast.new(ast.Ellipsis, type.pos, type)
e.tok = tok.kind
e.expr = type
return e
}