From 3429b32ad119756985e1a7bfa5e9e53042671f8b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 20 Jan 2021 14:04:53 +0300 Subject: :arrow_up: rowan It now stores text inline with tokens --- crates/syntax/src/parsing/reparsing.rs | 3 +-- crates/syntax/src/parsing/text_tree_sink.rs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'crates/syntax/src/parsing') diff --git a/crates/syntax/src/parsing/reparsing.rs b/crates/syntax/src/parsing/reparsing.rs index 76f01084c..3d637bf91 100644 --- a/crates/syntax/src/parsing/reparsing.rs +++ b/crates/syntax/src/parsing/reparsing.rs @@ -73,8 +73,7 @@ fn reparse_token<'node>( new_text.pop(); } - let new_token = - GreenToken::new(rowan::SyntaxKind(prev_token_kind.into()), new_text.into()); + let new_token = GreenToken::new(rowan::SyntaxKind(prev_token_kind.into()), &new_text); Some(( prev_token.replace_with(new_token), new_err.into_iter().collect(), diff --git a/crates/syntax/src/parsing/text_tree_sink.rs b/crates/syntax/src/parsing/text_tree_sink.rs index ce27c3dd9..d5ddc076f 100644 --- a/crates/syntax/src/parsing/text_tree_sink.rs +++ b/crates/syntax/src/parsing/text_tree_sink.rs @@ -8,7 +8,7 @@ use crate::{ ast, parsing::Token, syntax_node::GreenNode, - SmolStr, SyntaxError, + SyntaxError, SyntaxKind::{self, *}, SyntaxTreeBuilder, TextRange, TextSize, }; @@ -135,7 +135,7 @@ impl<'a> TextTreeSink<'a> { fn do_token(&mut self, kind: SyntaxKind, len: TextSize, n_tokens: usize) { let range = TextRange::at(self.text_pos, len); - let text: SmolStr = self.text[range].into(); + let text = &self.text[range]; self.text_pos += len; self.token_pos += n_tokens; self.inner.token(kind, text); -- cgit v1.2.3