]> Cypherpunks repositories - gostls13.git/commit
go/doc: add new mode bit PreserveAST to control clearing of data in AST
authorRob Pike <r@golang.org>
Tue, 9 Oct 2018 22:54:22 +0000 (09:54 +1100)
committerRob Pike <r@golang.org>
Wed, 10 Oct 2018 23:40:18 +0000 (23:40 +0000)
commitd5e722034ab19d47377507f3606c1a72f484d7eb
treeb23c7bc6190edb36dcebb37413ae5cf08eeab7ba
parent555d8c455a420df4a2bd024a5cafdaa60ac3ae55
go/doc: add new mode bit PreserveAST to control clearing of data in AST

To save memory in godoc, this package routinely clears fields of
the AST to avoid keeping data that godoc no longer needs. For other
programs, such as cmd/doc, this behavior is unfortunate. Also, one
should be able to tell any package like this, "don't change my
data".

Add a Mode bit, defaulting to off to preserve existing behavior,
that allows a client to specify that the AST is inviolate.

This is necessary to address some of the outstanding issues
in cmd/doc that require, for example, looking at function bodies.

Fixes #26835

Change-Id: I01cc97c6addc5ab6abff885fff4bd53454a03bbc
Reviewed-on: https://go-review.googlesource.com/c/140958
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/doc/doc.go
src/go/doc/reader.go