odin/parser: fix offsets of value declarations

Fixes #4356
This commit is contained in:
Laytan Laats
2024-10-19 20:02:39 +02:00
parent b6cbdf7c54
commit 9f609dd740
+3 -1
View File
@@ -3696,6 +3696,8 @@ parse_value_decl :: proc(p: ^Parser, names: []^ast.Expr, docs: ^ast.Comment_Grou
}
}
end := p.prev_tok
if p.expr_level >= 0 {
end: ^ast.Expr
if !is_mutable && len(values) > 0 {
@@ -3715,7 +3717,7 @@ parse_value_decl :: proc(p: ^Parser, names: []^ast.Expr, docs: ^ast.Comment_Grou
}
}
decl := ast.new(ast.Value_Decl, names[0].pos, end_pos(p.prev_tok))
decl := ast.new(ast.Value_Decl, names[0].pos, end_pos(end))
decl.docs = docs
decl.names = names
decl.type = type