diff --git a/crates/webidl/src/idl_type.rs b/crates/webidl/src/idl_type.rs index 694ac7f38..63f952d6a 100644 --- a/crates/webidl/src/idl_type.rs +++ b/crates/webidl/src/idl_type.rs @@ -335,86 +335,6 @@ terms_to_idl_type! { } impl<'a> IdlType<'a> { - /// Generates a camel case type name. - #[allow(dead_code)] - pub(crate) fn push_camel_case_name(&self, dst: &mut String) { - match self { - IdlType::Boolean => dst.push_str("Bool"), - IdlType::Byte => dst.push_str("I8"), - IdlType::Octet => dst.push_str("U8"), - IdlType::Short => dst.push_str("I16"), - IdlType::UnsignedShort => dst.push_str("U16"), - IdlType::Long => dst.push_str("I32"), - IdlType::UnsignedLong => dst.push_str("U32"), - IdlType::LongLong => dst.push_str("I64"), - IdlType::UnsignedLongLong => dst.push_str("U64"), - | IdlType::Float - | IdlType::UnrestrictedFloat => dst.push_str("F32"), - | IdlType::Double - | IdlType::UnrestrictedDouble => dst.push_str("F64"), - | IdlType::DomString - | IdlType::ByteString - | IdlType::UsvString => dst.push_str("Str"), - IdlType::Object => dst.push_str("Object"), - IdlType::Symbol => dst.push_str("Symbol"), - IdlType::Error => dst.push_str("Error"), - - IdlType::ArrayBuffer => dst.push_str("ArrayBuffer"), - IdlType::DataView => dst.push_str("DataView"), - IdlType::Int8Array => dst.push_str("I8Array"), - IdlType::Uint8Array => dst.push_str("U8Array"), - IdlType::Uint8ClampedArray => dst.push_str("U8ClampedArray"), - IdlType::Int16Array => dst.push_str("I16Array"), - IdlType::Uint16Array => dst.push_str("U16Array"), - IdlType::Int32Array => dst.push_str("I32Array"), - IdlType::Uint32Array => dst.push_str("U32Array"), - IdlType::Float32Array => dst.push_str("F32Array"), - IdlType::Float64Array => dst.push_str("F64Array"), - - IdlType::Interface(name) => dst.push_str(&camel_case_ident(name)), - IdlType::Dictionary(name) => dst.push_str(&camel_case_ident(name)), - IdlType::Enum(name) => dst.push_str(&camel_case_ident(name)), - - IdlType::Nullable(idl_type) => { - dst.push_str("Opt"); - idl_type.push_snake_case_name(dst); - }, - IdlType::FrozenArray(idl_type) => { - idl_type.push_snake_case_name(dst); - dst.push_str("FrozenArray"); - }, - IdlType::Sequence(idl_type) => { - idl_type.push_snake_case_name(dst); - dst.push_str("Sequence"); - }, - IdlType::Promise(idl_type) => { - idl_type.push_snake_case_name(dst); - dst.push_str("Promise"); - }, - IdlType::Record(idl_type_from, idl_type_to) => { - dst.push_str("RecordFrom"); - idl_type_from.push_snake_case_name(dst); - dst.push_str("To"); - idl_type_to.push_snake_case_name(dst); - }, - IdlType::Union(idl_types) => { - dst.push_str("UnionOf"); - let mut first = true; - for idl_type in idl_types { - if first { - first = false; - } else { - dst.push_str("And"); - } - idl_type.push_snake_case_name(dst); - } - }, - - IdlType::Any => dst.push_str("Any"), - IdlType::Void => dst.push_str("Void"), - } - } - /// Generates a snake case type name. pub(crate) fn push_snake_case_name(&self, dst: &mut String) { match self {