From 9af6e7de3f1261174bc0e5b6a84ff11106316252 Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Wed, 6 Mar 2024 18:31:15 +0800 Subject: [PATCH] fix: err --- .../src/library/codegen/generator/codec/sse/lang/dart.rs | 5 ++--- .../src/library/codegen/generator/codec/sse/ty/structure.rs | 5 +---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/frb_codegen/src/library/codegen/generator/codec/sse/lang/dart.rs b/frb_codegen/src/library/codegen/generator/codec/sse/lang/dart.rs index 0a049a950a..264b987abd 100644 --- a/frb_codegen/src/library/codegen/generator/codec/sse/lang/dart.rs +++ b/frb_codegen/src/library/codegen/generator/codec/sse/lang/dart.rs @@ -22,14 +22,13 @@ impl LangTrait for DartLang { fn call_constructor( &self, class_name: &str, - ctor_name: Option<&str>, + ctor_postfix: &str, field_names: &[String], var_names: &[String], keyword_args: bool, ) -> String { - let dotted_ctor_name = ctor_name.map_or_else(|| "".to_owned(), |x| format!(".{x}")); format!( - "{class_name}{dotted_ctor_name}({})", + "{class_name}{ctor_postfix}({})", multizip((field_names, var_names)) .map(|(x, y)| if keyword_args { format!("{x}: {y}") diff --git a/frb_codegen/src/library/codegen/generator/codec/sse/ty/structure.rs b/frb_codegen/src/library/codegen/generator/codec/sse/ty/structure.rs index 40950241ac..d0a1448dcb 100644 --- a/frb_codegen/src/library/codegen/generator/codec/sse/ty/structure.rs +++ b/frb_codegen/src/library/codegen/generator/codec/sse/ty/structure.rs @@ -78,10 +78,7 @@ impl<'a> GeneralizedStructGenerator<'a> { let ctor = match self.mode { Struct => lang.call_constructor( &override_struct_name.unwrap_or_else(|| self.st.name.style(lang)), - Some(dart_constructor_postfix( - &self.st.name, - &self.context.ir_pack.funcs, - )), + dart_constructor_postfix(&self.st.name, &self.context.ir_pack.funcs), &(self.st.fields.iter()) .map(|x| x.name.style(lang)) .collect_vec(),