Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata processing improvements #2598

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/libs/metadata/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ impl MethodAttributes {
pub const Virtual: Self = Self(0x40);
}

flags!(MethodImplAttributes, usize);
flags!(MethodImplAttributes, u16);
impl MethodImplAttributes {
pub const PreserveSig: Self = Self(0x80);
}

// These are not really ECMA-335 attributes but instead the flags found in the method signature.
flags!(MethodCallAttributes, u8);
impl MethodCallAttributes {
pub const HASTHIS: Self = Self(0x20);
Expand Down
14 changes: 9 additions & 5 deletions crates/libs/metadata/src/file/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ pub trait RowReader<'a> {
// GenericParam
//

fn generic_param_number(&self, row: GenericParam) -> u16 {
self.row_usize(row, 0) as u16
}

fn generic_param_name(&self, row: GenericParam) -> &'a str {
self.row_str(row, 3)
}
Expand Down Expand Up @@ -212,7 +216,7 @@ pub trait RowReader<'a> {
//

fn method_def_impl_flags(&self, row: MethodDef) -> MethodImplAttributes {
MethodImplAttributes(self.row_usize(row, 1))
MethodImplAttributes(self.row_usize(row, 1) as u16)
}

fn method_def_flags(&self, row: MethodDef) -> MethodAttributes {
Expand Down Expand Up @@ -268,8 +272,8 @@ pub trait RowReader<'a> {
ParamAttributes(self.row_usize(row, 0) as u16)
}

fn param_sequence(&self, row: Param) -> usize {
self.row_usize(row, 1)
fn param_sequence(&self, row: Param) -> u16 {
self.row_usize(row, 1) as u16
}

fn param_name(&self, row: Param) -> &'a str {
Expand Down Expand Up @@ -307,8 +311,8 @@ pub trait RowReader<'a> {
self.row_list(row, 4)
}

fn type_def_generics(&self, row: TypeDef) -> Vec<Type> {
self.row_equal_range(row, 2, TypeOrMethodDef::TypeDef(row).encode()).map(Type::GenericParam).collect()
fn type_def_generics(&self, row: TypeDef) -> RowIterator<GenericParam> {
self.row_equal_range(row, 2, TypeOrMethodDef::TypeDef(row).encode())
}

fn type_def_interface_impls(&self, row: TypeDef) -> RowIterator<InterfaceImpl> {
Expand Down
Loading