]> Cypherpunks repositories - gostls13.git/commitdiff
go/types: generate util_test.go, cosmetic changes to generator.go
authorRobert Griesemer <gri@golang.org>
Thu, 12 Jan 2023 18:04:38 +0000 (10:04 -0800)
committerGopher Robot <gobot@golang.org>
Tue, 17 Jan 2023 19:56:16 +0000 (19:56 +0000)
Change-Id: I80e4bbda302b9170d2367af2442ee282bdf51b12
Reviewed-on: https://go-review.googlesource.com/c/go/+/461679
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
src/go/types/generator.go
src/go/types/util_test.go

index 3f2668028db8f4e3859a0b41b71afeab19f3a386..a053072f6bdab8a3cf7aa6b1b9c6472fc6333cf3 100644 (file)
@@ -37,9 +37,9 @@ func main() {
        // process provided filenames, if any
        if flag.NArg() > 0 {
                for _, filename := range flag.Args() {
-                       fmt.Println("generating", filename)
                        generate(filename, filemap[filename])
                }
+               fmt.Printf("generated %d files\n", flag.NArg())
                return
        }
 
@@ -47,6 +47,7 @@ func main() {
        for filename, action := range filemap {
                generate(filename, action)
        }
+       fmt.Printf("generated %d files\n", len(filemap))
 }
 
 func generate(filename string, action action) {
@@ -117,6 +118,7 @@ var filemap = map[string]action{
        "under.go":         nil,
        "unify.go":         fixSprintf,
        "universe.go":      fixGlobalTypVarDecl,
+       "util_test.go":     fixTokenPos,
        "validtype.go":     nil,
 }
 
@@ -152,8 +154,8 @@ func renameImportPath(f *ast.File, from, to string) {
        })
 }
 
-// fixTokenPos changes imports of "cmd/compile/internal/syntax" to "go/token"
-// and uses of syntax.Pos to token.Pos.
+// fixTokenPos changes imports of "cmd/compile/internal/syntax" to "go/token",
+// uses of syntax.Pos to token.Pos, and calls to x.IsKnown() to x.IsValid().
 func fixTokenPos(f *ast.File) {
        ast.Inspect(f, func(n ast.Node) bool {
                switch n := n.(type) {
index cba6e243193c4e7732cef029af7ff46c69dd8b84..4667451a97059bf3f88c22231caebaa54dae1361 100644 (file)
@@ -1,3 +1,5 @@
+// Code generated by "go run generator.go"; DO NOT EDIT.
+
 // Copyright 2023 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.