]> Cypherpunks repositories - gostls13.git/commitdiff
go/token: delete unused File.set field
authorAlan Donovan <adonovan@google.com>
Wed, 1 Jun 2022 16:54:00 +0000 (12:54 -0400)
committerAlan Donovan <adonovan@google.com>
Fri, 17 Jun 2022 15:02:55 +0000 (15:02 +0000)
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>
src/go/token/position.go
src/go/token/serialize.go
src/go/token/serialize_test.go

index 00f24535bfd0ede40b50f8d0707b3c8f0a19db6a..bd9ae07b283163f746bd1a350d855e8aacc9a400 100644 (file)
@@ -92,7 +92,6 @@ func (p Pos) IsValid() bool {
 // A File is a handle for a file belonging to a FileSet.
 // A File has a name, size, and line offset table.
 type File struct {
-       set  *FileSet
        name string // file name as provided to AddFile
        base int    // Pos value range for this file is [base...base+size]
        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))
        }
        // 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
        if base < 0 {
                panic("token.Pos offset overflow (> 2G of source code in file set)")
index ffb69908b91f2c679a60ecc198593c10d52ed6c0..38c10ebd4747233c54d7f27c450617993370da4d 100644 (file)
@@ -31,7 +31,6 @@ func (s *FileSet) Read(decode func(any) error) error {
        for i := 0; i < len(ss.Files); i++ {
                f := &ss.Files[i]
                files[i] = &File{
-                       set:   s,
                        name:  f.Name,
                        base:  f.Base,
                        size:  f.Size,
index 4aa0b0da2600fce8093e15e069aec183d0f18c1c..8d9799547a25c4328d708f0444a6b4d8cf64bcac 100644 (file)
@@ -35,12 +35,6 @@ func equal(p, q *FileSet) error {
 
        for i, f := range p.files {
                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 {
                        return fmt.Errorf("different filenames: %q != %q", f.name, g.name)
                }