| 3231 | } |
| 3232 | |
| 3233 | fn func_declaration(resolve: &Resolve, func: &Function) -> (String, bool) { |
| 3234 | match &func.kind { |
| 3235 | FunctionKind::Freestanding | FunctionKind::AsyncFreestanding => { |
| 3236 | (func.item_name().to_upper_camel_case(), false) |
| 3237 | } |
| 3238 | FunctionKind::Constructor(ty) => { |
| 3239 | let ty = resolve.types[*ty] |
| 3240 | .name |
| 3241 | .as_ref() |
| 3242 | .unwrap() |
| 3243 | .to_upper_camel_case(); |
| 3244 | (format!("Make{ty}"), false) |
| 3245 | } |
| 3246 | FunctionKind::Method(ty) | FunctionKind::AsyncMethod(ty) => { |
| 3247 | let ty = resolve.types[*ty] |
| 3248 | .name |
| 3249 | .as_ref() |
| 3250 | .unwrap() |
| 3251 | .to_upper_camel_case(); |
| 3252 | let camel = func.item_name().to_upper_camel_case(); |
| 3253 | (format!("(self *{ty}) {camel}"), true) |
| 3254 | } |
| 3255 | FunctionKind::Static(ty) | FunctionKind::AsyncStatic(ty) => { |
| 3256 | let ty = resolve.types[*ty] |
| 3257 | .name |
| 3258 | .as_ref() |
| 3259 | .unwrap() |
| 3260 | .to_upper_camel_case(); |
| 3261 | let camel = func.item_name().to_upper_camel_case(); |
| 3262 | (format!("{ty}{camel}"), false) |
| 3263 | } |
| 3264 | } |
| 3265 | } |
| 3266 | |
| 3267 | fn maybe_gofmt<'a>(format: Format, code: &'a [u8]) -> Cow<'a, [u8]> { |
| 3268 | thread::scope(|s| { |