Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/ast/syntax_factory.rs')
-rw-r--r--crates/syntax/src/ast/syntax_factory.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/crates/syntax/src/ast/syntax_factory.rs b/crates/syntax/src/ast/syntax_factory.rs
index f3ae7544cc..9369a4e700 100644
--- a/crates/syntax/src/ast/syntax_factory.rs
+++ b/crates/syntax/src/ast/syntax_factory.rs
@@ -12,6 +12,7 @@ use std::cell::{RefCell, RefMut};
use crate::syntax_editor::SyntaxMapping;
+#[derive(Debug)]
pub struct SyntaxFactory {
// Stored in a refcell so that the factory methods can be &self
mappings: Option<RefCell<SyntaxMapping>>,
@@ -19,7 +20,7 @@ pub struct SyntaxFactory {
impl SyntaxFactory {
/// Creates a new [`SyntaxFactory`], generating mappings between input nodes and generated nodes.
- pub fn with_mappings() -> Self {
+ pub(crate) fn with_mappings() -> Self {
Self { mappings: Some(RefCell::new(SyntaxMapping::default())) }
}
@@ -28,13 +29,8 @@ impl SyntaxFactory {
Self { mappings: None }
}
- /// Gets all of the tracked syntax mappings, if any.
- pub fn finish_with_mappings(self) -> SyntaxMapping {
- self.mappings.unwrap_or_default().into_inner()
- }
-
/// Take all of the tracked syntax mappings, leaving `SyntaxMapping::default()` in its place, if any.
- pub fn take(&self) -> SyntaxMapping {
+ pub(crate) fn take(&self) -> SyntaxMapping {
self.mappings.as_ref().map(|mappings| mappings.take()).unwrap_or_default()
}