Skip to content

Commit

Permalink
parser: tupleExpr remove Pos/End implement
Browse files Browse the repository at this point in the history
  • Loading branch information
visualfc committed Jul 4, 2022
1 parent c600969 commit d6c877e
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,7 @@ func (p *parser) parseCallOrConversion(fun ast.Expr, isCmd bool) *ast.CallExpr {
expr := p.parseRHSOrType(isCmd && len(list) == 0)
if tuple, ok := expr.(*tupleExpr); ok {
list = tuple.Items
rparen = tuple.End()
rparen = tuple.Closing
isCmd = false
break
}
Expand Down Expand Up @@ -2085,14 +2085,6 @@ type tupleExpr struct {
Closing token.Pos
}

func (p *tupleExpr) Pos() token.Pos {
return p.Opening
}

func (p *tupleExpr) End() token.Pos {
return p.Closing
}

func (p *parser) parseLambdaExpr(allowTuple bool, allowCmd, allowRangeExpr bool) ast.Expr {
var x ast.Expr
var first = p.pos
Expand Down Expand Up @@ -2168,8 +2160,8 @@ func (p *parser) parseLambdaExpr(allowTuple bool, allowCmd, allowRangeExpr bool)
}
}
if !allowTuple {
if _, ok := x.(*tupleExpr); ok {
p.error(x.Pos(), "not support tuple")
if tuple, ok := x.(*tupleExpr); ok {
p.error(tuple.Opening, "tuple is not supported")
}
}
return x
Expand Down

0 comments on commit d6c877e

Please sign in to comment.