]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/gc: convert fields of Pkg to bool
authorMarvin Stenger <marvin.stenger94@gmail.com>
Tue, 8 Sep 2015 03:46:31 +0000 (05:46 +0200)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 8 Sep 2015 15:53:06 +0000 (15:53 +0000)
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>
src/cmd/compile/internal/gc/export.go
src/cmd/compile/internal/gc/go.go
src/cmd/compile/internal/gc/go.y
src/cmd/compile/internal/gc/lex.go
src/cmd/compile/internal/gc/reflect.go
src/cmd/compile/internal/gc/y.go

index f673137756578c7abc8b4a5f709aa40761ffd3e0..0edccce0516aa896e3b44ea79b9920b83495008c 100644 (file)
@@ -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)
                }
        }
index 3e7d6aa80e1a9e51e3175a92a2bc246efaf4bf35..21e6486415364110a2ffc7e4d4ec39a46f09ba62 100644 (file)
@@ -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
 }
index 32f02ded6d3c4827ece29430ef2d10798222fb2b..6d148e4824a8b95ee6f11ae197a24ed35b53bcda 100644 (file)
@@ -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 {
index ce0654e54bbab9237b35eda610d7dcc86f30ed8c..d2f8912e04d15400b5e5216f282c921885de1ba1 100644 (file)
@@ -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
index 80257c1dd8ed5fdf60bb3dab11b64004c651619e..b36df0f421e39f997890657147772c709f4e11b4 100644 (file)
@@ -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)
                }
        }
index 9b780353c34ecbd79f517a5f81cbc16c13639b0e..fafbdf163f4442e3206054ebca155abfd034d613 100644 (file)
@@ -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 {