mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-06 09:31:28 +00:00
Remove wrong types conversion from js to rust
We can revisit this when we have better tests.
This commit is contained in:
parent
1ea2d95d9e
commit
d6ec2289fc
@ -67,11 +67,9 @@ fn parse_json(file_name: &str) -> TsPackage {
|
|||||||
|
|
||||||
fn build_function(name: String, parameters: HashMap<String, TsMethodProperty>, return_value: TsReturnValue) -> Function {
|
fn build_function(name: String, parameters: HashMap<String, TsMethodProperty>, return_value: TsReturnValue) -> Function {
|
||||||
let arguments = parameters.iter().map( |(_name, property)| {
|
let arguments = parameters.iter().map( |(_name, property)| {
|
||||||
let property_type = rust_type(&property.property_type);
|
|
||||||
|
|
||||||
let mut segments = syn::punctuated::Punctuated::new();
|
let mut segments = syn::punctuated::Punctuated::new();
|
||||||
segments.push(syn::PathSegment {
|
segments.push(syn::PathSegment {
|
||||||
ident: syn::Ident::new(property_type, proc_macro2::Span::call_site()),
|
ident: syn::Ident::new(&property.property_type, proc_macro2::Span::call_site()),
|
||||||
arguments: syn::PathArguments::None,
|
arguments: syn::PathArguments::None,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -84,11 +82,9 @@ fn build_function(name: String, parameters: HashMap<String, TsMethodProperty>, r
|
|||||||
})
|
})
|
||||||
}).collect::<Vec<_>>();
|
}).collect::<Vec<_>>();
|
||||||
|
|
||||||
let ret_property_type = rust_type(&return_value.property_type);
|
|
||||||
|
|
||||||
let mut ret_segments = syn::punctuated::Punctuated::new();
|
let mut ret_segments = syn::punctuated::Punctuated::new();
|
||||||
ret_segments.push(syn::PathSegment {
|
ret_segments.push(syn::PathSegment {
|
||||||
ident: syn::Ident::new(ret_property_type, proc_macro2::Span::call_site()),
|
ident: syn::Ident::new(&return_value.property_type, proc_macro2::Span::call_site()),
|
||||||
arguments: syn::PathArguments::None,
|
arguments: syn::PathArguments::None,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -122,17 +118,3 @@ fn build_function(name: String, parameters: HashMap<String, TsMethodProperty>, r
|
|||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: implement this properly
|
|
||||||
fn rust_type(js_type: &str) -> &'static str {
|
|
||||||
match js_type {
|
|
||||||
"string" => "String",
|
|
||||||
"number" => "String",
|
|
||||||
"boolean" => "bool",
|
|
||||||
"symbol" => "String",
|
|
||||||
"object" => "String",
|
|
||||||
"function" => "String",
|
|
||||||
"void" => "String",
|
|
||||||
_ => "String",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user