mirror of
https://github.com/golang/go
synced 2024-11-12 09:20:22 -07:00
cmd/compile/internal/gc: convert fields of Pkg to bool
Convert Pkg.Imported, Pkg.Exported, Pkg.Direct from uint8/int8/int8 to bool. This change passes go build -toolexec 'toolstash -cmp' -a std. Change-Id: I67a71f1186ff9737c03eca413f7d35d8a79ebc9b Reviewed-on: https://go-review.googlesource.com/14371 Run-TryBot: Dave Cheney <dave@cheney.net> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
259466452d
commit
e03c7896a7
@ -79,12 +79,12 @@ func autoexport(n *Node, ctxt uint8) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func dumppkg(p *Pkg) {
|
func dumppkg(p *Pkg) {
|
||||||
if p == nil || p == localpkg || p.Exported != 0 || p == builtinpkg {
|
if p == nil || p == localpkg || p.Exported || p == builtinpkg {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
p.Exported = 1
|
p.Exported = true
|
||||||
suffix := ""
|
suffix := ""
|
||||||
if p.Direct == 0 {
|
if !p.Direct {
|
||||||
suffix = " // indirect"
|
suffix = " // indirect"
|
||||||
}
|
}
|
||||||
fmt.Fprintf(bout, "\timport %s %q%s\n", p.Name, p.Path, suffix)
|
fmt.Fprintf(bout, "\timport %s %q%s\n", p.Name, p.Path, suffix)
|
||||||
@ -371,7 +371,7 @@ func dumpexport() {
|
|||||||
fmt.Fprintf(bout, "\n")
|
fmt.Fprintf(bout, "\n")
|
||||||
|
|
||||||
for _, p := range pkgs {
|
for _, p := range pkgs {
|
||||||
if p.Direct != 0 {
|
if p.Direct {
|
||||||
dumppkg(p)
|
dumppkg(p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,9 +125,9 @@ type Pkg struct {
|
|||||||
Path string // string literal used in import statement
|
Path string // string literal used in import statement
|
||||||
Pathsym *Sym
|
Pathsym *Sym
|
||||||
Prefix string // escaped path for use in symbol table
|
Prefix string // escaped path for use in symbol table
|
||||||
Imported uint8 // export data of this package was parsed
|
Imported bool // export data of this package was parsed
|
||||||
Exported int8 // import line written in export data
|
Exported bool // import line written in export data
|
||||||
Direct int8 // imported directly
|
Direct bool // imported directly
|
||||||
Safe bool // whether the package is marked as safe
|
Safe bool // whether the package is marked as safe
|
||||||
Syms map[string]*Sym
|
Syms map[string]*Sym
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,7 @@ import_package:
|
|||||||
} else if importpkg.Name != $2.Name {
|
} else if importpkg.Name != $2.Name {
|
||||||
Yyerror("conflicting names %s and %s for package %q", importpkg.Name, $2.Name, importpkg.Path);
|
Yyerror("conflicting names %s and %s for package %q", importpkg.Name, $2.Name, importpkg.Path);
|
||||||
}
|
}
|
||||||
importpkg.Direct = 1;
|
importpkg.Direct = true;
|
||||||
importpkg.Safe = curio.importsafe
|
importpkg.Safe = curio.importsafe
|
||||||
|
|
||||||
if safemode != 0 && !curio.importsafe {
|
if safemode != 0 && !curio.importsafe {
|
||||||
|
@ -744,7 +744,7 @@ func importfile(f *Val, line int) {
|
|||||||
|
|
||||||
// If we already saw that package, feed a dummy statement
|
// If we already saw that package, feed a dummy statement
|
||||||
// to the lexer to avoid parsing export data twice.
|
// to the lexer to avoid parsing export data twice.
|
||||||
if importpkg.Imported != 0 {
|
if importpkg.Imported {
|
||||||
tag := ""
|
tag := ""
|
||||||
if importpkg.Safe {
|
if importpkg.Safe {
|
||||||
tag = "safe"
|
tag = "safe"
|
||||||
@ -755,7 +755,7 @@ func importfile(f *Val, line int) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
importpkg.Imported = 1
|
importpkg.Imported = true
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
var imp *obj.Biobuf
|
var imp *obj.Biobuf
|
||||||
|
@ -1293,7 +1293,7 @@ func dumptypestructs() {
|
|||||||
|
|
||||||
// generate import strings for imported packages
|
// generate import strings for imported packages
|
||||||
for _, p := range pkgs {
|
for _, p := range pkgs {
|
||||||
if p.Direct != 0 {
|
if p.Direct {
|
||||||
dimportpath(p)
|
dimportpath(p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1354,7 +1354,7 @@ yydefault:
|
|||||||
} else if importpkg.Name != yyDollar[2].sym.Name {
|
} else if importpkg.Name != yyDollar[2].sym.Name {
|
||||||
Yyerror("conflicting names %s and %s for package %q", importpkg.Name, yyDollar[2].sym.Name, importpkg.Path)
|
Yyerror("conflicting names %s and %s for package %q", importpkg.Name, yyDollar[2].sym.Name, importpkg.Path)
|
||||||
}
|
}
|
||||||
importpkg.Direct = 1
|
importpkg.Direct = true
|
||||||
importpkg.Safe = curio.importsafe
|
importpkg.Safe = curio.importsafe
|
||||||
|
|
||||||
if safemode != 0 && !curio.importsafe {
|
if safemode != 0 && !curio.importsafe {
|
||||||
|
Loading…
Reference in New Issue
Block a user