From 1acd400d897b546170acc20901013a385265a213 Mon Sep 17 00:00:00 2001 From: Tilak Madichetti Date: Fri, 18 Oct 2024 23:09:42 +0530 Subject: [PATCH] Update `.is_constructor` -> `.kind() == &FunctionKind::Constructor` for broader version compatiblity (#773) --- aderyn_core/src/detect/high/multiple_constructors.rs | 4 ++-- aderyn_core/src/detect/low/dead_code.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aderyn_core/src/detect/high/multiple_constructors.rs b/aderyn_core/src/detect/high/multiple_constructors.rs index e24d576e..2dbfd79d 100644 --- a/aderyn_core/src/detect/high/multiple_constructors.rs +++ b/aderyn_core/src/detect/high/multiple_constructors.rs @@ -1,6 +1,6 @@ use std::{collections::BTreeMap, error::Error}; -use crate::ast::NodeID; +use crate::ast::{FunctionKind, NodeID}; use crate::{ capture, @@ -25,7 +25,7 @@ impl IssueDetector for MultipleConstructorsDetector { ExtractFunctionDefinitions::from(contract) .extracted .iter() - .filter(|function| function.is_constructor) + .filter(|function| function.kind() == &FunctionKind::Constructor) .count() > 1 }) diff --git a/aderyn_core/src/detect/low/dead_code.rs b/aderyn_core/src/detect/low/dead_code.rs index 5cc428d8..7297edc4 100644 --- a/aderyn_core/src/detect/low/dead_code.rs +++ b/aderyn_core/src/detect/low/dead_code.rs @@ -1,6 +1,6 @@ use std::{collections::BTreeMap, error::Error}; -use crate::ast::{ASTNode, ContractKind, NodeID, NodeType, Visibility}; +use crate::ast::{ASTNode, ContractKind, FunctionKind, NodeID, NodeType, Visibility}; use crate::{ capture, @@ -34,7 +34,7 @@ impl IssueDetector for DeadCodeDetector { f.overrides.is_none() && f.implemented && f.visibility == Visibility::Internal - && !f.is_constructor + && f.kind() != &FunctionKind::Constructor }) .filter(|&f| { if let Some(ASTNode::ContractDefinition(contract)) =