Expand description
ASTRegApply implementations for basic mutations
These implementations enable registry-based execution for mutations defined in ryo-mutations.
§Implementation Status
| Mutation | V2 Status | Notes |
|---|---|---|
| AddField/RemoveField | Done | V1/V2 equivalent |
| AddDerive/RemoveDerive | Done | V1/V2 equivalent |
| AddVariant/RemoveVariant | Done | V1/V2 equivalent |
| AddMod/RemoveMod | Done | V1/V2 equivalent |
| AddItem/RemoveItem | Done | V2 function API |
| AddMethod/RemoveMethod | Done | V2 function API |
| CreateMod | Done | V2 function API |
| Rename | Done | V1/V2 equivalent |
| ChangeVisibility | Done | V1/V2 equivalent |
| AddMatchArm/RemoveMatchArm | Done | V2-only (no V1 impl) |
| AddStructLiteralField/… | Done | V1/V2 equivalent |
| OrganizeImports | Done | V2 via module_items |
| AssignOp | Done | Idiom: a = a + b → a += b |
| BoolSimplify | Done | Idiom: x == true → x |
| ComparisonToMethod | Done | Idiom: s == “” → s.is_empty() |
| CollapsibleIf | Done | Idiom: nested if → if a && b |
| RedundantClosure | Done | Idiom: |x| f(x) → f |
| FilterNext | Done | Idiom: .filter().next() → .find() |
| MapUnwrapOr | Done | Idiom: .map().unwrap_or() → .map_or() |
| CloneOnCopy | Done | Idiom: x.clone() → x (Copy types) |
| LoopToIterator | Done | Idiom: for loop → iterator chain |
| UnwrapToQuestion | Done | Idiom: .unwrap() → ? |
| ManualMap | Done | Idiom: match Some → .map() |
| MatchToIfLet | Done | Idiom: match → if let |
| IntroduceVariable | Done | Recursive expr replacement |
| MergeImplBlocks | N/A | RegistryGenerator auto-merges |
| ExtractTrait/InlineTrait | Done | Struct inherent impl ↔ trait |
| ReplaceExpr | Done | Recursive expr replacement |
| RemoveStatement | Done | Pattern-based stmt removal |
| InsertStatement | Done | Position-based stmt insertion |
| ReplaceStatement | Done | Stmt-to-stmt replacement |
| Duplicate* | Done | Via AddPureItemsMutation |
| AddSpec | N/A | Blueprint composition |
| MoveItem | N/A | Blueprint composition |
| PluginTransform | N/A | WASM runtime, out of scope |
§Quality Policy
See [super::ast_reg_apply] for the V2 implementation quality policy.
Key points:
- Each implementation must work naturally with ASTRegistry
- Do NOT create hacky workarounds to make tests pass
- If V2 cannot handle cleanly, evaluate API extensions first
Re-exports§
pub use create_mod::create_mod_v2;pub use item::add_item_v2;pub use item::remove_item_v2;
Modules§
- create_
mod - ASTRegApply implementation for CreateModMutation
- item
- ASTRegApply implementations for AddItemMutation, AddPureItemsMutation, RemoveItemMutation, and MoveItemMutation
- method
- ASTRegApply implementations for AddMethodMutation and RemoveMethodMutation