mirror of
https://github.com/golang/go
synced 2024-11-23 04:40:09 -07:00
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: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
2b5c18c99e
commit
429eb3c696
@ -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) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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) {
|
|||||||
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) {
|
|||||||
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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user