mirror of
https://github.com/golang/go
synced 2024-11-18 21:05:02 -07:00
go/tools/go/gcimporter: avoid possible endless loops in case of errors
R=adonovan CC=golang-dev https://golang.org/cl/39630045
This commit is contained in:
parent
7dcd8ded7c
commit
d6902b2ad5
@ -488,7 +488,7 @@ func (p *parser) parseStructType() types.Type {
|
||||
|
||||
p.expectKeyword("struct")
|
||||
p.expect('{')
|
||||
for i := 0; p.tok != '}'; i++ {
|
||||
for i := 0; p.tok != '}' && p.tok != scanner.EOF; i++ {
|
||||
if i > 0 {
|
||||
p.expect(';')
|
||||
}
|
||||
@ -535,7 +535,7 @@ func (p *parser) parseParameter() (par *types.Var, isVariadic bool) {
|
||||
//
|
||||
func (p *parser) parseParameters() (list []*types.Var, isVariadic bool) {
|
||||
p.expect('(')
|
||||
for p.tok != ')' {
|
||||
for p.tok != ')' && p.tok != scanner.EOF {
|
||||
if len(list) > 0 {
|
||||
p.expect(',')
|
||||
}
|
||||
@ -585,7 +585,7 @@ func (p *parser) parseInterfaceType() types.Type {
|
||||
|
||||
p.expectKeyword("interface")
|
||||
p.expect('{')
|
||||
for i := 0; p.tok != '}'; i++ {
|
||||
for i := 0; p.tok != '}' && p.tok != scanner.EOF; i++ {
|
||||
if i > 0 {
|
||||
p.expect(';')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user