From c5a178da1a237cdc525b7850b849cd92a862660f Mon Sep 17 00:00:00 2001 From: Sandipsinh Rathod Date: Sun, 22 Dec 2024 13:41:17 -0500 Subject: [PATCH] drop commented code --- src/config/fixargs.rs | 76 ------------------------------------------- 1 file changed, 76 deletions(-) diff --git a/src/config/fixargs.rs b/src/config/fixargs.rs index b507f21..85d270b 100644 --- a/src/config/fixargs.rs +++ b/src/config/fixargs.rs @@ -87,86 +87,10 @@ fn fix_field<'a>() -> TryFold<'a, (&'a Config, &'a Interface, &'a Record, &'a Fi o.records.remove(&rec); o.records.insert(rec); Valid::succeed(o) - -/* for (arg_name, ty) in records { - let arg_name = if arg_name.is_empty() { - // TODO: maybe we can introduce some transformers - // which uses AI to generate better names - base64::prelude::BASE64_STANDARD.encode(arg_name.as_bytes()) - } else { - arg_name.clone() - }; - - let name = format!("{}-{}-{}", rec.name, field.name, arg_name); - println!("name: {}", name); - let new_field = Field { - name: name.clone(), - field_type: ty.clone(), - }; - let mut rec = (*rec).clone(); - rec.added_fields.push(new_field); - let mut filtered_records = o.records.into_iter().filter(|r| r.name == rec.name).collect::>(); - filtered_records.push(rec); - - - o.records = filtered_records; - } - Valid::succeed(o)*/ - - /* Valid::from_iter(records.iter(), |(_, b)| { - fix_field() - .try_fold(&(*config, *interface, *rec, *field, b), o.clone()) - }).and_then(|v| { - o.records = v; - Valid::succeed(o) - }).and_then(|mut o| { - - })*/ } // Ideally this case should never happen, // but we should always throw an error to avoid infinite recursion _ => return Valid::fail(anyhow::anyhow!("Unknown type: {:?}", field.field_type)), } - // Valid::succeed(o) }) } - -/*fn fix_field1(ty: &WitType, mut record: Record, interface: Interface) -> Valid { - match ty { - WitType::Option(x) => { - fix_field1(x, record) - } - WitType::Result(x, y) => { - if !x.is_primitive() && !y.is_primitive() { - fix_field1(x, record).and_then(|x| fix_field1(y, x)) - } else if !x.is_primitive() { - fix_field1(x, record) - } else { - fix_field1(y, record) - } - } - WitType::List(x) => { - fix_field1(x, record) - } - WitType::Tuple(x) => { - Valid::from_iter(x.iter(), |x| fix_field1(x, record)) - .and_then(|v| Valid::succeed(v.into_iter().fold(Record::default(), |mut a, b| { - a.added_fields.extend(b.added_fields); - a - }))) - } - WitType::Record(val) => { - let mut new_field = Field::default(); - for (k, v) in val { - new_field.field_type = v.clone(); - } - - record.added_fields.push(new_field); - Valid::succeed(record) - } - // Ideally this case should never happen - // but we should always throw an error to avoid infinite recursion - _ => Valid::fail(anyhow::anyhow!("Unknown type: {:?}", ty)), - } -} -*/ \ No newline at end of file