mirror of
https://github.com/golang/go
synced 2024-11-26 16:46:58 -07:00
- parser bug: return keyword may be followed by case or default keyword as well
- fixed unrelated typo R=rsc DELTA=2 (0 added, 0 deleted, 2 changed) OCL=30175 CL=30175
This commit is contained in:
parent
528919520d
commit
7fd9cfd0cc
@ -1314,7 +1314,7 @@ func (p *parser) parseReturnStmt() *ast.ReturnStmt {
|
||||
pos := p.pos;
|
||||
p.expect(token.RETURN);
|
||||
var x []ast.Expr;
|
||||
if p.tok != token.SEMICOLON && p.tok != token.RBRACE {
|
||||
if p.tok != token.SEMICOLON && p.tok != token.CASE && p.tok != token.DEFAULT && p.tok != token.RBRACE {
|
||||
x = p.parseExpressionList();
|
||||
}
|
||||
|
||||
@ -1431,7 +1431,7 @@ func (p *parser) parseCaseClause() *ast.CaseClause {
|
||||
|
||||
func (p *parser) parseTypeCaseClause() *ast.TypeCaseClause {
|
||||
if p.trace {
|
||||
defer un(trace(p, "CaseClause"));
|
||||
defer un(trace(p, "TypeCaseClause"));
|
||||
}
|
||||
|
||||
// TypeSwitchCase
|
||||
|
Loading…
Reference in New Issue
Block a user