mirror of
https://github.com/fluencelabs/marine-rs-sdk-test
synced 2024-12-04 15:20:18 +00:00
fix merge
This commit is contained in:
parent
16d0210531
commit
bed5a8505b
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "fce-timestamp-macro"
|
||||
version = "0.5.0" # remember to update html_root_url
|
||||
version = "0.6.0" # remember to update html_root_url
|
||||
edition = "2018"
|
||||
description = "Definition of the `#[build_timestamp]` macro"
|
||||
repository = "https://github.com/fluencelabs/rust-sdk/crates/timestamp-macro"
|
||||
|
@ -129,20 +129,17 @@ fn generate_type_lifting_prolog(
|
||||
let #type_modifier #converted_arg_ident = String::from_raw_parts(#ptr as _, #size as _ , #size as _);
|
||||
},
|
||||
ParsedType::Vector(ty, _) => {
|
||||
let generated_deserializer_name =
|
||||
format!("__fce_generated_vec_deserializer_{}", supplied_arg_start_id)
|
||||
.replace("&", "_")
|
||||
.replace("<", "_")
|
||||
.replace(">", "_");
|
||||
let generated_deserializer_ident = new_ident!(generated_deserializer_name);
|
||||
let vector_deserializer = super::vector_utils::generate_vector_deserializer(
|
||||
ty,
|
||||
&generated_deserializer_name,
|
||||
);
|
||||
let generated_der_name =
|
||||
format!("__fce_generated_vec_deserializer_{}", supplied_arg_start_id);
|
||||
let generated_der_name = crate::utils::prepare_ident(generated_der_name);
|
||||
let generated_der_ident = new_ident!(generated_der_name);
|
||||
|
||||
let vector_deserializer =
|
||||
super::vector_utils::generate_vector_deserializer(ty, &generated_der_name);
|
||||
|
||||
quote! {
|
||||
#vector_deserializer
|
||||
let #type_modifier #converted_arg_ident = #generated_deserializer_ident(#ptr as _, #size as _);
|
||||
let #type_modifier #converted_arg_ident = #generated_der_ident(#ptr as _, #size as _);
|
||||
}
|
||||
}
|
||||
ParsedType::Record(record_name, _) => {
|
||||
|
@ -82,15 +82,16 @@ impl ForeignModPrologGlueCodeGenerator for Vec<AstFnArgument> {
|
||||
arg_drops.extend(quote::quote! { std::mem::ManuallyDrop::drop(&mut #arg_ident); });
|
||||
},
|
||||
ParsedType::Vector(ty, passing_style) => {
|
||||
let generated_serializer_name = format!("__fce_generated_vec_serializer_{}", arg_name).replace("&<>", "_");
|
||||
let generated_ser_name = format!("__fce_generated_vec_serializer_{}", arg_name);
|
||||
let generated_ser_name = crate::utils::prepare_ident(generated_ser_name);
|
||||
let generated_ser_ident = new_ident!(generated_ser_name);
|
||||
|
||||
let generated_serializer_ident = new_ident!(generated_serializer_name);
|
||||
let vector_serializer = super::vector_utils::generate_vector_serializer(ty, *passing_style, &generated_serializer_name);
|
||||
let vector_serializer = super::vector_utils::generate_vector_serializer(ty, *passing_style, &generated_ser_name);
|
||||
|
||||
let arg_transform = quote::quote! {
|
||||
#vector_serializer
|
||||
|
||||
let #arg_ident = #generated_serializer_ident(&#arg_ident);
|
||||
let #arg_ident = #generated_ser_ident(&#arg_ident);
|
||||
};
|
||||
arg_transforms.extend(arg_transform);
|
||||
|
||||
|
@ -95,13 +95,12 @@ pub(crate) fn generate_vector_serializer(
|
||||
}
|
||||
}
|
||||
ParsedType::Vector(ty, passing_style) => {
|
||||
let serializer_name = format!("{}_{}", arg_name, ty)
|
||||
.replace("<", "_")
|
||||
.replace(">", "_")
|
||||
.replace("&", "_");
|
||||
let serializer_name = format!("{}_{}", arg_name, ty);
|
||||
let serializer_name = crate::utils::prepare_ident(serializer_name);
|
||||
let serializer_ident = crate::new_ident!(serializer_name);
|
||||
|
||||
let inner_vector_serializer =
|
||||
generate_vector_serializer(&*ty, *passing_style, &serializer_name);
|
||||
let serializer_ident = crate::new_ident!(serializer_name);
|
||||
|
||||
quote! {
|
||||
#inner_vector_serializer
|
||||
@ -198,13 +197,12 @@ pub(crate) fn generate_vector_deserializer(
|
||||
}
|
||||
}
|
||||
ParsedType::Vector(ty, _) => {
|
||||
let deserializer_name = format!("{}_{}", arg_name, ty)
|
||||
.replace("&", "_")
|
||||
.replace("<", "_")
|
||||
.replace(">", "_");
|
||||
let inner_vector_deserializer = generate_vector_deserializer(&*ty, &deserializer_name);
|
||||
let deserializer_name = format!("{}_{}", arg_name, ty);
|
||||
let deserializer_name = crate::utils::prepare_ident(deserializer_name);
|
||||
let deserializer_ident = crate::new_ident!(deserializer_name);
|
||||
|
||||
let inner_vector_deserializer = generate_vector_deserializer(&*ty, &deserializer_name);
|
||||
|
||||
quote! {
|
||||
#inner_vector_deserializer
|
||||
|
||||
|
@ -105,11 +105,11 @@ impl RecordDeserializerGlueCodeGenerator for fce_ast_types::AstRecordItem {
|
||||
}
|
||||
ParsedType::Vector(ty, _) => {
|
||||
let generated_deserializer_name =
|
||||
format!("__fce_generated_vec_deserializer_{}", value_id)
|
||||
.replace("&", "_")
|
||||
.replace("<", "_")
|
||||
.replace(">", "_");
|
||||
format!("__fce_generated_vec_deserializer_{}", value_id);
|
||||
let generated_deserializer_name =
|
||||
crate::utils::prepare_ident(generated_deserializer_name);
|
||||
let generated_deserializer_ident = new_ident!(generated_deserializer_name);
|
||||
|
||||
let vector_deserializer = crate::parsed_type::generate_vector_deserializer(
|
||||
ty,
|
||||
&generated_deserializer_name,
|
||||
|
@ -71,3 +71,14 @@ pub fn get_record_size<'a>(
|
||||
|
||||
size
|
||||
}
|
||||
|
||||
pub(crate) fn prepare_ident(str: String) -> String {
|
||||
str.chars()
|
||||
.map(|c| match c {
|
||||
'<' => '_',
|
||||
'&' => '_',
|
||||
'>' => '_',
|
||||
c => c,
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user