From f5a81ec4683613bd62624811733345d627f2127b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 30 Jan 2021 18:19:21 +0300 Subject: Upgrade rowan Notably, new rowan comes with support for mutable syntax trees. --- crates/syntax/src/ast.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'crates/syntax/src/ast.rs') diff --git a/crates/syntax/src/ast.rs b/crates/syntax/src/ast.rs index b3a24d39d..19261686c 100644 --- a/crates/syntax/src/ast.rs +++ b/crates/syntax/src/ast.rs @@ -6,6 +6,7 @@ mod token_ext; mod node_ext; mod expr_ext; pub mod edit; +pub mod edit_in_place; pub mod make; use std::marker::PhantomData; @@ -40,6 +41,12 @@ pub trait AstNode { Self: Sized; fn syntax(&self) -> &SyntaxNode; + fn clone_for_update(&self) -> Self + where + Self: Sized, + { + Self::cast(self.syntax().clone_for_update()).unwrap() + } } /// Like `AstNode`, but wraps tokens rather than interior nodes. -- cgit v1.2.3