File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,18 +65,21 @@ public static bool TryGetOperatorSymbol(this ISymbol symbol, out string operator
6565 return true ;
6666 }
6767
68- var match = CheckedRegex ( ) . Match ( methodName ) ;
69- if ( match . Success && methodToOperator . TryGetValue ( $ "op_{ match . Groups [ 1 ] } ", out var uncheckedName ) )
68+ // Attempt to parse using a regexp.
69+ var match = OperatorRegex ( ) . Match ( methodName ) ;
70+ if ( match . Success && methodToOperator . TryGetValue ( $ "op_{ match . Groups [ 2 ] } ", out var rawOperatorName ) )
7071 {
71- operatorName = $ "checked { uncheckedName } ";
72+ var prefix = match . Groups [ 1 ] . Success ? "checked " : "" ;
73+ var postfix = match . Groups [ 3 ] . Success ? "=" : "" ;
74+ operatorName = $ "{ prefix } { rawOperatorName } { postfix } ";
7275 return true ;
7376 }
7477
7578 operatorName = methodName ;
7679 return false ;
7780 }
7881
79- [ GeneratedRegex ( "^op_Checked(.*) $" ) ]
80- private static partial Regex CheckedRegex ( ) ;
82+ [ GeneratedRegex ( "^op_(Checked)?(.*?)(Assignment)? $" ) ]
83+ private static partial Regex OperatorRegex ( ) ;
8184 }
8285}
You can’t perform that action at this time.
0 commit comments