Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go/ast: add Apply, for rewriting ASTs
Based on work by Robert Griesemer. Fixes golang#17108 DO NOT REVIEW Work in progress. Notes: Needs more tests, particularly of interactions between modifications, like Delete then InsertAfter, Delete then InsertBefore, and so on. Even just the few tests I've added so far have helped to clarify the API. I've changed Apply to not walk the node inserted by InsertAfter. Optimize: Need to allocate a single ApplyCursor and reuse it. TODO: Review API, consider shrinking it a bit. Do we need ApplyCursor.IsFile to be exported? ApplyCursor.Name? And so on. Should Apply do anything with comments and/or CommentMaps? Should Apply.Name be renamed Apply.FieldName? Change-Id: I291bb3f8aba85abdeb728714c08702c082617f54
- Loading branch information