mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
go/token: delete unused File.set field
This field is only used for a sanity check in a test. Change-Id: I868ed10131ec33994ebb1b1d88f6740956824bd7 Reviewed-on: https://go-review.googlesource.com/c/go/+/409834 Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
This commit is contained in:
parent
9068c6844d
commit
6c25ba624f
3 changed files with 1 additions and 9 deletions
|
|
@ -92,7 +92,6 @@ func (p Pos) IsValid() bool {
|
||||||
// A File is a handle for a file belonging to a FileSet.
|
// A File is a handle for a file belonging to a FileSet.
|
||||||
// A File has a name, size, and line offset table.
|
// A File has a name, size, and line offset table.
|
||||||
type File struct {
|
type File struct {
|
||||||
set *FileSet
|
|
||||||
name string // file name as provided to AddFile
|
name string // file name as provided to AddFile
|
||||||
base int // Pos value range for this file is [base...base+size]
|
base int // Pos value range for this file is [base...base+size]
|
||||||
size int // file size as provided to AddFile
|
size int // file size as provided to AddFile
|
||||||
|
|
@ -418,7 +417,7 @@ func (s *FileSet) AddFile(filename string, base, size int) *File {
|
||||||
panic(fmt.Sprintf("invalid size %d (should be >= 0)", size))
|
panic(fmt.Sprintf("invalid size %d (should be >= 0)", size))
|
||||||
}
|
}
|
||||||
// base >= s.base && size >= 0
|
// base >= s.base && size >= 0
|
||||||
f := &File{set: s, name: filename, base: base, size: size, lines: []int{0}}
|
f := &File{name: filename, base: base, size: size, lines: []int{0}}
|
||||||
base += size + 1 // +1 because EOF also has a position
|
base += size + 1 // +1 because EOF also has a position
|
||||||
if base < 0 {
|
if base < 0 {
|
||||||
panic("token.Pos offset overflow (> 2G of source code in file set)")
|
panic("token.Pos offset overflow (> 2G of source code in file set)")
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ func (s *FileSet) Read(decode func(any) error) error {
|
||||||
for i := 0; i < len(ss.Files); i++ {
|
for i := 0; i < len(ss.Files); i++ {
|
||||||
f := &ss.Files[i]
|
f := &ss.Files[i]
|
||||||
files[i] = &File{
|
files[i] = &File{
|
||||||
set: s,
|
|
||||||
name: f.Name,
|
name: f.Name,
|
||||||
base: f.Base,
|
base: f.Base,
|
||||||
size: f.Size,
|
size: f.Size,
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,6 @@ func equal(p, q *FileSet) error {
|
||||||
|
|
||||||
for i, f := range p.files {
|
for i, f := range p.files {
|
||||||
g := q.files[i]
|
g := q.files[i]
|
||||||
if f.set != p {
|
|
||||||
return fmt.Errorf("wrong fileset for %q", f.name)
|
|
||||||
}
|
|
||||||
if g.set != q {
|
|
||||||
return fmt.Errorf("wrong fileset for %q", g.name)
|
|
||||||
}
|
|
||||||
if f.name != g.name {
|
if f.name != g.name {
|
||||||
return fmt.Errorf("different filenames: %q != %q", f.name, g.name)
|
return fmt.Errorf("different filenames: %q != %q", f.name, g.name)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue