mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
make Parse fields private
this is in preparation for the new rowan API
This commit is contained in:
parent
2e466bb365
commit
deab4caa7b
31 changed files with 109 additions and 99 deletions
|
@ -13,9 +13,9 @@ pub(crate) fn syntax_tree(
|
|||
file_id: FileId,
|
||||
text_range: Option<TextRange>,
|
||||
) -> String {
|
||||
let parse = db.parse(file_id);
|
||||
if let Some(text_range) = text_range {
|
||||
let file = db.parse(file_id).tree;
|
||||
let node = match algo::find_covering_element(file.syntax(), text_range) {
|
||||
let node = match algo::find_covering_element(parse.tree().syntax(), text_range) {
|
||||
SyntaxElement::Node(node) => node,
|
||||
SyntaxElement::Token(token) => {
|
||||
if let Some(tree) = syntax_tree_for_string(token, text_range) {
|
||||
|
@ -27,7 +27,7 @@ pub(crate) fn syntax_tree(
|
|||
|
||||
node.debug_dump()
|
||||
} else {
|
||||
db.parse(file_id).tree.syntax().debug_dump()
|
||||
parse.tree().syntax().debug_dump()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,8 +84,8 @@ fn syntax_tree_for_token(node: SyntaxToken, text_range: TextRange) -> Option<Str
|
|||
|
||||
// If the "file" parsed without errors,
|
||||
// return its syntax
|
||||
if parsed.errors.is_empty() {
|
||||
return Some(parsed.tree.syntax().debug_dump());
|
||||
if parsed.errors().is_empty() {
|
||||
return Some(parsed.tree().syntax().debug_dump());
|
||||
}
|
||||
|
||||
None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue