linting cleanup
This commit is contained in:
parent
08149329e1
commit
211605c20c
42
src/lib.rs
42
src/lib.rs
|
@ -22,7 +22,6 @@ pub mod sdk {
|
|||
};
|
||||
|
||||
use anyhow::Context;
|
||||
use itertools::any;
|
||||
use rayon::prelude::{IntoParallelRefIterator, ParallelIterator};
|
||||
|
||||
use crate::{
|
||||
|
@ -35,8 +34,8 @@ pub mod sdk {
|
|||
UObjectPropertyBaseTrait, UObjectTrait, UPropertyTrait, UStructNonConst,
|
||||
UStructPropertyTrait, UStructTrait,
|
||||
},
|
||||
AnyProp, EFunctionFlags, EPropertyFlags, UAnyType, UClass, UEnum, UFunction, UObject,
|
||||
UProperty, UScriptStruct, UStruct,
|
||||
EFunctionFlags, EPropertyFlags, UAnyType, UClass, UEnum, UFunction, UObject,
|
||||
UScriptStruct, UStruct,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -45,17 +44,12 @@ pub mod sdk {
|
|||
}
|
||||
|
||||
impl ClassCache {
|
||||
#[allow(dead_code)]
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
classes: Mutex::new(HashMap::new()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cache_class(&self, class: UClass) -> anyhow::Result<()> {
|
||||
let name = class.get_full_name()?;
|
||||
self.classes.lock().unwrap().insert(name, class);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl FindClass for ClassCache {
|
||||
|
@ -89,8 +83,7 @@ pub mod sdk {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct Package<'a> {
|
||||
sdk: &'a Sdk,
|
||||
pub struct Package {
|
||||
package: UObject,
|
||||
objects: Vec<UObject>,
|
||||
dependencies: Vec<UObject>,
|
||||
|
@ -103,10 +96,9 @@ pub mod sdk {
|
|||
pub package_dependencies: Vec<UObject>,
|
||||
}
|
||||
|
||||
impl<'a> Package<'a> {
|
||||
pub fn new(sdk: &'a Sdk, package: UObject, objects: Vec<UObject>) -> Self {
|
||||
impl Package {
|
||||
pub fn new(package: UObject, objects: Vec<UObject>) -> Self {
|
||||
Self {
|
||||
sdk,
|
||||
package,
|
||||
objects,
|
||||
dependencies: Vec::new(),
|
||||
|
@ -168,7 +160,7 @@ pub mod sdk {
|
|||
|
||||
let super_struct = if let Some(spr) = *strct.super_field() && spr != strct {
|
||||
if spr.package_object() != self.package {
|
||||
log::info!("encountered external dependency");
|
||||
log::warn!("encountered external dependency");
|
||||
// TODO: return dependency on strct.package_object()
|
||||
}
|
||||
Some(spr)
|
||||
|
@ -178,6 +170,7 @@ pub mod sdk {
|
|||
|
||||
Ok(Class {
|
||||
is_class,
|
||||
size: *strct.property_size() as u32,
|
||||
name,
|
||||
super_class: super_struct,
|
||||
fields,
|
||||
|
@ -303,7 +296,7 @@ pub mod sdk {
|
|||
&self,
|
||||
strct: UStruct,
|
||||
) -> anyhow::Result<(Vec<ClassField>, Vec<ClassMethod>)> {
|
||||
log::info!("{} children:", strct.get_full_name_or_default());
|
||||
log::debug!("{} children:", strct.get_full_name_or_default());
|
||||
|
||||
let mut fields = Vec::new();
|
||||
let mut methods = Vec::new();
|
||||
|
@ -316,7 +309,7 @@ pub mod sdk {
|
|||
any_type::AnyField::Property(prop) => {
|
||||
match Self::find_type(any_type::AnyProperty::from_prop(prop)) {
|
||||
Ok(ty) => {
|
||||
log::info!("field: {ty:?}: {prop}");
|
||||
log::debug!("field: {ty:?}: {prop}");
|
||||
fields.push(
|
||||
ClassField {
|
||||
offset: *prop.offset() as u32,
|
||||
|
@ -331,7 +324,7 @@ pub mod sdk {
|
|||
}
|
||||
},
|
||||
strt @ any_type::AnyField::Struct(_) if let Some(any_type::AnyStruct::Function(func)) = strt.as_any_struct() => {
|
||||
log::info!("function: {func}");
|
||||
log::debug!("function: {func}");
|
||||
|
||||
if let Ok(method) = Self::process_function(func) {
|
||||
methods.push(method);
|
||||
|
@ -367,7 +360,7 @@ pub mod sdk {
|
|||
any_type::AnyField::Property(prop) => {
|
||||
match Self::find_type(any_type::AnyProperty::from_prop(prop)) {
|
||||
Ok(ty) => {
|
||||
log::info!("field: {ty:?}: {prop}");
|
||||
log::debug!("field: {ty:?}: {prop}");
|
||||
if let Some(kind) = if prop
|
||||
.property_flags()
|
||||
.contains(EPropertyFlags::ReturnParm)
|
||||
|
@ -473,15 +466,11 @@ pub mod sdk {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct Sdk {
|
||||
cache: ClassCache,
|
||||
}
|
||||
pub struct Sdk {}
|
||||
|
||||
impl Sdk {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
cache: ClassCache::new(),
|
||||
}
|
||||
Self {}
|
||||
}
|
||||
|
||||
pub fn package_objects(&self) -> Vec<Package> {
|
||||
|
@ -512,7 +501,7 @@ pub mod sdk {
|
|||
|
||||
sorted_objects
|
||||
.into_iter()
|
||||
.map(|(package, objects)| Package::new(self, package, objects))
|
||||
.map(|(package, objects)| Package::new(package, objects))
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
}
|
||||
|
@ -692,6 +681,7 @@ pub mod sdk {
|
|||
#[derive(Debug)]
|
||||
pub struct Class {
|
||||
pub is_class: bool,
|
||||
pub size: u32,
|
||||
pub name: String,
|
||||
pub super_class: Option<UStruct>,
|
||||
pub fields: Vec<ClassField>,
|
||||
|
|
Loading…
Reference in a new issue