mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: eliminate Io.importsafe
It was only really necessary for ensuring that package runtime should be treated as safe even without a "safe" marker, but mkbuiltin.go now compiles it with -u. Change-Id: Ifbcc62436ce40ab732ece667141afd82c1d3b64b Reviewed-on: https://go-review.googlesource.com/19625 Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
5bbb98df09
commit
7d80291c4c
3 changed files with 12 additions and 14 deletions
|
|
@ -386,15 +386,14 @@ type Sig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Io struct {
|
type Io struct {
|
||||||
infile string
|
infile string
|
||||||
bin *obj.Biobuf
|
bin *obj.Biobuf
|
||||||
cp string // used for content when bin==nil
|
cp string // used for content when bin==nil
|
||||||
last int
|
last int
|
||||||
peekc int
|
peekc int
|
||||||
peekc1 int // second peekc for ...
|
peekc1 int // second peekc for ...
|
||||||
nlsemi bool
|
nlsemi bool
|
||||||
eofnl bool
|
eofnl bool
|
||||||
importsafe bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Dlist struct {
|
type Dlist struct {
|
||||||
|
|
|
||||||
|
|
@ -884,7 +884,6 @@ func cannedimports(file string, cp string) {
|
||||||
curio.infile = file
|
curio.infile = file
|
||||||
curio.cp = cp
|
curio.cp = cp
|
||||||
curio.nlsemi = false
|
curio.nlsemi = false
|
||||||
curio.importsafe = false
|
|
||||||
|
|
||||||
typecheckok = true
|
typecheckok = true
|
||||||
incannedimport = 1
|
incannedimport = 1
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,6 @@ func (p *parser) loadsys() {
|
||||||
} else {
|
} else {
|
||||||
cannedimports("runtime.Builtin", runtimeimport)
|
cannedimports("runtime.Builtin", runtimeimport)
|
||||||
}
|
}
|
||||||
curio.importsafe = true
|
|
||||||
|
|
||||||
p.import_package()
|
p.import_package()
|
||||||
p.import_there()
|
p.import_there()
|
||||||
|
|
@ -467,9 +466,10 @@ func (p *parser) import_package() {
|
||||||
p.import_error()
|
p.import_error()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
importsafe := false
|
||||||
if p.tok == LNAME {
|
if p.tok == LNAME {
|
||||||
if p.sym_.Name == "safe" {
|
if p.sym_.Name == "safe" {
|
||||||
curio.importsafe = true
|
importsafe = true
|
||||||
}
|
}
|
||||||
p.next()
|
p.next()
|
||||||
}
|
}
|
||||||
|
|
@ -484,9 +484,9 @@ func (p *parser) import_package() {
|
||||||
if incannedimport == 0 {
|
if incannedimport == 0 {
|
||||||
importpkg.Direct = true
|
importpkg.Direct = true
|
||||||
}
|
}
|
||||||
importpkg.Safe = curio.importsafe
|
importpkg.Safe = importsafe
|
||||||
|
|
||||||
if safemode != 0 && !curio.importsafe {
|
if safemode != 0 && !importsafe {
|
||||||
Yyerror("cannot import unsafe package %q", importpkg.Path)
|
Yyerror("cannot import unsafe package %q", importpkg.Path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue