refactor: order of functions in link expression (#1583)

This commit is contained in:
Myriad-Dreamin 2025-03-26 14:13:50 +08:00 committed by GitHub
parent e4a4fc568f
commit ee1c0ace46
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -23,6 +23,24 @@ pub fn get_link_exprs_in(node: &LinkedNode) -> Option<LinkInfo> {
Some(worker.info)
}
/// Link information in a source file.
#[derive(Debug, Default)]
pub struct LinkInfo {
/// The link objects in a source file.
pub objects: Vec<LinkObject>,
}
/// A link object in a source file.
#[derive(Debug)]
pub struct LinkObject {
/// The range of the link expression.
pub range: Range<usize>,
/// The span of the link expression.
pub span: Span,
/// The target of the link.
pub target: LinkTarget,
}
/// A valid link target.
#[derive(Debug)]
pub enum LinkTarget {
@ -48,24 +66,6 @@ impl LinkTarget {
}
}
/// A link object in a source file.
#[derive(Debug)]
pub struct LinkObject {
/// The range of the link expression.
pub range: Range<usize>,
/// The span of the link expression.
pub span: Span,
/// The target of the link.
pub target: LinkTarget,
}
/// Link information in a source file.
#[derive(Debug, Default)]
pub struct LinkInfo {
/// The link objects in a source file.
pub objects: Vec<LinkObject>,
}
struct LinkStrWorker {
info: LinkInfo,
}