mirror of
https://github.com/golang/go
synced 2024-11-11 23:20:24 -07:00
go/ast: add Slice3 field to SliceExpr
If Slice3 is set, the expression is a 3-index slice expression (2 colons). Required for type-checking. Backward-compatible API extension. R=r, rsc CC=golang-dev https://golang.org/cl/13826050
This commit is contained in:
parent
b0ef6aeff9
commit
20db0f428a
@ -298,6 +298,7 @@ type (
|
||||
Low Expr // begin of slice range; or nil
|
||||
High Expr // end of slice range; or nil
|
||||
Max Expr // maximum capacity of slice; or nil
|
||||
Slice3 bool // true if 3-index slice (2 colons present)
|
||||
Rbrack token.Pos // position of "]"
|
||||
}
|
||||
|
||||
|
@ -1187,7 +1187,7 @@ func (p *parser) parseIndexOrSlice(x ast.Expr) ast.Expr {
|
||||
|
||||
if ncolons > 0 {
|
||||
// slice expression
|
||||
return &ast.SliceExpr{X: x, Lbrack: lbrack, Low: index[0], High: index[1], Max: index[2], Rbrack: rbrack}
|
||||
return &ast.SliceExpr{X: x, Lbrack: lbrack, Low: index[0], High: index[1], Max: index[2], Slice3: ncolons == 2, Rbrack: rbrack}
|
||||
}
|
||||
|
||||
return &ast.IndexExpr{X: x, Lbrack: lbrack, Index: index[0], Rbrack: rbrack}
|
||||
|
Loading…
Reference in New Issue
Block a user