@@ -70,6 +70,16 @@ static bool isNonAscii(StringRef str) {
70
70
return false ;
71
71
}
72
72
73
+ static char mangleOperatorKind (OperatorKind operatorKind) {
74
+ switch (operatorKind) {
75
+ case OperatorKind::NotOperator: unreachable (" invalid" );
76
+ case OperatorKind::Infix: return ' i' ;
77
+ case OperatorKind::Prefix: return ' p' ;
78
+ case OperatorKind::Postfix: return ' P' ;
79
+ }
80
+ unreachable (" invalid" );
81
+ }
82
+
73
83
static void mangleIdentifier (StringRef ident, OperatorKind operatorKind,
74
84
bool usePunycode, DemanglerPrinter &out) {
75
85
std::string punycodeBuf;
@@ -99,15 +109,7 @@ static void mangleIdentifier(StringRef ident, OperatorKind operatorKind,
99
109
// operator-fixity ::= 'i' // infix
100
110
// where the count is the number of characters in the operator,
101
111
// and where the individual operator characters are translated.
102
- out << ' o' << [=] {
103
- switch (operatorKind) {
104
- case OperatorKind::NotOperator: unreachable (" invalid" );
105
- case OperatorKind::Infix: return ' i' ;
106
- case OperatorKind::Prefix: return ' p' ;
107
- case OperatorKind::Postfix: return ' P' ;
108
- }
109
- unreachable (" invalid" );
110
- }();
112
+ out << ' o' << mangleOperatorKind (operatorKind);
111
113
112
114
// Mangle ASCII operators directly.
113
115
out << ident.size ();
0 commit comments