Skip to content

Commit

Permalink
fix(libs/references): try fix function params getter from spi
Browse files Browse the repository at this point in the history
  • Loading branch information
0xSwapFeeder committed Apr 16, 2024
1 parent a75f296 commit 86549ed
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libs/references/src/scope_finder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::vec;
use crate::types::InteractableNode;
use crate::utils::is_node_in_range;
use crate::Position;
use osmium_libs_solidity_ast_extractor::kw::is;
use solc_ast_rs_types::types::*;
use solc_ast_rs_types::visit;
use solc_ast_rs_types::visit::*;
Expand Down Expand Up @@ -65,6 +66,17 @@ impl<'ast> Visit<'ast> for ScopeFinder {
}
}

fn visit_function_definition(&mut self, function: &'ast FunctionDefinition) {
if is_node_in_range(&function.src, &self.position, &self.source) {
self.spi.push(InteractableNode::FunctionDefinition(function.clone()));
}
else if let Some(body) = &function.body {
if is_node_in_range(&body.src, &self.position, &self.source) {
self.spi.push(InteractableNode::Block(body.clone()));
}
}
}

fn visit_try(&mut self, r#try: &'ast TryStatement) {
if is_node_in_range(&r#try.src, &self.position, &self.source) {
self.spi.push(InteractableNode::TryStatement(r#try.clone()));
Expand Down

0 comments on commit 86549ed

Please sign in to comment.