mirror of
https://github.com/golang/go
synced 2024-11-22 10:14:40 -07:00
- support for [...] parsing and pretty printing
R=r OCL=22185 CL=22185
This commit is contained in:
parent
b0f627a6e1
commit
5bd3c3b755
@ -268,7 +268,10 @@ func (P *Parser) ParseArrayType() *AST.Type {
|
||||
|
||||
t := AST.NewType(P.pos, Scanner.LBRACK);
|
||||
P.Expect(Scanner.LBRACK);
|
||||
if P.tok != Scanner.RBRACK {
|
||||
if P.tok == Scanner.ELLIPSIS {
|
||||
t.expr = P.NewExpr(P.pos, Scanner.ELLIPSIS, nil, nil);
|
||||
P.Next();
|
||||
} else if P.tok != Scanner.RBRACK {
|
||||
t.expr = P.ParseExpression(1);
|
||||
}
|
||||
P.Expect(Scanner.RBRACK);
|
||||
|
@ -46,6 +46,9 @@ var (
|
||||
A = 5;
|
||||
u, v, w int = 0, 0, 0;
|
||||
foo = "foo";
|
||||
fixed_array0 = [10]int{};
|
||||
fixed_array1 = [10]int{0, 1, 2};
|
||||
fixed_array2 = [...]string{"foo", "bar"};
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user