Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0411bdd

Browse files
committed
Documentation on changing the structure of the AST
1 parent f885e47 commit 0411bdd

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

doc/changing_structure.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Changing structure
2+
3+
First and foremost, changing the structure of the tree in any way is a major breaking change. It forces the consumers to update their visitors, pattern matches, and method calls. It should not be taking lightly, and can only happen on a major version change. So keep that in mind.
4+
5+
That said, if you do want to change the structure of the tree, there are a few steps that you have to take. They are enumerated below.
6+
7+
1. Change the structure in the required node classes. This could mean adding/removing classes or adding/removing fields. Be sure to also update the `copy` and `===` methods to be sure that they are correct.
8+
2. Update the parser to correctly create the new structure.
9+
3. Update any visitor methods that are affected by the change. For example, if adding a new node make sure to create the new visit method alias in the `Visitor` class.
10+
4. Update the `FieldVisitor` class to be sure that the various serializers, pretty printers, and matchers all get updated accordingly.
11+
5. Update the `DSL` module to be sure that folks can correctly create nodes with the new structure.
12+
6. Ensure the formatting of the code hasn't changed. This can mostly be done by running the tests, but if there's a corner case that we don't cover that is now exposed by your change be sure to add test cases.
13+
7. Update the translation visitors to ensure we're still translating into other ASTs correctly.
14+
8. Update the YARV compiler visitor to ensure we're still compiling correctly.
15+
9. Make sure we aren't referencing the previous structure in any documentation or tests.
16+
10. Be sure to update `CHANGELOG.md` with a description of the change that you made.

0 commit comments

Comments
 (0)