mirror of
https://github.com/golang/go
synced 2024-11-24 21:30:10 -07:00
cmd/compile: eliminate Io.infile and Io.cp
infile is never read and cp is never written. Both are unneeded. Change-Id: I0a90bb772a53a580ea4be8e5f0f770da7c1acf3a Reviewed-on: https://go-review.googlesource.com/19651 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Dave Cheney <dave@cheney.net> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
699a2ba137
commit
f8e41f6f59
@ -386,9 +386,7 @@ type Sig struct {
|
||||
}
|
||||
|
||||
type Io struct {
|
||||
infile string
|
||||
bin *obj.Biobuf
|
||||
cp string // used for content when bin==nil
|
||||
last int
|
||||
peekc int
|
||||
peekc1 int // second peekc for ...
|
||||
|
@ -320,7 +320,6 @@ func Main() {
|
||||
|
||||
linehistpush(infile)
|
||||
|
||||
curio.infile = infile
|
||||
var err error
|
||||
curio.bin, err = obj.Bopenr(infile)
|
||||
if err != nil {
|
||||
@ -824,7 +823,7 @@ func importfile(f *Val) {
|
||||
case '\n':
|
||||
// old export format
|
||||
pushedio = curio
|
||||
curio = Io{bin: imp, infile: file}
|
||||
curio = Io{bin: imp}
|
||||
typecheckok = true
|
||||
|
||||
parse_import()
|
||||
@ -851,7 +850,7 @@ func importfile(f *Val) {
|
||||
func cannedimports(file string, cp string) {
|
||||
lexlineno++ // if sys.6 is included on line 1,
|
||||
pushedio = curio
|
||||
curio = Io{infile: file, bin: obj.Binitr(strings.NewReader(cp))}
|
||||
curio = Io{bin: obj.Binitr(strings.NewReader(cp))}
|
||||
typecheckok = true
|
||||
incannedimport = 1
|
||||
|
||||
@ -1903,15 +1902,7 @@ func getc() int {
|
||||
goto check
|
||||
}
|
||||
|
||||
if curio.bin == nil {
|
||||
if len(curio.cp) == 0 {
|
||||
c = 0
|
||||
} else {
|
||||
c = int(curio.cp[0])
|
||||
curio.cp = curio.cp[1:]
|
||||
}
|
||||
} else {
|
||||
loop:
|
||||
loop:
|
||||
c = obj.Bgetc(curio.bin)
|
||||
// recognize BOM (U+FEFF): UTF-8 encoding is 0xef 0xbb 0xbf
|
||||
if c == 0xef {
|
||||
@ -1929,16 +1920,11 @@ func getc() int {
|
||||
goto loop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
check:
|
||||
switch c {
|
||||
case 0:
|
||||
if curio.bin != nil {
|
||||
Yyerror("illegal NUL byte")
|
||||
break
|
||||
}
|
||||
fallthrough
|
||||
|
||||
// insert \n at EOF
|
||||
case EOF:
|
||||
|
Loading…
Reference in New Issue
Block a user