瀏覽代碼

Merge pull request #3992 from thetarnav/parser-patch

Correct the Array_Type.len comment and assign tok when making Ellipsis node
gingerBill 1 年之前
父節點
當前提交
04c3723985
共有 2 個文件被更改,包括 2 次插入1 次删除
  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
 	}