feat: implement visitors#107
Conversation
6ebfe0b to
437e6dd
Compare
437e6dd to
e41ca88
Compare
|
Thanks for the PR! Would it be possible to split this is in several parts so we can discuss about the core architectural decisions first before going on to port all the main visitors from the JS side. For instance, I would expect the core visitor crate to have some sort of trait defining what a visitor does. Perhaps there are several versions as well. One that mutate, one that provides an immutable copy (the JS side, my preference but I understand this may not be desired on the Rust side), some return another Node tree, some return any type I had a brief look at the PR and I could write a review with 30-ish comments but I think it's best to design this step by step so the reviews can be more focused and we can build on top of the decisions we make. 🙏 |
sure, i'll split it for simplicity of review |
Problem
previously, codama-rs had the node model and a Rust-source -> IDL extractor but no IDL-level visitor layer at all - the TypeScript
@codama/visitors-coreand@codama/visitorswere entirely absent, so a built IDL couldn't be traversed, transformed, or reshaped in Rust (the foundation every renderer/transform pipeline needs). This branch ports that whole layer and verifies it against the upstream TypeScript.Summary of Changes
codama-visitors-corecrate: thesyn::fold-styleTransformVisitorframeworkcodama-visitorscrate: ported all 24 upstream transform visitorsrelated to #106