Commit e03c7896 authored by Marvin Stenger's avatar Marvin Stenger Committed by Brad Fitzpatrick

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 25946645
......@@ -79,12 +79,12 @@ func autoexport(n *Node, ctxt uint8) {
}
func dumppkg(p *Pkg) {
if p == nil || p == localpkg || p.Exported != 0 || p == builtinpkg {
if p == nil || p == localpkg || p.Exported || p == builtinpkg {
return
}
p.Exported = 1
p.Exported = true
suffix := ""
if p.Direct == 0 {
if !p.Direct {
suffix = " // indirect"
}
fmt.Fprintf(bout, "\timport %s %q%s\n", p.Name, p.Path, suffix)
......@@ -371,7 +371,7 @@ func dumpexport() {
fmt.Fprintf(bout, "\n")
for _, p := range pkgs {
if p.Direct != 0 {
if p.Direct {
dumppkg(p)
}
}
......
......@@ -125,9 +125,9 @@ type Pkg struct {
Path string // string literal used in import statement
Pathsym *Sym
Prefix string // escaped path for use in symbol table
Imported uint8 // export data of this package was parsed
Exported int8 // import line written in export data
Direct int8 // imported directly
Imported bool // export data of this package was parsed
Exported bool // import line written in export data
Direct bool // imported directly
Safe bool // whether the package is marked as safe
Syms map[string]*Sym
}
......
......@@ -315,7 +315,7 @@ import_package:
} else if importpkg.Name != $2.Name {
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
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
// to the lexer to avoid parsing export data twice.
if importpkg.Imported != 0 {
if importpkg.Imported {
tag := ""
if importpkg.Safe {
tag = "safe"
......@@ -755,7 +755,7 @@ func importfile(f *Val, line int) {
return
}
importpkg.Imported = 1
importpkg.Imported = true
var err error
var imp *obj.Biobuf
......
......@@ -1293,7 +1293,7 @@ func dumptypestructs() {
// generate import strings for imported packages
for _, p := range pkgs {
if p.Direct != 0 {
if p.Direct {
dimportpath(p)
}
}
......
......@@ -1354,7 +1354,7 @@ yydefault:
} 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)
}
importpkg.Direct = 1
importpkg.Direct = true
importpkg.Safe = curio.importsafe
if safemode != 0 && !curio.importsafe {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment