Browse Source

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

Damian Tarnawski 1 year ago
parent
commit
478b2d7444
2 changed files with 2 additions and 1 deletions
  1. 1 1
      core/odin/ast/ast.odin
  2. 1 0
      core/odin/parser/parser.odin

+ 1 - 1
core/odin/ast/ast.odin

@@ -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,
 }

+ 1 - 0
core/odin/parser/parser.odin

@@ -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
 	}