From d6ec2289fcacebac4170364eed404db0a46de189 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Thu, 7 Jun 2018 14:56:48 -0300 Subject: [PATCH] Remove wrong types conversion from js to rust We can revisit this when we have better tests. --- crates/typescript/src/parser.rs | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/crates/typescript/src/parser.rs b/crates/typescript/src/parser.rs index 1fb8e9fc..cc765542 100644 --- a/crates/typescript/src/parser.rs +++ b/crates/typescript/src/parser.rs @@ -67,11 +67,9 @@ fn parse_json(file_name: &str) -> TsPackage { fn build_function(name: String, parameters: HashMap, return_value: TsReturnValue) -> Function { let arguments = parameters.iter().map( |(_name, property)| { - let property_type = rust_type(&property.property_type); - let mut segments = syn::punctuated::Punctuated::new(); 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, }); @@ -84,11 +82,9 @@ fn build_function(name: String, parameters: HashMap, r }) }).collect::>(); - let ret_property_type = rust_type(&return_value.property_type); - let mut ret_segments = syn::punctuated::Punctuated::new(); 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, }); @@ -122,17 +118,3 @@ fn build_function(name: String, parameters: HashMap, 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", - } -}