Move syntax factory inside syntax editor#22049
Conversation
…ate all the occurances to use make via SyntaxEditor
There was a problem hiding this comment.
LGTM.
While I am generally against interior mutability, this time I support it to make SyntaxEditor not require a mutable reference to allow storing editor.make() in a variable, which is more pleasant to the eyes IMO. I'll leave it to you, though, if you want to do that or merge this as-is.
Adapted, introducing |
4c84ff6 to
745286d
Compare
| // tree traversal. Thus all paths in the tree are collected into a vec | ||
| // so that such operation is safe. | ||
| let (mut editor, item) = SyntaxEditor::new(self.transform_path(item)); | ||
| let (editor, item) = SyntaxEditor::new(self.transform_path(item)); |
There was a problem hiding this comment.
If nodes are going to carry a lifetime, this won't compile. It will need to accept an editor from the outside. Fine for this PR, though.
This PR moves
SyntaxFactoryinsideSyntaxEditorand migrates all of itswith_mappingusages toSyntaxEditor’smakevariant. Some remnants ofSyntaxFactory::without_mappingstill remain; addressing them may require additional work, as most are tied to the broader migration toSyntaxEditorand can be handled later.SyntaxEditor, including the integration ofSyntaxFactory.part of #15710 and #18285