summaryrefslogtreecommitdiff
path: root/src/syntax/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-11-04 15:16:46 +0100
committerMartin Haug <mhaug@live.de>2021-11-05 13:46:41 +0100
commitf0c9635db5efd0c66e01bef1be0a8f140fdbdd84 (patch)
tree9dec85646e86592c6353f18aa9c6265cabb9c83e /src/syntax/mod.rs
parent65fac0e57c9852eb2131aa06c0bac43b70bfbfbc (diff)
Notes
Diffstat (limited to 'src/syntax/mod.rs')
-rw-r--r--src/syntax/mod.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs
index d26c6484..112fc220 100644
--- a/src/syntax/mod.rs
+++ b/src/syntax/mod.rs
@@ -40,6 +40,15 @@ impl Green {
self.data().kind()
}
+ /// Set the type of the node.
+ pub fn set_kind(&mut self, kind: NodeKind) {
+ let data = match self {
+ Self::Node(node) => &mut Rc::make_mut(node).data,
+ Self::Token(data) => data,
+ };
+ data.set_kind(kind);
+ }
+
/// The length of the node.
pub fn len(&self) -> usize {
self.data().len()
@@ -141,6 +150,11 @@ impl GreenData {
&self.kind
}
+ /// Set the type of the node.
+ pub fn set_kind(&mut self, kind: NodeKind) {
+ self.kind = kind;
+ }
+
/// The length of the node.
pub fn len(&self) -> usize {
self.len