Hash based on binding name and shadow counter

This commit is contained in:
Pascal Hertleif 2019-05-25 12:56:52 +02:00
parent 5bf3e949e8
commit ed89b0638b
No known key found for this signature in database
GPG key ID: EDBB1A8D2047A074
4 changed files with 81 additions and 21 deletions

View file

@ -1,6 +1,6 @@
use std::{fmt, ops::{self, Bound}};
use crate::{SyntaxNode, TextRange, TextUnit, SyntaxElement};
use crate::{SmolStr, SyntaxNode, TextRange, TextUnit, SyntaxElement};
#[derive(Clone)]
pub struct SyntaxText<'a> {
@ -34,6 +34,11 @@ impl<'a> SyntaxText<'a> {
self.chunks().collect()
}
pub fn to_smol_string(&self) -> SmolStr {
// TODO: `impl iter::FromIterator<&str> for SmolStr`
self.to_string().into()
}
pub fn contains(&self, c: char) -> bool {
self.chunks().any(|it| it.contains(c))
}