Commit 429eb3c6 authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/compile: remove two unnecessary Pkg fields

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 2b5c18c9
...@@ -22,9 +22,7 @@ type Pkg struct { ...@@ -22,9 +22,7 @@ type Pkg struct {
Pathsym *obj.LSym Pathsym *obj.LSym
Prefix string // escaped path for use in symbol table Prefix string // escaped path for use in symbol table
Imported bool // export data of this package was parsed Imported bool // export data of this package was parsed
Exported bool // import line written in export data
Direct bool // imported directly Direct bool // imported directly
Safe bool // whether the package is marked as safe
Syms map[string]*Sym Syms map[string]*Sym
} }
......
...@@ -810,6 +810,7 @@ func importfile(f *Val, indent []byte) { ...@@ -810,6 +810,7 @@ func importfile(f *Val, indent []byte) {
} }
// process header lines // process header lines
safe := false
for { for {
p, err = imp.ReadString('\n') p, err = imp.ReadString('\n')
if err != nil { if err != nil {
...@@ -819,10 +820,13 @@ func importfile(f *Val, indent []byte) { ...@@ -819,10 +820,13 @@ func importfile(f *Val, indent []byte) {
break // header ends with blank line break // header ends with blank line
} }
if strings.HasPrefix(p, "safe") { if strings.HasPrefix(p, "safe") {
importpkg.Safe = true safe = true
break // ok to ignore rest break // ok to ignore rest
} }
} }
if safemode && !safe {
Yyerror("cannot import unsafe package %q", importpkg.Path)
}
// assume files move (get installed) // assume files move (get installed)
// so don't record the full path. // so don't record the full path.
...@@ -867,10 +871,6 @@ func importfile(f *Val, indent []byte) { ...@@ -867,10 +871,6 @@ func importfile(f *Val, indent []byte) {
Yyerror("no import in %q", path_) Yyerror("no import in %q", path_)
errorexit() errorexit()
} }
if safemode && !importpkg.Safe {
Yyerror("cannot import unsafe package %q", importpkg.Path)
}
} }
func pkgnotused(lineno int32, path string, name string) { func pkgnotused(lineno int32, path string, name string) {
......
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