]> Cypherpunks repositories - gostls13.git/commit
go/ast: ast.Print must not crash with unexported fields
authorRobert Griesemer <gri@golang.org>
Fri, 3 Aug 2012 00:05:51 +0000 (17:05 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 3 Aug 2012 00:05:51 +0000 (17:05 -0700)
commit593c51cff13339c10e9e767209b699eb4ba56c44
tree3eef86dd6432ff1ccac29d6ba8c7fc8ed1c600a6
parent2f39a33b6a34cbc71ded902053cbd10447b073dc
go/ast: ast.Print must not crash with unexported fields

Don't print unexported struct fields; their values are
not accessible via reflection.

Fixes #3898.

Also:
- added support for arrays
- print empty maps, arrays, slices, structs on one line
  for a denser output
- added respective test cases

R=r
CC=golang-dev
https://golang.org/cl/6454089
src/pkg/go/ast/print.go
src/pkg/go/ast/print_test.go