Skip to content

Commit

Permalink
odin/parser: fix offsets of value declarations
Browse files Browse the repository at this point in the history
Fixes #4356
  • Loading branch information
laytan committed Oct 19, 2024
1 parent b6cbdf7 commit 9f609dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/odin/parser/parser.odin
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down

0 comments on commit 9f609dd

Please sign in to comment.