1
0
mirror of https://github.com/golang/go synced 2024-11-26 04:07:59 -07: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:
Robert Griesemer 2020-10-19 15:24:39 -07:00
parent e9e58a4d49
commit 5e46c6a10f

View File

@ -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) }