]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove two unnecessary Pkg fields
authorMatthew Dempsky <mdempsky@google.com>
Tue, 13 Sep 2016 22:33:55 +0000 (15:33 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 13 Sep 2016 23:08:57 +0000 (23:08 +0000)
Exported is no longer used since removing the text-format exporter,
and Safe is only used within importfile so it can be made into a local
variable.

Change-Id: I92986f704d7952759c79d9243620a22c24602333
Reviewed-on: https://go-review.googlesource.com/29115
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/go.go
src/cmd/compile/internal/gc/main.go

index 860f29e5b47521bfd16d7427db73c377a59d3fbd..97fa7e2dddf4994a616ee87b8ea22b553db43f9a 100644 (file)
@@ -22,9 +22,7 @@ type Pkg struct {
        Pathsym  *obj.LSym
        Prefix   string // escaped path for use in symbol table
        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 99c6fe5a7442fc91ac08af599de92c265cf008fd..19d92d3bc0dd54b379a1fd6a928f968fc32d652d 100644 (file)
@@ -810,6 +810,7 @@ func importfile(f *Val, indent []byte) {
        }
 
        // process header lines
+       safe := false
        for {
                p, err = imp.ReadString('\n')
                if err != nil {
@@ -819,10 +820,13 @@ func importfile(f *Val, indent []byte) {
                        break // header ends with blank line
                }
                if strings.HasPrefix(p, "safe") {
-                       importpkg.Safe = true
+                       safe = true
                        break // ok to ignore rest
                }
        }
+       if safemode && !safe {
+               Yyerror("cannot import unsafe package %q", importpkg.Path)
+       }
 
        // assume files move (get installed)
        // so don't record the full path.
@@ -867,10 +871,6 @@ func importfile(f *Val, indent []byte) {
                Yyerror("no import in %q", path_)
                errorexit()
        }
-
-       if safemode && !importpkg.Safe {
-               Yyerror("cannot import unsafe package %q", importpkg.Path)
-       }
 }
 
 func pkgnotused(lineno int32, path string, name string) {