diff options
author | Wim <wim@42.be> | 2020-07-18 17:27:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-18 17:27:41 +0200 |
commit | 23d8742f0d95096b92f11729fb47f86ac3b68d43 (patch) | |
tree | 7b8acb02b051ae06e5454fda4a9d5118428fe016 /vendor/github.com/d5/tengo/v2/parser | |
parent | 3b6a8be07b9422714db30fb50977f342057febf3 (diff) | |
download | matterbridge-msglm-23d8742f0d95096b92f11729fb47f86ac3b68d43.tar.gz matterbridge-msglm-23d8742f0d95096b92f11729fb47f86ac3b68d43.tar.bz2 matterbridge-msglm-23d8742f0d95096b92f11729fb47f86ac3b68d43.zip |
Update dependencies for 1.18.0 release (#1175)
Diffstat (limited to 'vendor/github.com/d5/tengo/v2/parser')
-rw-r--r-- | vendor/github.com/d5/tengo/v2/parser/expr.go | 12 | ||||
-rw-r--r-- | vendor/github.com/d5/tengo/v2/parser/opcodes.go | 2 | ||||
-rw-r--r-- | vendor/github.com/d5/tengo/v2/parser/parser.go | 17 |
3 files changed, 20 insertions, 11 deletions
diff --git a/vendor/github.com/d5/tengo/v2/parser/expr.go b/vendor/github.com/d5/tengo/v2/parser/expr.go index 71e5155b..b6b6c62b 100644 --- a/vendor/github.com/d5/tengo/v2/parser/expr.go +++ b/vendor/github.com/d5/tengo/v2/parser/expr.go @@ -111,10 +111,11 @@ func (e *BoolLit) String() string { // CallExpr represents a function call expression. type CallExpr struct { - Func Expr - LParen Pos - Args []Expr - RParen Pos + Func Expr + LParen Pos + Args []Expr + Ellipsis Pos + RParen Pos } func (e *CallExpr) exprNode() {} @@ -134,6 +135,9 @@ func (e *CallExpr) String() string { for _, e := range e.Args { args = append(args, e.String()) } + if len(args) > 0 && e.Ellipsis.IsValid() { + args[len(args)-1] = args[len(args)-1] + "..." + } return e.Func.String() + "(" + strings.Join(args, ", ") + ")" } diff --git a/vendor/github.com/d5/tengo/v2/parser/opcodes.go b/vendor/github.com/d5/tengo/v2/parser/opcodes.go index a4fbfbaf..d97f4896 100644 --- a/vendor/github.com/d5/tengo/v2/parser/opcodes.go +++ b/vendor/github.com/d5/tengo/v2/parser/opcodes.go @@ -120,7 +120,7 @@ var OpcodeOperands = [...][]int{ OpImmutable: {}, OpIndex: {}, OpSliceIndex: {}, - OpCall: {1}, + OpCall: {1, 1}, OpReturn: {1}, OpGetLocal: {1}, OpSetLocal: {1}, diff --git a/vendor/github.com/d5/tengo/v2/parser/parser.go b/vendor/github.com/d5/tengo/v2/parser/parser.go index 501a9106..fd20423b 100644 --- a/vendor/github.com/d5/tengo/v2/parser/parser.go +++ b/vendor/github.com/d5/tengo/v2/parser/parser.go @@ -270,9 +270,13 @@ func (p *Parser) parseCall(x Expr) *CallExpr { p.exprLevel++ var list []Expr - for p.token != token.RParen && p.token != token.EOF { + var ellipsis Pos + for p.token != token.RParen && p.token != token.EOF && !ellipsis.IsValid() { list = append(list, p.parseExpr()) - + if p.token == token.Ellipsis { + ellipsis = p.pos + p.next() + } if !p.expectComma(token.RParen, "call argument") { break } @@ -281,10 +285,11 @@ func (p *Parser) parseCall(x Expr) *CallExpr { p.exprLevel-- rparen := p.expect(token.RParen) return &CallExpr{ - Func: x, - LParen: lparen, - RParen: rparen, - Args: list, + Func: x, + LParen: lparen, + RParen: rparen, + Ellipsis: ellipsis, + Args: list, } } |