Skip to content

Commit

Permalink
Merge pull request #62 from Y-Nak/update-dependencies
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
Y-Nak authored Sep 13, 2024
2 parents 3a20de6 + c14f080 commit 52a24da
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion crates/interpreter/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl EvalValue {
Type::I32 => to_be_bytes!(4),
Type::I64 => to_be_bytes!(8),
Type::I128 => to_be_bytes!(16),
Type::I256 => self.i256().to_u256().to_big_endian(buff),
Type::I256 => self.i256().to_u256().write_as_big_endian(buff),
Type::Compound(ty) => {
debug_assert!(ctx.with_ty_store(|s| s.resolve_compound(ty).is_ptr()));
to_be_bytes!(mem::size_of::<usize>());
Expand Down
2 changes: 1 addition & 1 deletion crates/ir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ keywords = ["compiler", "evm", "wasm", "smart-contract"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
primitive-types = { version = "0.12", default-features = false }
primitive-types = { version = "0.13", default-features = false }
cranelift-entity = "0.111"
smallvec = "1.7.0"
rustc-hash = "2.0.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ keywords = ["compiler", "evm", "wasm", "smart-contract"]
proc-macro = true

[dependencies]
syn = { version = "1.0", features = ["full"] }
syn = { version = "2.0", features = ["full"] }
proc-macro2 = "1.0"
quote = "1.0"
4 changes: 2 additions & 2 deletions crates/macros/src/inst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl InstStruct {
let mut has_side_effect = false;

for attr in &item_struct.attrs {
if attr.path.is_ident("inst") {
if attr.path().is_ident("inst") {
let meta = attr.parse_args::<syn::Meta>()?;
if let syn::Meta::Path(path) = meta {
if path.is_ident("has_side_effect") {
Expand Down Expand Up @@ -107,7 +107,7 @@ impl InstStruct {
}

for attr in &field.attrs {
if attr.path.is_ident("inst") {
if attr.path().is_ident("inst") {
let meta = attr.parse_args::<syn::Meta>()?;
if let syn::Meta::Path(path) = meta {
if path.is_ident("value") {
Expand Down
28 changes: 15 additions & 13 deletions crates/macros/src/inst_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ pub fn define_inst_set(
attr: proc_macro::TokenStream,
item: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
let attr_args = syn::parse_macro_input!(attr as syn::AttributeArgs);
let arg = syn::parse_macro_input!(attr as syn::Meta);
let item_struct = syn::parse_macro_input!(item as syn::ItemStruct);

match InstSet::new(attr_args, item_struct).and_then(InstSet::build) {
match InstSet::new(arg, item_struct).and_then(InstSet::build) {
Ok(impls) => quote! {
#impls
}
Expand All @@ -28,11 +28,11 @@ struct InstSet {
}

impl InstSet {
fn new(args: Vec<syn::NestedMeta>, s: syn::ItemStruct) -> syn::Result<Self> {
fn new(arg: syn::Meta, s: syn::ItemStruct) -> syn::Result<Self> {
let ident = s.ident;
let vis = s.vis;
let insts = Self::parse_insts(&s.fields)?;
let inst_kind_ident = Self::parse_inst_kind_name(&args)?;
let inst_kind_ident = Self::parse_inst_kind_name(arg)?;
let inst_kind_mut_ident = quote::format_ident!("{inst_kind_ident}Mut");

Ok(Self {
Expand Down Expand Up @@ -66,29 +66,31 @@ impl InstSet {
})
}

fn parse_inst_kind_name(args: &[syn::NestedMeta]) -> syn::Result<syn::Ident> {
fn parse_inst_kind_name(args: syn::Meta) -> syn::Result<syn::Ident> {
let make_err = || {
Err(syn::Error::new(
proc_macro2::Span::call_site(),
"`#[inst_set(InstKind = \"{InstKindName}\")]` is required",
))
};

if args.len() != 1 {
return make_err();
}

let syn::NestedMeta::Meta(syn::Meta::NameValue(name_value)) = &args[0] else {
let syn::Meta::NameValue(name_value) = args else {
return make_err();
};

let inst_kind_name = match (name_value.path.get_ident(), &name_value.lit) {
(Some(ident), syn::Lit::Str(s)) if ident == "InstKind" => s.value(),
let inst_kind_name = match (name_value.path.get_ident(), &name_value.value) {
(Some(ident), syn::Expr::Lit(lit)) if ident == "InstKind" => {
if let syn::Lit::Str(s) = &lit.lit {
s
} else {
return make_err();
}
}
_ => return make_err(),
};

Ok(syn::Ident::new(
&inst_kind_name,
&inst_kind_name.value(),
proc_macro2::Span::call_site(),
))
}
Expand Down

0 comments on commit 52a24da

Please sign in to comment.