Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Showing
2 changed files
with
35 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters