rename ROOT -> SOURCE_FILE

This commit is contained in:
Aleksey Kladov 2018-11-07 18:38:43 +03:00
parent f8b36bbc3b
commit 2ed1514df3
185 changed files with 235 additions and 236 deletions

View file

@ -61,9 +61,8 @@ pub use crate::{
use crate::yellow::GreenNode;
// TODO: pick a single name for everything. SourceFileNode maybe?
/// File represents a parse tree for a single Rust file.
pub type SourceFileNode = ast::RootNode;
/// `SourceFileNode` represents a parse tree for a single Rust file.
pub use crate::ast::SourceFileNode;
impl SourceFileNode {
fn new(green: GreenNode, errors: Vec<SyntaxError>) -> SourceFileNode {
@ -71,8 +70,8 @@ impl SourceFileNode {
if cfg!(debug_assertions) {
utils::validate_block_structure(root.borrowed());
}
assert_eq!(root.kind(), SyntaxKind::ROOT);
ast::RootNode { syntax: root }
assert_eq!(root.kind(), SyntaxKind::SOURCE_FILE);
ast::SourceFileNode { syntax: root }
}
pub fn parse(text: &str) -> SourceFileNode {
let tokens = tokenize(&text);
@ -94,7 +93,7 @@ impl SourceFileNode {
SourceFileNode::parse(&text)
}
/// Typed AST representation of the parse tree.
pub fn ast(&self) -> ast::Root {
pub fn ast(&self) -> ast::SourceFile {
self.borrowed()
}
/// Untyped homogeneous representation of the parse tree.