mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.typeparams] cmd/compile/internal/syntax: add Pos method
Allows syntax.Pos values to implement
interface {
Pos() Pos
}
Preparation step for types2 package.
Change-Id: Ib0f4d7695a3d066983567d680fc3b9256a31c31d
Reviewed-on: https://go-review.googlesource.com/c/go/+/263622
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
e9e58a4d49
commit
5e46c6a10f
1 changed files with 1 additions and 0 deletions
|
|
@ -26,6 +26,7 @@ func MakePos(base *PosBase, line, col uint) Pos { return Pos{base, sat32(line),
|
|||
// TODO(gri) IsKnown makes an assumption about linebase < 1.
|
||||
// Maybe we should check for Base() != nil instead.
|
||||
|
||||
func (pos Pos) Pos() Pos { return pos }
|
||||
func (pos Pos) IsKnown() bool { return pos.line > 0 }
|
||||
func (pos Pos) Base() *PosBase { return pos.base }
|
||||
func (pos Pos) Line() uint { return uint(pos.line) }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue