ThrowException .-.

This commit is contained in:
vegowotenks 2024-11-07 14:41:00 +01:00
parent 45d0aa66e5
commit 6b03cab14d
4 changed files with 14 additions and 5 deletions

View file

@ -194,7 +194,7 @@ impl JavaClassFile {
pub fn find_method_index(&self, name: &String) -> Option<usize> {
for (index, method_info) in self.methods.iter().enumerate() {
for (index, method_info) in (&self.methods).into_iter().enumerate() {
if method_info.name == *name {
return Some(index);
}
@ -377,7 +377,7 @@ impl JavaClassFile {
}
pub fn sourcefile(&self) -> Result<Option<&String>, Error> {
match self.attributes.into_iter()
match (&self.attributes).into_iter()
.filter_map(|attribute| match &attribute.data {
AttributeData::SourceFile(data) => Some(data),
_ => None,
@ -1103,7 +1103,7 @@ impl MethodInfo {
pub fn get_bytecode_linenumber(&self, bytecode_index: u16) -> Option<u16> {
let linenumbertable = match self.attributes
.into_iter()
.iter()
.filter_map(|a| match &a.data {
AttributeData::LineNumberTable(data) => Some(data),
_ => None,
@ -1112,7 +1112,7 @@ impl MethodInfo {
Some(a) => a,
None => return None,
};
linenumbertable.entries.into_iter()
linenumbertable.entries.iter()
.take_while(|entry| entry.start_pc < bytecode_index)
.map(|entry| entry.line_number)
.last()