| 2026 | } |
| 2027 | |
| 2028 | fn modifiers(func: &Function, name: &str, direction: Direction) -> String { |
| 2029 | let new_modifier = match &func.kind { |
| 2030 | // Avoid warnings about name clashes. |
| 2031 | // |
| 2032 | // TODO: add other `object` method names here |
| 2033 | FunctionKind::Method(_) if name == "GetType" => " new", |
| 2034 | _ => "", |
| 2035 | }; |
| 2036 | |
| 2037 | let static_modifiers = match &func.kind { |
| 2038 | FunctionKind::Freestanding |
| 2039 | | FunctionKind::Static(_) |
| 2040 | | FunctionKind::AsyncFreestanding |
| 2041 | | FunctionKind::AsyncStatic(_) => "static", |
| 2042 | _ => "", |
| 2043 | }; |
| 2044 | |
| 2045 | let abstract_modifier = match (direction, &func.kind) { |
| 2046 | (Direction::Export, _) => " abstract", |
| 2047 | _ => "", |
| 2048 | }; |
| 2049 | |
| 2050 | let async_modifier = match &func.kind { |
| 2051 | FunctionKind::AsyncMethod(_) | FunctionKind::AsyncStatic(_) if abstract_modifier == "" => { |
| 2052 | " async" |
| 2053 | } |
| 2054 | _ => "", |
| 2055 | }; |
| 2056 | |
| 2057 | format!("{static_modifiers}{abstract_modifier}{async_modifier}{new_modifier}") |
| 2058 | } |
| 2059 | |
| 2060 | fn int_type(int: Int) -> &'static str { |
| 2061 | match int { |