summaryrefslogtreecommitdiff
path: root/src/pkg/go/ast
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2013-06-21 13:14:06 -0700
committerRobert Griesemer <gri@golang.org>2013-06-21 13:14:06 -0700
commitbf6db7e05f81fb4478e5089cb00e8da78d68e0a7 (patch)
treee0795026db7eb8159da60dbd86daa1e87b0706f6 /src/pkg/go/ast
parent154d89110ad6f852106c21573b5f33fc900a2696 (diff)
downloadgo-bf6db7e05f81fb4478e5089cb00e8da78d68e0a7.tar.gz
go/*: support for slices with cap: s[:j:k] and s[i:j:k]
Experimental, per rsc's proposal. R=rsc CC=golang-dev https://codereview.appspot.com/10204043
Diffstat (limited to 'src/pkg/go/ast')
-rw-r--r--src/pkg/go/ast/ast.go1
-rw-r--r--src/pkg/go/ast/walk.go3
2 files changed, 4 insertions, 0 deletions
diff --git a/src/pkg/go/ast/ast.go b/src/pkg/go/ast/ast.go
index e75df8250..c68f94d17 100644
--- a/src/pkg/go/ast/ast.go
+++ b/src/pkg/go/ast/ast.go
@@ -297,6 +297,7 @@ type (
Lbrack token.Pos // position of "["
Low Expr // begin of slice range; or nil
High Expr // end of slice range; or nil
+ Max Expr // maximum capacity of slice; or nil
Rbrack token.Pos // position of "]"
}
diff --git a/src/pkg/go/ast/walk.go b/src/pkg/go/ast/walk.go
index fef2503c3..fedffb3f2 100644
--- a/src/pkg/go/ast/walk.go
+++ b/src/pkg/go/ast/walk.go
@@ -122,6 +122,9 @@ func Walk(v Visitor, node Node) {
if n.High != nil {
Walk(v, n.High)
}
+ if n.Max != nil {
+ Walk(v, n.Max)
+ }
case *TypeAssertExpr:
Walk(v, n.X)