mirror of
https://github.com/VHDL-LS/rust_hdl.git
synced 2025-12-23 06:01:10 +00:00
Implement search and visitor
This commit is contained in:
parent
037ec90b25
commit
b04e58b69f
2 changed files with 29 additions and 2 deletions
|
|
@ -1183,6 +1183,7 @@ impl Search for ProcedureSpecification {
|
|||
return_if_found!(searcher
|
||||
.search_decl(ctx, FoundDeclaration::Procedure(self))
|
||||
.or_not_found());
|
||||
return_if_found!(self.header.search(ctx, searcher));
|
||||
self.parameter_list.search(ctx, searcher)
|
||||
}
|
||||
}
|
||||
|
|
@ -1192,11 +1193,19 @@ impl Search for FunctionSpecification {
|
|||
return_if_found!(searcher
|
||||
.search_decl(ctx, FoundDeclaration::Function(self))
|
||||
.or_not_found());
|
||||
return_if_found!(self.header.search(ctx, searcher));
|
||||
return_if_found!(self.parameter_list.search(ctx, searcher));
|
||||
self.return_type.search(ctx, searcher)
|
||||
}
|
||||
}
|
||||
|
||||
impl Search for SubprogramHeader {
|
||||
fn search(&mut self, ctx: &dyn TokenAccess, searcher: &mut impl Searcher) -> SearchResult {
|
||||
return_if_found!(self.generic_list.search(ctx, searcher));
|
||||
self.map_aspect.search(ctx, searcher)
|
||||
}
|
||||
}
|
||||
|
||||
impl Search for LibraryClause {
|
||||
fn search(&mut self, ctx: &dyn TokenAccess, searcher: &mut impl Searcher) -> SearchResult {
|
||||
for name in self.name_list.items.iter_mut() {
|
||||
|
|
|
|||
|
|
@ -309,6 +309,14 @@ pub trait Visitor {
|
|||
) -> VisitorResult {
|
||||
Continue
|
||||
}
|
||||
|
||||
fn visit_subprogram_header(
|
||||
&mut self,
|
||||
_node: &SubprogramHeader,
|
||||
_ctx: &dyn TokenAccess,
|
||||
) -> VisitorResult {
|
||||
Continue
|
||||
}
|
||||
fn visit_signature(&mut self, _node: &Signature, _ctx: &dyn TokenAccess) -> VisitorResult {
|
||||
Continue
|
||||
}
|
||||
|
|
@ -1255,6 +1263,16 @@ impl ASTNode for SubprogramBody {
|
|||
}
|
||||
}
|
||||
|
||||
impl ASTNode for SubprogramHeader {
|
||||
fn visit(&self, visitor: &mut dyn Visitor, ctx: &dyn TokenAccess) -> VisitorResult {
|
||||
visitor.visit_subprogram_header(self, ctx)
|
||||
}
|
||||
|
||||
fn children(&self) -> Vec<&dyn ASTNode> {
|
||||
vec![&self.map_aspect, &self.generic_list]
|
||||
}
|
||||
}
|
||||
|
||||
impl ASTNode for LabeledSequentialStatement {
|
||||
fn visit(&self, visitor: &mut dyn Visitor, ctx: &dyn TokenAccess) -> VisitorResult {
|
||||
visitor.visit_labeled_sequential_statement(self, ctx)
|
||||
|
|
@ -1592,7 +1610,7 @@ impl ASTNode for FunctionSpecification {
|
|||
}
|
||||
|
||||
fn children(&self) -> Vec<&dyn ASTNode> {
|
||||
vec![&self.parameter_list, &self.return_type]
|
||||
vec![&self.parameter_list, &self.header, &self.return_type]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1602,7 +1620,7 @@ impl ASTNode for ProcedureSpecification {
|
|||
}
|
||||
|
||||
fn children(&self) -> Vec<&dyn ASTNode> {
|
||||
vec![&self.designator, &self.parameter_list]
|
||||
vec![&self.designator, &self.header, &self.parameter_list]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue