Skip to content

Commit

Permalink
Merge pull request #1709 from visualfc/parser_variadic
Browse files Browse the repository at this point in the history
parser: fix variadic end comma
  • Loading branch information
xushiwei committed Feb 6, 2024
2 parents 5ed66d4 + 4b9fe90 commit fb3cd28
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
33 changes: 33 additions & 0 deletions parser/_nofmt/printvariadic/parser.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package main

file printv.gop
noEntrypoint
ast.FuncDecl:
Name:
ast.Ident:
Name: main
Type:
ast.FuncType:
Params:
ast.FieldList:
Body:
ast.BlockStmt:
List:
ast.ExprStmt:
X:
ast.CallExpr:
Fun:
ast.Ident:
Name: println
Args:
ast.Ident:
Name: x
ast.ExprStmt:
X:
ast.CallExpr:
Fun:
ast.Ident:
Name: println
Args:
ast.Ident:
Name: y
6 changes: 6 additions & 0 deletions parser/_nofmt/printvariadic/printv.gop
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
println(
x...
)
println(
y...,
)
3 changes: 0 additions & 3 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -1955,9 +1955,6 @@ func (p *parser) parseCallOrConversion(fun ast.Expr, isCmd bool) *ast.CallExpr {
if p.tok == token.ELLIPSIS {
ellipsis = p.pos
p.next()
if p.tok != token.RPAREN {
break
}
}
if isCmd && p.tok == token.RBRACE {
break
Expand Down

0 comments on commit fb3cd28

Please sign in to comment.