start refactor inst struct

This commit is contained in:
Jean-Marie Mineau 2024-07-10 18:45:31 +02:00
parent c3a7762fc8
commit af24c7070a
Signed by: histausse
GPG key ID: B66AEEDA9B645AD2
2 changed files with 1205 additions and 389 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,8 @@
//! The visitor trait and common implementations. //! The visitor trait and common implementations.
use crate::{ use crate::{
ins::Instruction, DexString, IdEnum, IdField, IdMethod, IdMethodType, IdType, MethodHandle, ins::Instruction, CallSite, DexString, IdEnum, IdField, IdMethod, IdMethodType, IdType,
Result, MethodHandle, Result,
}; };
use std::collections::HashSet; use std::collections::HashSet;
@ -31,6 +31,9 @@ pub trait Visitor: Sized {
fn visit_method_handle(&mut self, handle: &MethodHandle) -> Result<()> { fn visit_method_handle(&mut self, handle: &MethodHandle) -> Result<()> {
handle.default_visit(self) handle.default_visit(self)
} }
fn visit_call_site(&mut self, site: &CallSite) -> Result<()> {
site.default_visit(self)
}
} }
pub trait VisitorMut: Sized { pub trait VisitorMut: Sized {
@ -58,6 +61,9 @@ pub trait VisitorMut: Sized {
fn visit_method_handle(&mut self, handle: MethodHandle) -> Result<MethodHandle> { fn visit_method_handle(&mut self, handle: MethodHandle) -> Result<MethodHandle> {
handle.default_visit_mut(self) handle.default_visit_mut(self)
} }
fn visit_call_site(&mut self, site: CallSite) -> Result<CallSite> {
site.default_visit_mut(self)
}
} }
/// Trait for structures that can be visited. /// Trait for structures that can be visited.