Skip to content

Commit e85de53

Browse files
authored
Fix CharInClass reference in regex emitter (#61559)
We've tried to consistently use global:: whenever referring to core library types in the regex generator emitted code. I'd missed these two. (That said, these make the code a lot harder to read, especially in places where we're unable to use extension methods as extensions, so we'll want to revisit this policy.)
1 parent a53e489 commit e85de53

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3419,8 +3419,8 @@ private static string MatchCharacterClass(bool hasTextInfo, RegexOptions options
34193419
// characters other than that some might be included, for example if the character class
34203420
// were [\w\d], so since ch >= 128, we need to fall back to calling CharInClass.
34213421
return invariant ?
3422-
$"((ch = {chExpr}) < 128 ? ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) != 0 : CharInClass(char.ToLowerInvariant((char)ch), {Literal(charClass)}))" :
3423-
$"((ch = {chExpr}) < 128 ? ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) != 0 : CharInClass((char)ch, {Literal(charClass)}))";
3422+
$"((ch = {chExpr}) < 128 ? ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) != 0 : global::System.Text.RegularExpressions.RegexRunner.CharInClass(char.ToLowerInvariant((char)ch), {Literal(charClass)}))" :
3423+
$"((ch = {chExpr}) < 128 ? ({Literal(bitVectorString)}[ch >> 4] & (1 << (ch & 0xF))) != 0 : global::System.Text.RegularExpressions.RegexRunner.CharInClass((char)ch, {Literal(charClass)}))";
34243424
}
34253425

34263426
private static string Literal(char c) => SymbolDisplay.FormatLiteral(c, quote: true);

0 commit comments

Comments
 (0)