Skip to content

Commit

Permalink
chore(sol-macro): tweak inline attributes in generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Jan 28, 2024
1 parent d9679f4 commit 4231a75
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/sol-macro/src/expand/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,17 @@ pub(super) fn expand(cx: &ExpCtxt<'_>, function: &ItemFunction) -> Result<TokenS
const SIGNATURE: &'static str = #signature;
const SELECTOR: [u8; 4] = #selector;

#[inline]
fn new<'a>(tuple: <Self::Parameters<'a> as ::alloy_sol_types::SolType>::RustType) -> Self {
tuple.into()
}

#[inline]
fn tokenize(&self) -> Self::Token<'_> {
#tokenize_impl
}

#[inline]
fn abi_decode_returns(data: &[u8], validate: bool) -> ::alloy_sol_types::Result<Self::Return> {
<Self::ReturnTuple<'_> as ::alloy_sol_types::SolType>::abi_decode_sequence(data, validate).map(Into::into)
}
Expand Down
2 changes: 2 additions & 0 deletions crates/sol-macro/src/expand/struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ pub(super) fn expand(cx: &ExpCtxt<'_>, s: &ItemStruct) -> Result<TokenStream> {

#eip712_encode_type_fns

#[inline]
fn eip712_encode_data(&self) -> ::alloy_sol_types::private::Vec<u8> {
#encode_data_impl
}
Expand Down Expand Up @@ -238,6 +239,7 @@ fn expand_encode_type_fns(
::alloy_sol_types::private::Cow::Borrowed(#root)
}

#[inline]
fn eip712_components() -> ::alloy_sol_types::private::Vec<::alloy_sol_types::private::Cow<'static, str>> {
#components_impl
}
Expand Down

0 comments on commit 4231a75

Please sign in to comment.