File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2871,13 +2871,16 @@ trait ToMoonBitIdent: ToOwned {
28712871
28722872impl ToMoonBitIdent for str {
28732873 fn to_moonbit_ident ( & self ) -> String {
2874- // Escape MoonBit keywords
2874+ // Escape MoonBit keywords and reserved keywords
28752875 match self {
2876- "continue" | "for" | "match" | "if" | "pub" | "priv" | "readonly" | "break"
2877- | "raise" | "try" | "except" | "catch" | "else" | "enum" | "struct" | "type"
2878- | "trait" | "return" | "let" | "mut" | "while" | "loop" | "extern" | "with"
2879- | "throw" | "init" | "main" | "test" | "in" | "guard" | "typealias" | "const"
2880- | "method" | "move" | "do" | "static" | "final" => {
2876+ "module" | "move" | "ref" | "static" | "super" | "unsafe" | "use" | "where"
2877+ | "await" | "dyn" | "abstract" | "do" | "final" | "macro" | "override" | "typeof"
2878+ | "virtual" | "yield" | "local" | "method" | "alias" | "assert" | "as" | "else"
2879+ | "extern" | "fn" | "if" | "let" | "const" | "match" | "mut" | "type" | "typealias"
2880+ | "struct" | "enum" | "trait" | "traitalias" | "derive" | "while" | "break"
2881+ | "continue" | "import" | "return" | "throw" | "raise" | "try" | "catch" | "pub"
2882+ | "priv" | "readonly" | "true" | "false" | "_" | "test" | "loop" | "for" | "in"
2883+ | "impl" | "with" | "guard" | "async" | "is" | "init" | "main" => {
28812884 format ! ( "{self}_" )
28822885 }
28832886 _ => self . to_snake_case ( ) ,
You can’t perform that action at this time.
0 commit comments