]> Cypherpunks repositories - gostls13.git/commit
go/parser: remove safePos
authorMateusz Poliwczak <mpoliwczak34@gmail.com>
Mon, 4 Aug 2025 15:25:37 +0000 (17:25 +0200)
committerAlan Donovan <adonovan@google.com>
Mon, 4 Aug 2025 16:33:59 +0000 (09:33 -0700)
commitd7bd7773ebe0ffe7d7fae92acb77e10ad0539dd3
treea598eded65830ab97d7c1000ff7198c0522695f1
parent4b6cbc377f9b3d2598b0d30a37c9cf3797ba6e12
go/parser: remove safePos

The logic in safePos is wrong, since (*token.File).Offset does not panic,
so this function was basically a noop (since CL 559436).

To work properly it would have to be:

return p.file.Pos(p.file.Offset(pos))

Since it effectively acts as a no-op and hasn't been noticed since,
let's go ahead and remove it.

Change-Id: I00a1bcc5af6a996c63de3f1175c15062e85cf89b
Reviewed-on: https://go-review.googlesource.com/c/go/+/692955
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
src/go/parser/parser.go