mirror of
https://github.com/fluencelabs/marine-rs-sdk-test
synced 2024-12-04 23:30:18 +00:00
fix issue with Vec<u8> ident
This commit is contained in:
parent
413df12776
commit
4b80f36454
@ -170,24 +170,28 @@ impl ParsedType {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_text_type(&self) -> String {
|
||||
pub fn to_token_stream(&self) -> proc_macro2::TokenStream {
|
||||
use quote::quote;
|
||||
|
||||
match self {
|
||||
ParsedType::I8 => "i8",
|
||||
ParsedType::I16 => "i16",
|
||||
ParsedType::I32 => "i32",
|
||||
ParsedType::I64 => "i64",
|
||||
ParsedType::U8 => "u8",
|
||||
ParsedType::U16 => "u16",
|
||||
ParsedType::U32 => "u32",
|
||||
ParsedType::U64 => "u64",
|
||||
ParsedType::F32 => "f32",
|
||||
ParsedType::F64 => "f64",
|
||||
ParsedType::Boolean => "bool",
|
||||
ParsedType::Utf8String => "String",
|
||||
ParsedType::ByteVector => "Vec<u8>",
|
||||
ParsedType::Record(name) => name,
|
||||
ParsedType::I8 => quote! { i8 },
|
||||
ParsedType::I16 => quote! { i16 },
|
||||
ParsedType::I32 => quote! { i32 },
|
||||
ParsedType::I64 => quote! { i64 },
|
||||
ParsedType::U8 => quote! { u8 },
|
||||
ParsedType::U16 => quote! { u16 },
|
||||
ParsedType::U32 => quote! { u32 },
|
||||
ParsedType::U64 => quote! { u64 },
|
||||
ParsedType::F32 => quote! { f32 },
|
||||
ParsedType::F64 => quote! { f64 },
|
||||
ParsedType::Boolean => quote! { bool },
|
||||
ParsedType::Utf8String => quote! { String },
|
||||
ParsedType::ByteVector => quote! { Vec<u8> },
|
||||
ParsedType::Record(name) => {
|
||||
let ty = crate::new_ident!(name);
|
||||
quote! { #ty }
|
||||
}
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
pub fn is_complex_type(&self) -> bool {
|
||||
|
@ -31,7 +31,7 @@ impl ForeignModEpilogGlueCodeGenerator for Option<ParsedType> {
|
||||
fn generate_wrapper_return_type(&self) -> proc_macro2::TokenStream {
|
||||
match self {
|
||||
Some(ty) => {
|
||||
let ty = new_ident!(ty.to_text_type());
|
||||
let ty = ty.to_token_stream();
|
||||
quote! { -> #ty }
|
||||
}
|
||||
None => quote!(),
|
||||
|
@ -56,11 +56,10 @@ pub(crate) trait ForeignModPrologGlueCodeGenerator {
|
||||
impl ForeignModPrologGlueCodeGenerator for Vec<ParsedType> {
|
||||
fn generate_wrapper_prolog(&self) -> WrapperDescriptor {
|
||||
use crate::parsed_type::foreign_mod_arg::ForeignModArgGlueCodeGenerator;
|
||||
use quote::ToTokens;
|
||||
|
||||
let arg_types: Vec<proc_macro2::TokenStream> = self
|
||||
.iter()
|
||||
.map(|input_type| new_ident!(input_type.to_text_type()).to_token_stream())
|
||||
.map(|input_type| input_type.to_token_stream())
|
||||
.collect();
|
||||
|
||||
let arg_names: Vec<syn::Ident> = arg_types
|
||||
|
Loading…
Reference in New Issue
Block a user