Commit graph

5 commits

Author SHA1 Message Date
Jennifer Taylor
956460617e Codegen attribute visitors. 2019-08-28 13:28:29 -07:00
Jennifer Taylor
0da658d183 Calculate necessity of MaybeSentinel/RemovalSentinel based on usage.
There are a lot of nodes that cannot be removed or converted to maybes, such as
most of the Op tokens. It would be a bit of a lie to codegen leave_* methods
that allow these nodes to be converted, only to throw a runtime error later. So,
upgrade the codegen to allow us to see whether certain nodes are used in conjunction
with a MaybeSentinel/None, or inside a Sequence, to inform ourselves as to when to
allow MaybeSentinel or RemovalSentinel.
2019-08-28 13:28:29 -07:00
Jennifer Taylor
90e39ca4fa Add a tox environment for running codegen. 2019-08-28 13:28:29 -07:00
Jennifer Taylor
f9437f42b4 Add unit test to verify that codegen is clean.
We want to make sure that the generated function stubs stay in sync with
the node definitions. So, make a unit test that fails if codegen generates
a different file than the existing file, so that somebody modifying code
knows they need to re-run codegen.
2019-08-28 13:28:29 -07:00
Jennifer Taylor
f14b4fa37c Add codegen for visit_* and leave_* methods on CSTTransform and CSTVisitor.
This allows Pyre to typecheck returns inside visitors for us.
2019-08-28 13:28:29 -07:00