Recursively replaces all occurrences of `Type::Class(old_name)` with `Type::Class(new_name)`.
(&mut self, old_name: &str, new_name: &str)
| 1051 | pub fn jvm_abi_name_token(&self) -> String { |
| 1052 | fn identifier(raw: &str) -> String { |
| 1053 | let mut result = String::with_capacity(raw.len()); |
| 1054 | let mut separator = false; |
| 1055 | for ch in raw.chars() { |
| 1056 | if ch.is_ascii_alphanumeric() || ch == '_' { |
| 1057 | result.push(ch); |
| 1058 | separator = false; |
| 1059 | } else if !separator && !result.is_empty() { |
| 1060 | result.push('_'); |
| 1061 | separator = true; |
| 1062 | } |
| 1063 | } |
| 1064 | while result.ends_with('_') { |
| 1065 | result.pop(); |
| 1066 | } |
| 1067 | if result.is_empty() { |
| 1068 | "Object".to_string() |
| 1069 | } else { |
| 1070 | result |
| 1071 | } |
| 1072 | } |
| 1073 | |
| 1074 | match self { |
| 1075 | Type::Void | Type::Unit => "void".to_string(), |
| 1076 | Type::Boolean => "boolean".to_string(), |
| 1077 | Type::I8 | Type::U8 => "byte".to_string(), |
| 1078 | Type::I16 => "short".to_string(), |
| 1079 | Type::Char | Type::U16 => "char".to_string(), |
| 1080 | Type::I32 | Type::U32 => "int".to_string(), |
| 1081 | Type::I64 | Type::U64 => "long".to_string(), |
| 1082 | Type::F16 => "binary16".to_string(), |
| 1083 | Type::F32 => "float".to_string(), |
| 1084 | Type::F64 => "double".to_string(), |
no test coverage detected